On Dec 17, 2007 10:58 AM, Jan Kraljič wrote:
Hello,
I'm trying to create WYSWYG editor for Context. I started with FCKeditor which is great HTML WYSWYG. My idea was to use html code generated by FCKeditor than to use regular expression so ContexT. Thats giving me headache.
In contextgarden I found some solution for changing HTM to ConTeXt but i didn't find any that would use regular expression. Now i wonder if there is any list of expressions for replacing HTML with ConTeXt or should I start somewhere on contextgarden and hope for help to complete. I believe that such replacement table can help few to thinking about using ConTeXt.
Hello Jan, Here are some portions of code for LuaTeX. (Untested, only copy-posted from one of my documents, so I probably forgot to include some portions.) But just to get you started with the idea. You don't need any regular expressions. You can anly compile it with "texexec --lua filename.tex". Mojca \startxmlsetups all:html \xmlsetsetup{main}{head|h1|h2|p|span|sub|table|b|tt|ul|li|div|img}{*} %\xmlsetfunction{main}{pre}{lxml.displayverbatim} %\xmlsetfunction{main}{verb} {lxml.inlineverbatim} \stopxmlsetups % register this so that it's done for each load \xmlregistersetup{all:html} \startxmlsetups h1 \subject{\ignorespaces\xmlflush{#1}} \stopxmlsetups \startxmlsetups p \xmlflush{#1}\par \stopxmlsetups \startxmlsetups tt \bgroup\tt\xmlflush{#1}\egroup \stopxmlsetups % should be only defined for class=simplemath \startxmlsetups span \doifelse{\xmlatt{#1}{class}}{math} {\mathematics{\xmlflush{#1}}} % otherwise simply ignore {\xmlflush{#1}} \stopxmlsetups \startxmlsetups sub \mathematics{\suber{\xmlflush{#1}}} \stopxmlsetups % bold - OK, unless when nested with <i> \startxmlsetups b {\bf\xmlflush{#1}} \stopxmlsetups \startxmlsetups ul \startitemize \xmlflush{#1} \stopitemize \stopxmlsetups \startxmlsetups li \startitem \xmlflush{#1} \stopitem \stopxmlsetups \starttext \xmlprocess{main}{x.xml}{} \stoptext