- From: Amelia Bellamy-Royds <amelia.bellamy.royds@gmail.com>
- Date: Thu, 31 Jul 2014 10:39:32 -0600
- To: PhistucK <phistuck@gmail.com>
- Cc: Renoir Boulanger <renoir@w3.org>, "Rob^_^" <iecustomizer@hotmail.com>, Eliezer Bernart <eliezer.bernart@gmail.com>, List WebPlatform public <public-webplatform@w3.org>
- Message-ID: <CAFDDJ7xOjc259icst2YZy7eyGK0=38iqhzE8W+mra+AqWaF0kQ@mail.gmail.com>
*You do not need to use any extra tags or HTML entities in example code*. The code is automatically included in Mediawiki <pre> blocks, which handles this for you. (see Template:Single Example <http://docs.webplatform.org/w/index.php?title=Template:Single_Example&action=edit> which inserts the preformatting tags, and Mediawiki's Help:Formatting <http://www.mediawiki.org/wiki/Help:Formatting> page) Clearly, the instructions on the form need to be more clear. My suggestion: Raw example code (code will be escaped and syntax highlighting added automatically) I think the template is protected; I can make the change. Be aware that the mark-up tags won't display properly in preview mode. This is a separate, Mediawiki bug, and happens regardless of whether or not you escape the angle brackets yourself. Sorry for the unnecessary extra work Rob! Good approach, though, to come up with a re-usable function to share with others. AmeliaBR On 31 July 2014 10:21, PhistucK <phistuck@gmail.com> wrote: > It is in the form when you edit articles with the Examples template, if > you have not seen it. > Should I change the text for now, or keep it intact until you investigate > further? > > > > ☆*PhistucK* > > > On Thu, Jul 31, 2014 at 7:15 PM, Renoir Boulanger <renoir@w3.org> wrote: > >> Oh, >> >> 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 Thu, Jul 31, 2014 at 7:02 PM, Renoir Boulanger <renoir@w3.org> >> wrote: >> > >> >> Hi all, >> >> >> >> (Adding Eliezer, our SMW expert) >> >> >> >> I just made some tests on [0]. I wonder why it hasn’t been told yet, >> but >> >> it works! /o/ >> >> >> >> Look at the source at, it shows a valid code sample and we didn’t need >> >> to write escaped code. >> >> >> >> In short, this works :) >> >> >> >> <syntaxHighlight lang="html5"> >> >> <some>HTML</some> >> >> <script> >> >> var hi = "world"; >> >> </script> >> >> </syntaxHighlight> >> >> >> >> Maybe we should update the Gotchas, and make sure the SemanticMediaWiki >> >> form at the code samples actually use that extension directly, instead >> >> of us writing the syntaxHighlight tag every time. >> >> >> >> Opinion? >> >> >> >> [0]: >> http://docs.webplatform.org/wiki/dom/ValidityState/rangeOverflow >> >> >> >> 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. >> >>> >> >>> -- >> >>> Renoir Boulanger | Developer operations engineer >> >>> W3C | webplatform.org >> >>> >> >>> http://w3.org/people/#renoirb ✪ https://renoirboulanger.com ✪ >> >> @renoirb >> >>> ~ >> >>> >> >>> 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) ' (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, '&'); >> >>>>> s = s.replace(/>/g, '>'); >> >>>>> s = s.replace(/</g, '<'); >> >>>>> //s = s.replace(/"/g, '"'); >> >>>>> 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. >> >>>>> >> >>>>> >> >>> >> >> >> >> -- >> >> Regards, >> >> >> >> Renoir Boulanger | Developer operations engineer >> >> W3C | Web Platform Project >> >> >> >> http://w3.org/people/#renoirb ✪ https://renoirboulanger.com/ ✪ >> >> @renoirb >> >> ~ >> >> >> >> >> > >> >> -- >> Regards, >> >> Renoir Boulanger | Developer operations engineer >> W3C | Web Platform Project >> >> http://w3.org/people/#renoirb ✪ https://renoirboulanger.com/ ✪ >> @renoirb >> ~ >> >> >
Received on Thursday, 31 July 2014 16:40:04 UTC