W3C home > Mailing lists > Public > public-webplatform@w3.org > July 2014

Code examples escaping Was: MediaWiki escape function

From: Renoir Boulanger <renoir@w3.org>
Date: Thu, 31 Jul 2014 12:43:01 -0400
Message-ID: <53DA7215.4030200@w3.org>
To: Ryan Lane <rlane32@gmail.com>
CC: List WebPlatform public <public-webplatform@w3.org>
(Thread fork, references to [0] are kept)

Hey Ryan,

Do you recall the reason (and know of a solution) for us to require
escaping in our code examples?

Thanks

  [0]: http://docs.webplatform.org/wiki/dom/ValidityState/rangeOverflow

On July 31, 2014 12:21:47 PM EDT, PhistucK <phistuck@gmail.com> wrote:
(...)
>until you investigate further?
>
>☆*PhistucK*
>
>
>On Thu, Jul 31, 2014 at 7:15 PM, Renoir Boulanger <renoir@w3.org>
>wrote:
>> Right.
>>
>> I haven’t seen that warning.
>>
>> Let’s visit why we cannot do that.
>>
>> On 2014-07-31, 12:05 PM, PhistucK wrote:
>> > Are you saying that "Raw example text (no syntaxhighlight):"
>> > means I should add <syntaxHighlight> to the example?
>> > Those parentheses told me the exact opposite. I never added it.
>> >
>> > ☆*PhistucK*
>> >>   
>> >>
>> >> On 2014-07-31, 7:43 AM, Renoir Boulanger wrote:
>> >>> Just to confirm a detail.
>> >>>
>> >>> Did you try freeform code  inside
>> >>>
>> >>> <syntaxHighlight>
>> >>>   var hi = "world";
>> >>> </syntaxHighlight>
>> >>>
>> >>> Its using GeSHI as a MW extension and you can specify
>> >>  language and line numbering. 

Ref. [0]

>> >>>
>> >>> --
>> >>> Renoir
>> >>> ~
>> >>>
>> >>> On July 31, 2014 4:06:09 AM EDT, PhistucK <phistuck@gmail.com>
>wrote:
>> >>>> (I googled it, "mediawiki escape apostrophe")
>> >>>> Either use {{'}}, or (preferred, I believe) &#39;
>> >>>> (twice, for the double one).
>> >>>> I added it to the Gotchas page.
>> >>>>
>> >>>> Thank you for working on this!
>> >>>>
>> >>>> ☆*PhistucK*
>> >>>>
>> >>>>
>> >>>> On Thu, Jul 31, 2014 at 9:10 AM, Rob^_^
><iecustomizer@hotmail.com>
>> >>>> wrote:
>> >>>>
>> >>>>>   Hi et al....
>> >>>>>
>> >>>>> It takes a long time to transpose HTML and java script examples
>into
>> >>>> media
>> >>>>> wiki friendly syntax....
>> >>>>>
>> >>>>>
>> >>>>>
>> >>>>> I have written a small MSIE context menu extension to help in
>the
>> >>>>> process... it uses the following escape function...
>> >>>>>
>> >>>>> function htmlEscape(s) {
>> >>>>>     s = s.replace(/&/g, '&amp;');
>> >>>>>     s = s.replace(/>/g, '&gt;');
>> >>>>>     s = s.replace(/</g, '&lt;');
>> >>>>>     //s = s.replace(/"/g, '&quot;');
>> >>>>>     s = s.replace(/'/g, '\'');
>> >>>>>     s = s.replace(/=/g, '{{=}}');
>> >>>>>     s = s.replace(/\|/g, '{{!}}');
>> >>>>>     return s;
>> >>>>> }
>> >>>>>
>> >>>>>
>> >>>>> with the help of
>> >>>> http://docs.webplatform.org/wiki/WPD:Style_Guide/Gotchas
>> >>>>>
>> >>>>> Q1. How do I escape double-single quotes.... (‘’)... I have
>raised an
>> >>>>> issue ticket for this, but a quick answer would be helpful.
>eg... var
>> >>>>> foo=’’; gets transposed to var foo=;
>> >>>>>
>> >>>>> Q2. Are there any other gotcha’s for escaping html and script?
>> >>>>>
>> >>>>> Once completed I can package an installer for IE, Webkit and
>Gecko
>> >>>> for ppl
>> >>>>> to use....
>> >>>>>
>> >>>>> Greetings from Australia.


Received on Thursday, 31 July 2014 16:43:09 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:21:02 UTC