Template talk:R:sem-pro:FS Militarev
Add topic“Expression error: Unexpected <= operator” when trying to profer author names and essay titles based on the page numbers given by the template user
[edit]I tried to use the following code:
-->|last= {{#ifexpr: {{#invoke:ugly hacks|match|{{{page|{{{pages}}}}}}|[0-9]+|}} <= 17 and {{#invoke:ugly hacks|match|{{{page|{{{pages}}}}}}|[0-9]+|}} >= 3 | Bulakh}} {{#ifexpr: {{#invoke:ugly hacks|match|{{{page|{{{pages}}}}}}|[0-9]+|}} <= 52 and {{#invoke:ugly hacks|match|{{{page|{{{pages}}}}}}|[0-9]+|}} >= 18 | Del Olmo Lete}} {{#ifexpr: {{#invoke:ugly hacks|match|{{{page|{{{pages}}}}}}|[0-9]+|}} <= 78 and {{#invoke:ugly hacks|match|{{{page|{{{pages}}}}}}|[0-9]+|}} >= 53 | Dietrich}} {{#ifexpr: {{#invoke:ugly hacks|match|{{{page|{{{pages}}}}}}|[0-9]+|}} <= 101 and {{#invoke:ugly hacks|match|{{{page|{{{pages}}}}}}|[0-9]+|}} >= 79 | Frolova}} {{#ifexpr: {{#invoke:ugly hacks|match|{{{page|{{{pages}}}}}}|[0-9]+|}} <= 119 and {{#invoke:ugly hacks|match|{{{page|{{{pages}}}}}}|[0-9]+|}} >= 102 | Huehnergard}} {{#ifexpr: {{#invoke:ugly hacks|match|{{{page|{{{pages}}}}}}|[0-9]+|}} <= 140 and {{#invoke:ugly hacks|match|{{{page|{{{pages}}}}}}|[0-9]+|}} >= 120 | Kogan}} {{#ifexpr: {{#invoke:ugly hacks|match|{{{page|{{{pages}}}}}}|[0-9]+|}} <= 151 and {{#invoke:ugly hacks|match|{{{page|{{{pages}}}}}}|[0-9]+|}} >= 141 | Marrassini}} {{#ifexpr: {{#invoke:ugly hacks|match|{{{page|{{{pages}}}}}}|[0-9]+|}} <= 189 and {{#invoke:ugly hacks|match|{{{page|{{{pages}}}}}}|[0-9]+|}} >= 152 | Rubio}}<!-- -->|first= {{#ifexpr: {{#invoke:ugly hacks|match|{{{page|{{{pages}}}}}}|[0-9]+|}} <= 17 and {{#invoke:ugly hacks|match|{{{page|{{{pages}}}}}}|[0-9]+|}} >= 3 | Maria }} {{#ifexpr: {{#invoke:ugly hacks|match|{{{page|{{{pages}}}}}}|[0-9]+|}} <= 52 and {{#invoke:ugly hacks|match|{{{page|{{{pages}}}}}}|[0-9]+|}} >= 18 | Gregorio}} {{#ifexpr: {{#invoke:ugly hacks|match|{{{page|{{{pages}}}}}}|[0-9]+|}} <= 78 and {{#invoke:ugly hacks|match|{{{page|{{{pages}}}}}}|[0-9]+|}} >= 53 | Manfried}} {{#ifexpr: {{#invoke:ugly hacks|match|{{{page|{{{pages}}}}}}|[0-9]+|}} <= 101 and {{#invoke:ugly hacks|match|{{{page|{{{pages}}}}}}|[0-9]+|}} >= 79 | Tatiana}} {{#ifexpr: {{#invoke:ugly hacks|match|{{{page|{{{pages}}}}}}|[0-9]+|}} <= 119 and {{#invoke:ugly hacks|match|{{{page|{{{pages}}}}}}|[0-9]+|}} >= 102 | John}} {{#ifexpr: {{#invoke:ugly hacks|match|{{{page|{{{pages}}}}}}|[0-9]+|}} <= 140 and {{#invoke:ugly hacks|match|{{{page|{{{pages}}}}}}|[0-9]+|}} >= 120 | Leonid}} {{#ifexpr: {{#invoke:ugly hacks|match|{{{page|{{{pages}}}}}}|[0-9]+|}} <= 151 and {{#invoke:ugly hacks|match|{{{page|{{{pages}}}}}}|[0-9]+|}} >= 141 | Paolo}} {{#ifexpr: {{#invoke:ugly hacks|match|{{{page|{{{pages}}}}}}|[0-9]+|}} <= 189 and {{#invoke:ugly hacks|match|{{{page|{{{pages}}}}}}|[0-9]+|}} >= 152 | Gonzalo}}<!--
This code gives me module errors whereas it does not give module errors when used in other parameters as |pageurl=
. If I replace |last=
and |first=
with |pageurl=
for example – the same syntax I use in many other templates, as in {{R:Nöldeke:Neue Beitr.}}
or {{R:arc:Löw-Flora}}
. Apparently someone did not expect that one wants to compare numbers in the parameters |author=
, |last=
etc.? Palaestrator verborum sis loquier 🗣 19:47, 31 December 2017 (UTC)
- Gee, I have no idea. I don't think it's the way
{{cite-meta}}
is set up. The|author=
and|last=
fields are just ordinary fields like|pageurl=
. Perhaps it's an issue with{{Module:ugly hacks}}
? I'm afraid I'm not familiar with Lua modules, but could the problem be due to editors using an en dash in ranges of pages, like|pages=110–111
? — SGconlaw (talk) 05:26, 1 January 2018 (UTC)
- No, the error appears in the preview already, i. e. without any pagenumber yet set. I’d like to know though what I could use instead of
{{Module:ugly hacks}}
as it is supposed to be outsorted. I need some example what to use instead. @Sgconlaw – Also @Erutuon Palaestrator verborum sis loquier 🗣 05:45, 1 January 2018 (UTC)
- No, the error appears in the preview already, i. e. without any pagenumber yet set. I’d like to know though what I could use instead of
- @Palaestrator verborum: In what situation was there a module error? On the template page, or when you supplied a
|page=
or|pages=
parameter? I'd expect an error on the template page: if the "match" function didn't find a number, the expression in{{#ifexpr:}}
would be malformed:{{#ifexpr: <= 17 and >= 3|Bulakh}}
, for instance. — Eru·tuon 07:27, 1 January 2018 (UTC) - In any case, doing this with a module would be much neater. It would require just one module invocation and match operation instead of 32. I'm just not sure what to call the module. — Eru·tuon 07:37, 1 January 2018 (UTC)
- It would probably be best if @Erutuon could whip up a module to achieve this. (Maybe it could be called "author selector"?) The effect could be achieved without too much difficulty using Wikitext operators alone if only the result of
|page=
is used, as this is always going to be a number, but if you want it to work with|pages=
as well this is difficult, because the value of that parameter is going to be two numbers separated by (usually) an en dash, so there has to be some way of extracting the number before the en dash and I don't think there's an easy way to do it using Wikitext. In quotation templates that I create such as{{RQ:Dryden Fables}}
, I get over this problem by requiring editors who use|pages=
to explicitly use|pageref=
to specify the PDF page number that they wish to link to. — SGconlaw (talk) 11:08, 1 January 2018 (UTC)- I never wanted to work with
|page=
and|pages=
at the same time. I just took it as the English habit to pluralize pages, columns and so on; also I just made the templates I made as others which used both before. How fixed is the rule? In German such is not pluralized, so S., Rn. etc., likewise in Latin it is not that expected. @Erutuon I meant when previewing the template when I tried to change it already gave errors. When I just replaced the author resp. last/first parameters with|pageurl=
for example, the error went away in the preview. - What I can imagine is that one could give ranges with two parameters, say
|page=
and|pageend=
, to have multiple pages – the citation templates like{{cite-book}}
would need|pagend=
then for such cases. Regard also that one sometimes does not want to specify a concrete end page and writes something like pp. 203 seqq., though I do not know how much other people are used to this Latinate usage. - Well @Sgconlaw, I have also devised
|1=
in quotation templates, as in{{RQ:Deschner}}
, for choosing between works. I thought I could in the case of this festschrift make the giving of the author names and entry titles easier by having them saved in the template and having them displayed according to the page numbers cited so the template user does not need to add those each time, which would defy the point of having a reference template. - As for a name, the name could be referencesubselector to stay abstract. As you want an abstract function that could be used accross multiple similar templates by passing author names and entry names for ranges, not only a module for this festschrift I guess? Palaestrator verborum sis loquier 🗣 14:12, 1 January 2018 (UTC)
- @Sgconlaw: Dashes won't cause problems.
{{#invoke:ugly hacks|match|{{{pages}}}|[0-9]+|}}
with|pages=30–33
will return the first number in the parameter,30
. — Eru·tuon 19:41, 1 January 2018 (UTC) - @Palaestrator verborum: I've created an
FS_Militaev
function inModule:User:Erutuon/09Module:reference information, which might be ready to go. [Edit: Implemented.] — Eru·tuon 20:43, 1 January 2018 (UTC)
- @Sgconlaw: Dashes won't cause problems.
- I never wanted to work with
- It would probably be best if @Erutuon could whip up a module to achieve this. (Maybe it could be called "author selector"?) The effect could be achieved without too much difficulty using Wikitext operators alone if only the result of
- @Erutuon:: Very nice. It also looks like something that could be copied for other templates; I don’t know how much it can be generalized more.
- Here I post the titles of the pieces which the authors have written and fit to the
|entry=
parameter – I have not posted them before because I quit collecting when I saw the error.
{ 3, 17, "Etymological Notes on the Akkadian Colour Terms" }, { 18, 52, "The Genetic Historical Classification of the Semitic Languages" }, { 53, 78, "„Vokalbuchstaben“ im Keilalphabet von Ugarit und im griechischen Alphabet in Historischer Betrachtung. Zu neueren Beiträgen in der Alphabetforschung" }, { 79, 101, "The Reconstruction of the Vowel in the Proto-Semitic Verbal Base -C₁C₂VC₃ – The Evidence of Akkadian and Arabic." }, { 102, 119, "Akkadian ḫ and West-Semitic *ḥ¹" }, { 120, 140, "Popular Etymology in the Semitic Languages" }, { 141, 151, "The Semites in Abyssinia: Onomastic and Lexicographical Notes"}, { 152, 189, "Falling Trees and Forking Tongues: On the Place of Akkadian and Eblaite within Semitic" }, { 190, 216, "Sekundäres wortanlautendes Alif im Arabischen"}, { 219, 229, "Isoglosses yéménites-couchitiques" }, { 230, 294, "Fauna in Beja Lexicon. A Fragment of a Comparative-Etymological Dictionary of Beja" }, { 295, 302, "Loss and Growth. Chadic in a Historical Perspective" }, { 303, 314, "Notes sur les noms d’action verbaux en berbère: formes et emplois" }, { 315, 330, "Tashelhiyt Berber Folktales and Riddles from the Ida Ou Tanan Region (Western High Atlas, Morocco)" }, { 331, 348, "Lexica Afroasiatica II" }, { 351, 377, "ARM X 4: A Commentary" }, { 378, 388, "''alap erṣetim'' and ''nēšu ša ḳaḳḳari'': Animals of the Ground or Beasts of the Netherworld?" }, { 389, 406, "Exodus 19.12b–13b. As an Expanded Legal Formula" }, { 407, 423, "Der Name Rīmuš" }, { 424, 431, "Sprache und Denken im Alten Mesopotamien am Beispiel des Zeitausdrucks" }, { 432, 442, "ˁm, ˁlhym and God Abraham" }, { 445, 463, "Paralleli arabo-islamici con il racconto samaritano sulla figlia di Amram" }, { 464, 484, "Statistical Evaluation of the Lexical Proximity between the Main Linguistic Families of the World" },
Palaestrator verborum sis loquier 🗣 22:26, 1 January 2018 (UTC)
- Added those titles at the ends of the existing arrays, and a string to identify them, and inserted the chapter (or whatever it is) title into the template. — Eru·tuon 22:44, 1 January 2018 (UTC)
Transcribed data for another book
[edit]local works2 = { -- From [[Template talk:R:sem-pro:FS Militarev]]. FS_Weninger_Handbook = { indices = { last = 3, first = 4, title = 5 }, { 1, 6, "Weninger", "Stefan", "Introduction" }, { 7, 17, "Takács", "Gábor", "Semitic-Egyptian Relations" }, { 18, 26, "Brugnatelli", "Vermondo", "Semitic-Berber Relations" }, { 27, 37, "Wolff", "Ekkehard", "Semitic-Chadic Relations" }, { 38, 53, "Appleyard", "David L.", "Semitic-Cushitic/Omotic Relations" }, { 54, 150, "Kogan", "Leonid", "Proto-Semitic Phonetics and Phonology" }, { 151, 178, "Weninger", "Stefan", "Reconstructive Morphology" }, { 179, 258, "Kogan", "Leonid", "Proto-Semitic Lexicon" }, { 259, 278, "Huehnergard", "John", "Phyla and Waves: Models of Classification of the Semitic Languages" }, { 279, 302, "Gensler", "Orin D.", "Morphological Typology of Semitic" }, { 303, 329, "Waltisberg", "Martin", "Syntactic Typology of Semitic" }, { 330, 339, "Kouwenberg", "Bert", "Akkadian in General" }, { 340, 358, "Streck", "Michael P.", "Eblaite and Old Akkadian" }, { 359, 395, "Streck", "Michael P.", "Babylonian and Assyrian" }, { 396, 404, "Zólyomi", "Gábor", "Akkadian and Sumerian Language Contact" }, { 405, 415, "Soldt", "Wilfred H.", "Akkadian as a Diplomatic Language" }, { 416, 425, "Streck", "Michael P.", "Akkadian and Aramaic Language Contact" }, { 425, 451, "Gzella", "Holger", "Northwest Semitic in General" }, { 452, 459, "Streck", "Michael P.", "Amorite" }, { 460, 471, "Pardee", "Dennis", "Ugaritic" }, { 472, 479, "Röllig", "Wolfgang", "Phoenician and Punic" }, { 480, 514, "Edzard", "Lutz", "Biblical Hebrew" }, { 515, 522, "Bar-Asher", "Moshe", "Mishnaic Hebrew" }, { 523, 536, "Schwarzwald", "Ora", "Modern Hebrew" }, { 537, 545, "Sáenz-Badillos", "Angel", "Hebrew as the Language of Judaism" }, { 546, 554, "Yael", "Reshef", "The Re-Emergence of Hebrew as a National Language" }, { 555, 573, "Fales", "Frederick Mario", "Old Aramaic" }, { 574, 586, "Gzella", "Holger", "Imperial Aramaic" }, { 587, 597, "Folmer", "Margaretha", "Imperial Aramaic as an Administrative Language of the Achaemenid Period" }, { 598, 609, "Gzella", "Holger", "Late Imperial Aramaic" }, { 610, 618, "Sokoloff", "Michael", "Jewish Palestinian Aramaic" }, { 619, 627, "Tal", "Abraham", "Samaritan Aramaic" }, { 628, 636, "Morgenstern", "Matthew", "Christian Palestinian Aramaic" }, { 637, 651, "Healey", "John F.", "Syriac" }, { 652, 659, "Chatonnet", "Françoise Briquel", "Syriac as the Language of Eastern Christianity" }, { 660, 669, "Sokoloff", "Michael", "Jewish Babylonian Aramaic" }, { 670, 684, "Burtea", "Bogdan", "Mandaic" }, { 685, 696, "Arnold", "Werner", "Western Neo-Aramaic" }, { 697, 698, "Jastrow", "Otto", "Ṭuroyo and Mlaḥsô" }, { 708, 724, "Khan", "Geoffrey", "North-Eastern Neo-Aramaic" }, { 725, 737, "Häberl", "Charles G.", "Neo-Mandaic" }, { 738, 746, "Kapeliuk", "Olga", "Language Contact between Aramaic Dialects and Iranian" }, { 747, 755, "Weninger", "Stefan", "Aramaic-Arabic Language Contact" }, { 756, 781, "Hayajneh", "Hani", "Ancient North Arabian" }, { 781, 810, "Retsö", "Jan", "Classical Arabic" }, { 811, 816, "Abdel Haleem", "Muhammad A. S.", "Arabic as the Language of Islam" }, { 817, 834, "Khan", "Geoffrey", "Middle Arabic" }, { 835, 843, "Glaß", "Dagmar", "Creating a Modern Standard Language from Medieval Tradition: The Nahḍa and the Arabic Academies" }, { 844, 850, "Ryding", "Karin C.", "Modern Standard Arabic" }, { 851, 896, "Watson", "Janet C. E.", "Arabic Dialects (general article)" }, { 897, 908, "Watson", "Janet C. E.", "Dialects of the Arabian Peninsula" }, { 909, 919, "Talay", "Shabo", "Arabic Dialects of Mesopotamia" }, { 920, 934, "Naïm", "Samia", "Dialects of the Levant" }, { 935, 954, "Dickins", "James", "Dialects of Egypt and Sudan" }, { 955, 969, "Pereira", "Christophe", "Arabic in the North African Region" }, { 970, 981, "Owens", "Jonathan", "Arabic Sociolinguistics" }, { 982, 989, "Miller", "Catherine", "Arabic Urban Vernaculars" }, { 990, 1000, "Luffin", "Xavier", "Arabic-based Pidgins and Creoles" }, { 1001, 1014, "Tilmatine", "Mohand", "Berber and Arabic Language Contact" }, { 1015, 1021, "Dénes", "Gazsi", "Arabic-Persian Language Contact" }, { 1022, 1032, "Lutz", "Edzard", "Language Contact between Arabic and Modern European Languages" }, { 1033, 1041, "Borg", "Albert", "Maltese as a National Language" }, { 1042, 1072, "Stein", "Peter", "Ancient South Arabian" }, { 1073, 1113, "Simeone-Senelle", "Marie-Claude", "Modern South Arabian" }, { 1114, 1123, "Weninger", "Stefan", "Ethio-Semitic in General" }, { 1124, 1141, "Weninger", "Stefan", "Old Ethiopic" }, { 1142, 1152, "Morin", "Didier", "Tigre" }, { 1153, 1169, "Voigt", "Rainer", "Tigrinya" }, { 1170, 1177, "Voigt", "Rainer", "Tigrinya as National Language of Eritrea and Tigray" }, { 1178, 1211, "Meyer", "Ronny", "Amharic" }, { 1212, 1219, "Meyer", "Ronny", "The Role of Amharic as a National Language and an African ''lingua franca''" }, { 1220, 1256, "Meyer", "Ronny", "Gurage" }, { 1257, 1265, "Wagner", "Ewald", "Harari" }, { 1266, 1276, "Crass", "Joachim", "Ethiosemitic-Cushitic Language Contact" }, }, }
I don’t know hot to integrate it neatly with the rest, I could only double the functions and would maybe even then make an error. @Erutuon The third time I have transcribed book entry date I should be able to do it myself I guess … Palaestrator verborum sis loquier 🗣 18:11, 7 January 2018 (UTC) Linking the book template: Template:R:sem-pro:Weninger-Handbook Palaestrator verborum sis loquier 🗣 18:12, 7 January 2018 (UTC)
- @Palaestrator verborum: I've added that data, moved the data to Module:User:Erutuon/09/data, and created a more general retrieval function, and you can invoke it in this new template as follows:
{{#invoke:User:Erutuon/09|retrieve|the name of the work in the data module|key in the "indices" table}}
. — Eru·tuon 21:44, 7 January 2018 (UTC)
- @Erutuon: Many thanks! Would it work or would it cause an error if added another index (6 in this case), but only data for it in some lines? As for example for three pieces in that The Semitic Languages. An International Handbook I could use the template parameter
|coauthors=
Palaestrator verborum sis loquier 🗣 22:59, 7 January 2018 (UTC)- @Palaestrator verborum: I think it should be fine. The function would just return
nil
, which would display as an empty string. — Eru·tuon 23:10, 7 January 2018 (UTC)
- @Palaestrator verborum: I think it should be fine. The function would just return
- @Erutuon: Many thanks! Would it work or would it cause an error if added another index (6 in this case), but only data for it in some lines? As for example for three pieces in that The Semitic Languages. An International Handbook I could use the template parameter