Johannes Graumann wrote:
> I keep gnawing on this now ...
> 
> Added the following (see attachment):
> 
> \xmlval{fo:color}{\xmlatt{#1}{color}}{}
> 
> and
> 
> \xmlmapvalue{fo:color}{#ff0000}{\color[red]}
> 
> Which works just fine (given you use "\setupcolors[state=start]" as well), 
> but is there a way to generically paste the "ff0000" bit into the place of 
> "red"? I played around with "system=rgb", but context won't take "ff0000" as 
> a parameter ...
> 
> Another question: underlining in ConTeXt (as far as I can discern) needs a 
> "\startunderline"/"\stopunderline" pair, no? Accordingly the combination of
> 
> \xmlval{style:text-underline-style}{\xmlatt{#1}{text-underline-style}}{}
> 
> and
> 
> \xmlmapvalue{style:text-underline-style}{solid}{?}
> 
> doesn't work ... what's the proper construct to have xmlflush flanked by 
> underline statements?
> 
> And even more ... how to match
> 
> <style:text-properties style:text-position="sub 58%"/>
> 
> generically, such that "sub*" (which doesn't work) might be used in a 
> combination of
> 
> \xmlval{style:text-position}{\xmlatt{#1}{text-position}}{}
> 
> and
> 
> \xmlmapvalue{style:text-position}{sub*}{\subscript}
> 
> and any percentage following "sub" will be matched? Essentially I'm asking 
> here how to use the regex "sub.*" in xmlmapvalue ...
> 
> Thanks for your time - the learning curve is steep. Where can one look up 
> stuff like this?
\starttext

\startluacode
     document.commands = document.commands or { }
     function document.commands.somehexcolor(str)
         local r, g, b = str:match("#(..)(..)(..)")
         r, g, b = tonumber(r,16) or 0, tonumber(g,16) or 0, 
tonumber(b,16) or 0
 
tex.sprint(string.format("\\colored[r=%s,g=%s,b=%s]",r/255,g/255,b/255))
     end
\stopluacode

\setupcolors[state=start]

\def\WhatAMess#1{\ctxlua{document.commands.somehexcolor("#1")}}

{test \WhatAMess{\letterhash FF3344} test}

\stoptext


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________

Reply via email to