Module talk:Ancient Olympiads

(Redirected from Module talk:Ancient Olympiads/doc)
Latest comment: 9 years ago by Mr. Stradivarius
@Mr. Stradivarius: I have fixed the module, and everything's working fine in the debug console, but it still doesn't run in the calendar.--Hyphantes (talk) 21:18, 19 April 2015 (UTC)Reply
@Mr. Stradivarius: It appears that the values %s and %d can be used only once in a string to produce a link. In the following script they are used twice in both functions. The following script uses them twice for two links, but in the calendar only one displays correctly.
 
		if inputYear - 1 == t.year then
			-- year of the Olympiad, test with = p._main( -495 )
			-- The input year in the calendar appears to be one year to low (-775 for the year 776 BC). This is why all values need to be corrected by 1. 
		return string.format(
			'%s [[Olympiad]] ([[%s|victor]][[Winner of the Stadion race|)¹]]',
			t.numberOl, t.winner
		)
		end
        if inputYear > t.year then
			-- Years 2-4 of the Olympiad, test with = p._main( -494 )  etc.
		return string.format(
			'%s [[Olympiad]], [[%d BC|year %d]]',
			t.numberOl, inputYear * - 1 + 1, inputYear - t.year 
		)
		end
  
In the first case the result in the calendar is:
71st Olympiad (victor
instead of
71st Olympiad (victor
In the second it is:
71st Olympiad, year 2
instead of
71st Olympiad, year 2
Is there a way to work around these problems or do I have to live with these limitations?--Hyphantes (talk) 22:58, 19 April 2015 (UTC)Reply
@Hyphantes: Sounds like you're creating a link to the current page - those links always show up in bold. For example, on this page, if I use the code [[Module talk:Ancient Olympiads]], it looks like this: Module talk:Ancient Olympiads. This is a feature of the MediaWiki software, and you can't turn it off. It doesn't really make much sense to always generate a link to the page that a reader is looking at, so that part of the module should just be plain text, not a link. — Mr. Stradivarius ♪ talk ♪ 07:13, 20 April 2015 (UTC)Reply
Also, if you want to test individual year articles using Module:Year in other calendars/sandbox, you can do it by installing User:Jackmcbarn/advancedtemplatesandbox.js. That allows you to make pages you preview think that the sandbox page is the real module, by changing "Module:Year in other calendars/sandbox" to "Module:Year in other calendars" in the Template name box. — Mr. Stradivarius ♪ talk ♪ 07:18, 20 April 2015 (UTC)Reply

You're right. It's a link to the current page. I'm afraid I need to reorganize my data if I want to get rid of the bold characters. On the other hand: they don't disturb that much.--Hyphantes (talk) 13:01, 20 April 2015 (UTC)Reply

@Hyphantes: +1 to the idea of reorganising the data. Generally it's best to keep data as granular as possible in case you want to change the formatting later. I suggest doing it now before it's too painful. :) — Mr. Stradivarius ♪ talk ♪ 13:48, 20 April 2015 (UTC)Reply