https://bugzilla.wikimedia.org/show_bug.cgi?id=29542

--- Comment #4 from Neil Kandalgaonkar <[email protected]> 2012-01-04 
01:11:08 UTC ---
Copying some design thoughts from email.

-------------

Consider:

   There <b>{{PLURAL:$1|is|are}} $1 lights</b>!

in jQueryMsg, at one point, looks like this.

   [ 
     'There are <b>', 
     [ 'PLURAL', 0, 'is', 'are' ], 
     ' ', 
     [ 'REPLACE', 0 ], 
     ' lights</b>!'
   ]

I did it this way because I like s-expressions & they are very easy to
recursively walk when you have nested stuff. Anyway, the emitter is a fairly
simple algorithm that walks the tree, jquery-ifying as it goes. However, that
ultimately results in this:

   There are <b></b>4 lights!

Because jQuerying the first string closes the </b>, and jQuerying the last one
simply discards the unnecessary </b>. There might be a way to fix this if we
.toString() and concatenate before jQuerying at each level.

Another approach might be for ResourceLoader to use Roan's suggested hack to
preprocessing, and to send an HTML structure to the browser. Like:

   <span>
     There 
     <b>
       <span class="mwplural" param="0">
         <span class="mwform">is</span>
         <span class="mwform">are</span>
       </span>
     <span class="mwparam" param="0"/>
     lights
     </b>
     !
   </span>

That way, it could be "native" jQuery all the way through. I'm suggesting
<span> because I'm afraid of custom HTML tags (e.g. <mwfunc>) not working in
IE, and namespaced HTML (e.g. <mw:func>) doesn't always work either.

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to