Re: [NTG-context] ePub issues: XML structure
> Am 11.03.2020 um 20:59 schrieb Henning Hraban Ramm : > > Hi Axel, > will I meet you by chance at the DANTE in Lübeck? > > In that case it would be nice if you could assist me with my "ConTeXt for > beginners workshop" to tell something about Lua & XML. > > Greetlings, Hraban Actually your workshop is the reason I plan to attend the meeting. I hope Corona does not interfere. Greetling[1], Axel [1] There are no Tikzgreetlings, as far as I know. ___ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] ePub issues: XML structure
Hi Axel, will I meet you by chance at the DANTE in Lübeck? In that case it would be nice if you could assist me with my "ConTeXt for beginners workshop" to tell something about Lua & XML. Greetlings, Hraban ___ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Install Tikz in LMTX tree
On 3/11/2020 6:35 PM, Jorge Manuel wrote: Thanks to Hans Hagen. \newcount\eTeXversion \eTeXversion = 2000 \newcount\eTeXrevision \eTeXrevision = 0020 In the top of my tex file fixed the problem. fwiw, i've added those dummies to the most recent distribution Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] XML to ConTeXt: converting date attribute from ISO date
On 3/11/2020 4:54 PM, Axel Kielhorn wrote: Hello Hans and mailing list! Thank you so much. With this example and the help I received earlier from Massi, I’ve been able to write my first finalizer today. It is amazing how powerful luatex is. indeed (and luametatex is supposed to be even bit more powerful) My project needs some cleanup and documentation but I hope to put it on GitHub soon. After that I will try to put a minimal version into the wiki. that would be nice. thanks Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Install Tikz in LMTX tree
Thanks to Hans Hagen. \newcount\eTeXversion \eTeXversion = 2000 \newcount\eTeXrevision \eTeXrevision = 0020 In the top of my tex file fixed the problem. Jorge > On 10 Mar 2020, at 14:06, Hans Hagen wrote: > > On 3/10/2020 11:32 AM, Henri Menke wrote: > >> There are still people trying to run TikZ on plain TeX with the Knuth >> engine: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=920368 > > hm, so you can't actually use etex goodies unless you emulate them > >>> \newcount\eTeXversion \eTeXversion = 2000 >>> \newcount\eTeXrevision \eTeXrevision = 0020 >> Hm, I need something that *all* eTeX engines provide that I can check. >> And these seem to have met that requirement. I really don't want to >> write a huge cascade of if-s to test for different engines. > > I'll add dummies then but be aware that you actually should test for the > primitives that you expect because I'm not even sure if luatex bumped the > number. As you mention "all" it means that you expect differences because > "all" implies differences here. What if someone runs a very old > (experimental) etex. > > (\scantokens, \readline, \detokenize, \savingvdiscards are likely to be > untouched .. it depends on what primitives you expect to use) > > > Hans > > > > - > Hans Hagen | PRAGMA ADE > Ridderstraat 27 | 8061 GH Hasselt | The Netherlands > tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : http://contextgarden.net > ___ ___ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] XML to ConTeXt: converting date attribute from ISO date
Hello Hans and mailing list! Thank you so much. With this example and the help I received earlier from Massi, I’ve been able to write my first finalizer today. It is amazing how powerful luatex is. My project needs some cleanup and documentation but I hope to put it on GitHub soon. After that I will try to put a minimal version into the wiki. Greetings Axel ___ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] XML to ConTeXt: converting date attribute from ISO date
> Am 11.03.2020 um 15:19 schrieb Hans Hagen : > > On 3/11/2020 3:12 PM, Axel Kielhorn wrote: >>> Am 11.03.2020 um 15:01 schrieb Hans Hagen : >>> >>> On 3/11/2020 2:14 PM, Axel Kielhorn wrote: Had to change it to: \startluacode function xml.finalizers.tex.MyDate(e,what,how) local ee = e[1].at[what] local t = (string.split(ee,"-")) context.date( { y = t[1], m = t[2], d = t[3] }, { how } ) end \stopluacode >>> You mean the () around the split? weird. Anyway, there's also a time >>> splitter (dedicated to Alan who needed one): >> No, sorry that’s an artifact from testing. >> I had to assign: >> local ee = e[1].at[what] >> and >> string.split(ee,"-") >> in two steps while the original had >> local t = string.split(e[1].at[what],"-") > still strange because it's one value, if it were multiple you could do This is strange. Now it works. Earlier I had context.date complaining that it got a table and not a string. That’s why I took the t = assignment apart into pieces. Now I copied the code from the original reply and it works. Sorry for the noise. Axel ___ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] XML to ConTeXt: converting date attribute from ISO date
On 3/11/2020 2:14 PM, Axel Kielhorn wrote: Am 15.08.2018 um 14:04 schrieb Hans Hagen : On 8/15/2018 12:27 PM, Mike O'Connor wrote: G’Day, Having a first go at converting TEI XML to ConTeXt. Steep learning curve, but easier (for me) than XSLT, and first results were amazing. Using http://www.pragma-ade.com/general/manuals/xml-mkiv.pdf as a guide. Currently stuck on converting an ISO format date (eg. 1908-01-10) into something more readable (eg. 10 January 1908) in the output. I presume I should create a function (?luacode) that can take any ISO value and output the readable form. The following works but seems to me inefficient. Grateful for any pointers. Mike Here is my MWE: \startbuffer[demo] 10.I.08 19 Mar '08 \stopbuffer \startxmlsetups xml:initialize \xmlsetsetup{#1}{date}{xml:date} \stopxmlsetups \xmlregistersetup{xml:initialize} \startxmlsetups xml:date \xmldoifelse {#1}{.[@type='divDate']} { \def\docdate{\ctxlua{ local tyear = string.sub('\xmlatt{#1}{when-iso}',1,4) local tmonth = string.sub('\xmlatt{#1}{when-iso}',6,7) local tday = string.sub('\xmlatt{#1}{when-iso}',9,10) context.date{d = tday, m = tmonth, y = tyear} }} \docdate[day,month,year] = Document Date \par } { \def\docdate{\ctxlua{ local tyear = string.sub('\xmlatt{#1}{when-iso}',1,4) local tmonth = string.sub('\xmlatt{#1}{when-iso}',6,7) local tday = string.sub('\xmlatt{#1}{when-iso}',9,10) context.date{d = tday, m = tmonth, y = tyear} }} \docdate[day,month,year] = Event Date\par } \stopxmlsetups \starttext \xmlprocessbuffer{main}{demo}{} \stoptext Can be wikified ... \startluacode function xml.finalizers.tex.MyDate(e,what,how) local t = string.split(e[1].at[what],"-") context.date( { y = t[1], m = t[2], d = t[3] }, { how } ) end \stopluacode \startxmlsetups xml:date \xmldoifelse {#1}{.[@type='divDate']} { \xmlfilter{#1}{./MyDate("when-iso","day,month,year")}\ Document Date \par } { \xmlfilter{#1}{./MyDate("when-iso","day,month,year")}\ Event Date\par } \stopxmlsetups I couldn’t get this to work. Had to change it to: \startluacode function xml.finalizers.tex.MyDate(e,what,how) local ee = e[1].at[what] local t = (string.split(ee,"-")) context.date( { y = t[1], m = t[2], d = t[3] }, { how } ) end \stopluacode You mean the () around the split? weird. Anyway, there's also a time splitter (dedicated to Alan who needed one): print(os.time(utilities.parsers.totime("2019-03-05 12:12:12"))) print(os.time(utilities.parsers.totime("2019/03/05 12:12:12"))) print(os.time(utilities.parsers.totime("05-03-2019 12:12:12"))) print(os.time(utilities.parsers.totime("05/03/2019 12:12:12"))) inspect(utilities.parsers.totime("2019-03-05 12:12:12")) inspect(utilities.parsers.totime("2019/03/05 12:12:12")) inspect(utilities.parsers.totime("05-03-2019 12:12:12")) inspect(utilities.parsers.totime("05/03/2019 12:12:12")) - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] XML to ConTeXt: converting date attribute from ISO date
> Am 15.08.2018 um 14:04 schrieb Hans Hagen : > > On 8/15/2018 12:27 PM, Mike O'Connor wrote: >> G’Day, >> Having a first go at converting TEI XML to ConTeXt. >> Steep learning curve, but easier (for me) than XSLT, and first results were >> amazing. Using http://www.pragma-ade.com/general/manuals/xml-mkiv.pdf as a >> guide. >> Currently stuck on converting an ISO format date (eg. 1908-01-10) into >> something more readable (eg. 10 January 1908) in the output. I presume I >> should create a function (?luacode) that can take any ISO value and output >> the readable form. The following works but seems to me inefficient. >> Grateful for any pointers. >> Mike >> Here is my MWE: >> \startbuffer[demo] >> >> >> >> >> >> 10.I.08 >> >> >> 19 Mar '08 >> >> >> >> >> >> \stopbuffer >> \startxmlsetups xml:initialize >> \xmlsetsetup{#1}{date}{xml:date} >> \stopxmlsetups >> \xmlregistersetup{xml:initialize} >> \startxmlsetups xml:date >> \xmldoifelse {#1}{.[@type='divDate']} { >> \def\docdate{\ctxlua{ >> local tyear = string.sub('\xmlatt{#1}{when-iso}',1,4) >> local tmonth = string.sub('\xmlatt{#1}{when-iso}',6,7) >> local tday = string.sub('\xmlatt{#1}{when-iso}',9,10) >> context.date{d = tday, m = tmonth, y = tyear} >> }} >> \docdate[day,month,year] = Document Date \par >> } { >> \def\docdate{\ctxlua{ >> local tyear = string.sub('\xmlatt{#1}{when-iso}',1,4) >> local tmonth = string.sub('\xmlatt{#1}{when-iso}',6,7) >> local tday = string.sub('\xmlatt{#1}{when-iso}',9,10) >> context.date{d = tday, m = tmonth, y = tyear} >> }} >> \docdate[day,month,year] = Event Date\par >> } >> \stopxmlsetups >> \starttext >> \xmlprocessbuffer{main}{demo}{} >> \stoptext > Can be wikified ... > > \startluacode >function xml.finalizers.tex.MyDate(e,what,how) >local t = string.split(e[1].at[what],"-") >context.date( >{ y = t[1], m = t[2], d = t[3] }, >{ how } >) >end > \stopluacode > > \startxmlsetups xml:date > > \xmldoifelse {#1}{.[@type='divDate']} { >\xmlfilter{#1}{./MyDate("when-iso","day,month,year")}\ > Document Date \par >} { >\xmlfilter{#1}{./MyDate("when-iso","day,month,year")}\ >Event Date\par > > } > \stopxmlsetups I couldn’t get this to work. Had to change it to: \startluacode function xml.finalizers.tex.MyDate(e,what,how) local ee = e[1].at[what] local t = (string.split(ee,"-")) context.date( { y = t[1], m = t[2], d = t[3] }, { how } ) end \stopluacode mtx-context | ConTeXt Process Management 1.03 mtx-context | mtx-context | main context file: /Volumes/Macintosh HD/usr/local/texlive/context-109/tex/texmf-context/tex/context/base/mkiv/context.mkiv mtx-context | current version: 2020.01.30 14:13 mtx-context | main context file: /Volumes/Macintosh HD/usr/local/texlive/context-109/tex/texmf-context/tex/context/base/mkiv/context.mkxl mtx-context | current version: 2020.01.30 14:13 Greetings Axel ___ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Need help processing XML in luacode
Hello Massi, thanks for you help. > Am 10.03.2020 um 20:53 schrieb mf : > > In your tex file, try this: > > \startluacode > settings = {} > docstruktur = {} > doclistfile = "doclist.xml" > > local striplines = utilities.strings.striplines > > cropstring = function(s) > -- return striplines(s, "prune and collapse") > return striplines(s) > end Well, with this definition I can actually inline that. > local xmltext= xml.text > > doc = xml.load(doclistfile, settings) > > for v in xml.collected(doc,"/doclist/psdoc/") do > -- print (v) > -- print (xml.text(v,"/docnr")) > local docnr = cropstring(xml.text(v,"/docnr")) > print (docnr) > local docname = cropstring(xmltext(v,"/docname")) > -- es kann mehrere DOCAN geben! > local docan = (cropstring(xmltext(v,"/docan"))) > local docverantwortlich = (cropstring(xmltext(v,"/docverantwortlich"))) > docstruktur[docnr]={ >docname = docname, >docan = docan, >docverantwortlich = docverantwortlich > } Great, that is even shorter. > end > \stopluacode I’m cleaning up my backend code to make it more Lua like. Greetings Axel ___ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Only-black emojis in LMTX
On 3/10/2020 11:35 PM, Alejo Barrio Blaya wrote: I'm trying to get emojis working. The examples that do, are only printing plain black emojis. Not colors, nor greyscales. I'm using the latest beta of LMTX. It seems that you get the default outline characters. What font do you use? How do you define it? You need something \definefont[YourFont][somefontname*default,color at 15pt] or define a featureset that sets 'color=yes' (or some specific rendering using the other keys for color fonts). Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___