Module talk:User:Victar/collapse-quote

From Wiktionary, the free dictionary
Latest comment: 5 years ago by Victar
Jump to navigation Jump to search

@Erutuon, I had this working so well as just a template, until I turned it into a module, and now my lists are broken. Could you tell me what I'm doing wrong? --Victar (talk) 01:14, 22 November 2018 (UTC)Reply

I guess you mean this bit? **** {{desc|sa|tr=múraḥ|pos=pl.}}{{collapse-quote|...}} ***** {{desc|sa|tr=āmúraḥ|pos=pl.|der=1}}, {{l|sa|tr=āmúrim|pos=acc.sg.}}{{collapse-quote|...}} If I stick it in Special:ExpandTemplates and look at the resulting wikitext, it has an extra newline after the first {{collapse-quote}}. So the second line is assigned to a new list. and a bunch of bullets are displayed. Aha, the template page had a newline after the invocation of the module. Gotta watch your whitespace. — Eru·tuon 03:53, 22 November 2018 (UTC)Reply
It's always the simplest of mistakes. Thanks, @Erutuon! -- Victar (talk) 04:07, 22 November 2018 (UTC)Reply

@Erutuon, I'm trying to incorporate Module:Quotations, but I'm getting Module:Quotations:49: attempt to call method 'getParent' (a nil value):. Do you think you could have a look? --Victar (talk) 07:40, 23 November 2018 (UTC)Reply

@Victar: That's because the function expects a frame object, which has a getParent method. I've made export.Create take a table of args as your module requires, because the only thing from frame it ever uses is frame:getParent().args. — Eru·tuon 16:08, 23 November 2018 (UTC)Reply
Hmm, @Erutuon, I can't pass lang or args[1][i] to |1=, and when I manually pass "sa" to it, it doesn't format it using Module:Quotations/sa/data. --Victar (talk) 16:26, 23 November 2018 (UTC)Reply
Sorry, I don't understand. Can you put examples of whatever's going wrong on the documentation page of this module? — Eru·tuon 16:43, 23 November 2018 (UTC)Reply
@Erutuon, No matter what I try, I get Lua error in Module:languages at line 389: The function getByCode expects a string as its first argument, but received a table. For the latter problem, I'm getting RV 1.068.10 instead of Ṛgveda 1.068.10.
I guess I've figured out what you mean. args[1] is a string and indexing a string returns nil (because it returns the same result as indexing the string library), so args[1][i] is always nil. And the result of m_languages.getByCode(args[1]) is a table, so if you pass it as argument of m_languages.getByCode, you get a complaint. I don't know what's going on with the second bit. — Eru·tuon 17:31, 23 November 2018 (UTC)Reply
@Erutuon: Hmm, so how should I be passing the language code? --Victar (talk) 18:52, 23 November 2018 (UTC)Reply
The way it's currently being passed, as a string. — Eru·tuon 19:51, 23 November 2018 (UTC)Reply
Ah, got it now, thanks. --Victar (talk) 19:56, 23 November 2018 (UTC)Reply