User:Sanbeg/willow

VP
Hey Steve, I wish that I'd read your message before fixing those mistakes! :P Oh well, it wasn't so bad; the changes I made were pretty minor and didn't take too much time. The new versions of the PHP and internationalization files are still here and here. I was still concerned about developers getting confused between, e.g., noteKey and notesKey, so I left the Footnotes in the code itself. Thus, the general scheme was to map Cite to Footnote, Ref to Note, and Refs/References to Footnotes. However, I made the user command (instead of ) by changing the parserhook

$wgParser->setHook( 'notes', array( &$this, 'footnotes' ) );

thus, invokes the callback function "footnotes" defined earlier in the Footnotes.php file. To change the labels to letters in the references themselves, I changed "++$this->mOutCnt" in the function linkNote (formerly linkRef) into the full-blown

$this->footnotesFormatEntryAlternateBacklinkLabel( ++$this->mOutCnt )

taking advantage of that nifty array; the only drawback is that, given its present definition, we could only have ~26 different explanatory footnotes. If we were going to use this code, I'd lengthen it using double letters such as "aa", "ab", ... giving us 26*26=676 new possibilities. To do the converse in the section, i.e., to use pure integers (instead of letters) to link multiple references to the same footnote, I changed the function footnotesFormatEntryNumericBacklinkLabel (formerly referencesFormatEntryNumericBacklinkLabel) to use "$ret = $wgContLang->formatNum( $offset );" and kept the'cite_references_link_many_format' as its default in Cite.i18n.php. Perhaps these solutions might be helpful in your own adaptations?

It was fun learning about how Wikipedia actually works and learning a little PHP at the same time. :) It doesn't seem so scary now, which it did only yesterday.  I've no regrets about working on it and my only worry now is that we get your new system adopted as quickly as possible.  I know that the humanities editors are super-eager to start on their next project, and I wouldn't want their enthusiasm thwarted by a long delay! :) Willow (talk) 18:17, 20 March 2008 (UTC)

UT

 * Hi Steve and welcome to my Talk page! :)


 * I think you're right; at least I get the impression that the different numbering (alphabetical and numerical for footnotes and references, respectively) would be helpful for the reader to discern them. My suggestion would be to implement something in &lt;ref&gt; like &lt;ol&gt; does, with optional type and start parameters for each group; the types may be numerical (type=1, default), lower-case (type=a), upper-case (type=A), lower-case Roman (type=i) and upper-case Roman (type=I).  To set that would be relatively easy in &lt;references group=notes /&gt; because you could extend 'cite_references_prefix' => '&lt;ol class="references"&gt;' in the internationalization file into 'cite_references_prefix' => '&lt;ol class="references" type="$1"&gt;', couldn't you?  Then we could implement a footnote with &lt;ref group=notes type=a&gt; , which could be aliased into   , maybe using a parserhook?


 * It seems like greater difficulties come in formatting the reference in the main text and also in deciding on a format for many links to the same reference? For the former, I would suggest generalizing the ++$this->mOutCnt in line 508 of Cite.php into some function $this->refCounterString(++$this->mOutCnt, $type), which would return the value of one of the five basic types, you know, return "4/d/D/iv/IV" for input "4" depending on the type?  Maybe such a function exists already? I know hardly anything about PHP (just what I picked up from Cite.php) and I couldn't even find where wgContLang was defined. :(  For the latter problem, the present solution with cite_references_link_many_format_backlink_labels seems rather kludgy, don't you think?  I think it'd be better to define some generic function that could be internationalized, but which might provide an built-in complementary counter for a given type, e.g., $this->referencesComplementaryCounterForMultipleLinks( $val['number'], $i, $val['count'], $type ) in line 387 of Cite.php.  Or you could re-use the counter function refCounterString above but introduce a second type ( $multireference_type ) for multiple links to a single reference; that might be more elegant.


 * I hope you don't mind me thinking about these problems? I don't want to get in your way, or be a bother to you.  I'm pretty self-conscious about being a newbie, but it's fun for me to learn about this stuff, and it would be really helpful for my friends if we could get a solution working quickly.  Thank you very much for all your work and good ideas! :) Willow (talk) 19:02, 21 March 2008 (UTC)