ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* HTML to Context with Regular Expressoin
@ 2007-12-17  9:58 Jan Kraljič
  2007-12-17 12:15 ` Mojca Miklavec
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Kraljič @ 2007-12-17  9:58 UTC (permalink / raw)
  To: ConTeXt


[-- Attachment #1.1: Type: text/plain, Size: 897 bytes --]

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.

[-- Attachment #1.2: Type: text/html, Size: 990 bytes --]

[-- Attachment #2: Type: text/plain, Size: 487 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: HTML to Context with Regular Expressoin
  2007-12-17  9:58 HTML to Context with Regular Expressoin Jan Kraljič
@ 2007-12-17 12:15 ` Mojca Miklavec
  0 siblings, 0 replies; 2+ messages in thread
From: Mojca Miklavec @ 2007-12-17 12:15 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-12-17 12:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-17  9:58 HTML to Context with Regular Expressoin Jan Kraljič
2007-12-17 12:15 ` Mojca Miklavec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).