Re: [NTG-context] HTML to Context with Regular Expressoin

2007-12-17 Thread Mojca Miklavec
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 
\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
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] HTML to Context with Regular Expressoin

2007-12-17 Thread Jan Kraljič
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.

Best regards,

Jan

-- 
Macs are for those who don't want to know why their computer works.
Linux is for those who want to know why their computer works.
DOS is for those who want to know why their computer doesn't work.
Windows is for those who don't want to know why their computer doesn't work.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___