On 2017-04-10 06:17, Denny Vrandečić wrote:
On Sat, Apr 8, 2017 at 11:30 PM James Hare jamesmhare@gmail.com wrote:
Why, exactly, do you want a wikitext intermediary between your JSON and your HTML? The value of wikitext is that it’s a syntax that is easier to edit than HTML. But if it’s not the native format of your data, nor can browsers render it directly, what’s the point of having it?
Ah, good question indeed. The reason is that users would be actually putting fragments of wikitext into the JSON structure, and then the JSON structure gets assembled into wikitext. Not only would I prefer to have the users work with fragments of wikitext than fragments of HTML, but some things are almost impossible with HTML - e.g. making internal links red or blue depending on the existence of the article, etc.
It would be more reliable to parse each fragment of wikitext separately, and then build the HTML out of them. If you try to make a big chunk of wikitext with user-supplied fragments, you'll soon run into two problems:
* Users will accidentally put '<nowiki>' or something into one of the fields and completely mess up the rendering. * Users will intentionally put '[[Foo|' in one field and ']]' into another and then be mad at you when you change the structure in a minor way and their link no longer works.