Module talk:Signpost: Difference between revisions

Content deleted Content added
 
(3 intermediate revisions by the same user not shown)
Line 164:
::{{ping|Mr. Stradivarius}} I was able to figure out what was going on in {{tl|CSS crop}} well enough to implement it (far slimmer) on the snippet template; specifics (and examples) at [[Wikipedia talk:Wikipedia Signpost/Newsroom#Template for article images]]. Here is what the template looks like with all its arguments;
<nowiki>{{Signpost/snippet|2023-12-04|Essay|I am going to die|And so are you.|0.3&nbsp;MB|sub=0.3&nbsp;MB|by=[[User:WhatamIdoing|WhatamIdoing]]|pic=File:Memento Mori 'To This Favour' by William Michael Harnett, c. 1879.JPG|credit-name=William Michael Harnett|credit-license=PD|pic-p=800|pic-x=350|pic-y=100}}</nowiki>
{{Signpost/snippet/sandbox|2023-12-04|Essay|I am going to die|And so are you.|0.3&nbsp;MB|sub=0.3&nbsp;MB|by=[[User:WhatamIdoing|WhatamIdoing]]|pic=File:Memento Mori 'To This Favour' by William Michael Harnett, c. 1879.JPG|credit-name=William Michael Harnett|credit-license=PD|pic-p=800|pic-x=350|pic-y=100}}
:After actually working it out enough to build something that functioned, it turns out there are only three meta attributes needed to fully specify a scale and crop: <code>scale</code>, <code>x</code> and <code>y</code>. All are integers, although I think it might also be useful to permit values like <code>top</code>, <code>bottom</code>, <code>left</code>, <code>right</code> and <code>center</code> (these aren't handled by the template yet but they could be in the future). There are also two more params I didn't think of above, <code>author</code> and <code>license</code>, which are necessary for image attribution. <b style="font-family: monospace; color:#E35BD8">[[User:JPxG|<b style="color:#029D74">jp</b>]]×[[Special:Contributions/JPxG|<b style="color: #029D74">g</b>]][[User talk:JPxG|🗯️]]</b> 03:59, 11 December 2023 (UTC)
 
=== Subheadings ===
Need to be supported by various scripts in order to work properly.
 
*Accepts {{yeac}} processes {{yeac}} Wegweiser
*Accepts {{yeac}} processes {{yeac}} Signpost tagger
*Accepts {{yeac}} processes {{yeac}} Module
I have rewritten Wegweiser to fetch metadata from parsing article wikitext instead of HTML pages; this posed some slight difficulties with respect to user tags in author fields but is now good. It can now work a lot faster, and it also provides subheadline metadata. There's a line I have commented out right now in the script, but can enable to make it store subheading data when it parses metadata. When the subheading data is in the module indices, the module still works fine to retrieve articles etc (of course it can't do anything to ''parse'' or use the subheading yet, but it doesn't break anything). However, the Signpost tagger chokes trying to save tags for articles with subheading data and won't work on them, so I won't do all of the indices with it for now. <b style="font-family: monospace; color:#E35BD8">[[User:JPxG|<b style="color:#029D74">jp</b>]]×[[Special:Contributions/JPxG|<b style="color: #029D74">g</b>]][[User talk:JPxG|🗯️]]</b> 22:06, 15 December 2023 (UTC)
:Now done. <b style="font-family: monospace; color:#E35BD8">[[User:JPxG|<b style="color:#029D74">jp</b>]]×[[Special:Contributions/JPxG|<b style="color: #029D74">g</b>]][[User talk:JPxG|🗯️]]</b> 12:23, 23 December 2023 (UTC)
 
== best practices for image information fields ==
 
So right now I've integrated into Wegweiser and SignpostTagger the fields for piccy information, like this:
<pre> {
date = "2023-12-04",
subpage = "Essay",
title = "I am going to die",
authors = {"WhatamIdoing"},
tags = {"essay"},
views = {d007 = 1526, d015 = 1919, d030 = 2029, d060 = 2029, d090 = 2029, d120 = 2029, d180 = 2029},
piccycredits = "William Michael Harnett",
piccyfilename = "File:Memento Mori 'To This Favour' by William Michael Harnett, c. 1879.JPG",
piccylicense = "PD",
piccyscaling = "400",
piccyxoffset = "70",
piccyyoffset = "",
subhead = "And so are you.",
},
</pre>
496 chars. This seems, uh, stupid. It works but I have temporarily reverted. Since these six fields are all about the same thing, there's no good reason to have them occupy six whole fields -- they should probably just be a dict like the viewcounts are. Like such:
<pre> {
date = "2023-12-04",
subpage = "Essay",
title = "I am going to die",
authors = {"WhatamIdoing"},
tags = {"essay"},
views = {d007 = 1526, d015 = 1919, d030 = 2029, d060 = 2029, d090 = 2029, d120 = 2029, d180 = 2029},
piccy = {filename = "File:Memento Mori 'To This Favour' by William Michael Harnett, c. 1879.JPG", credits = "William Michael Harnett", license = "PD", scaling = "400", xoffset = "70", yoffset = ""}
subhead = "And so are you.",
},</pre>
467. But, upon thinking this thought, something rather devious popped into my mind: aren't these labels kind of long? It seems pretty insubstantial, but... there are a lot of articles. Six letters for each key, across {{Signpost/Number of articles}} (currently 5462) articles (plus 3 extra chars for the <code> = </code> necessitated by using a label at all) is {{#expr: {{Signpost/Number of articles}} * 9}} bytes (currently 49158). For reference, the size of all extant module indices is {{#expr: {{PAGESIZE:Module:Signpost/index/2005|R}} + {{PAGESIZE:Module:Signpost/index/2006|R}} + {{PAGESIZE:Module:Signpost/index/2007|R}} + {{PAGESIZE:Module:Signpost/index/2008|R}} + {{PAGESIZE:Module:Signpost/index/2009|R}} + {{PAGESIZE:Module:Signpost/index/2010|R}} + {{PAGESIZE:Module:Signpost/index/2011|R}} + {{PAGESIZE:Module:Signpost/index/2012|R}} + {{PAGESIZE:Module:Signpost/index/2013|R}} + {{PAGESIZE:Module:Signpost/index/2014|R}} + {{PAGESIZE:Module:Signpost/index/2015|R}} + {{PAGESIZE:Module:Signpost/index/2016|R}} + {{PAGESIZE:Module:Signpost/index/2017|R}} + {{PAGESIZE:Module:Signpost/index/2018|R}} + {{PAGESIZE:Module:Signpost/index/2019|R}} + {{PAGESIZE:Module:Signpost/index/2020|R}} + {{PAGESIZE:Module:Signpost/index/2021|R}} + {{PAGESIZE:Module:Signpost/index/2022|R}} + {{PAGESIZE:Module:Signpost/index/2023|R}} + {{PAGESIZE:Module:Signpost/index/2024|R}} + {{PAGESIZE:Module:Signpost/index/2025|R}}}} (currently 1406253). So that's, uh, {{#expr:4915800/1406253 round 3}}% of the total index size being taken up just by key names. These have to be parsed by, basically, everything, and it's not quite clear that repeating the field names all these thousands of times is more efficient than just having them as an array whose ordering is documented. Perhaps it would be better to do this? {{ping|Mr. Stradivarius}} <b style="font-family: monospace; color:#E35BD8">[[User:JPxG|<b style="color:#029D74">jp</b>]]×[[Special:Contributions/JPxG|<b style="color: #029D74">g</b>]][[User talk:JPxG|🗯️]]</b> 13:51, 23 December 2023 (UTC)