[NTG-context] Re: usage of conversion in \date
On Wed, Nov 29 2023, Peter Münster wrote: > According to https://wiki.contextgarden.net/Command/date: > "The name suffixes indicate number conversions. Any conversion, either > built-in or defined by \defineconversion, can be used there." > > But it does not seem to work... Hi, Should I add this to the bug-tracker? If yes, where please? It seems, that tracker.luatex.org is no more used. TIA, -- Peter ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___
[NTG-context] Re: Support Chinese Date Conversion
Hi Hans, That works for me, I patch the core-con.lua with your implementation, update the local cache by running `mtxrun --script cache --make`, context my document and get the same "as-is" result as before, I think that would be a valuable idea to have an extra as-is function for potential number conversions. And I just realize, for Chinese date, only year section follows the as-is pattern, for month or day, December should be represented as 十二月 instead of 一二, twenty-sixth is 二十六日 instead of 二六, we might need to consider to narrow down the name to be year could be more precise and meaningful. Cheers, Yihan On Wed, Nov 29, 2023 at 5:24 PM Hans Hagen wrote: > On 11/29/2023 7:56 AM, Yihan Song wrote: > > Dears, > > > > I am opening a PR <https://github.com/contextgarden/context/pull/1> to > > improve the Chinese date conversion but it seems that repo is just a > > mirror site without development activities, can someone help to review > > this one? > > sending patched files is faster (i need to check and diff anyway) > > can you test with this: > > if name == "date" then > -- We could do some number juggling instead but this is fast > enough. There is > -- no error checking here so we assume a proper year. Maybe a > better name is > -- asis (so that it can be used for more than dates). > local vector = vector.normal > for s in gmatch(tostring(n),".") do > r = r + 1 ; result[r] = vector[tonumber(s)] > end > return concat(result) > end > > (btw, we also need to adapt the lmt file ... once mkiv is frozen we only > add to lmtx) > > 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 / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___
[NTG-context] Re: usage of conversion in \date
On Wed, Nov 29 2023, Hans Hagen wrote: > \setuplanguage[fr][date={day:++,\ ,month,\ ,year}] Unfortunately this does not work as I need. Only the "1" should be converted to 1er, not the other numbers. French is a bit special: You say "le premier novembre" but not "le un novembre". You say "le deux novembre" but not "le deuxième novembre". According to https://wiki.contextgarden.net/Command/date: "The name suffixes indicate number conversions. Any conversion, either built-in or defined by \defineconversion, can be used there." But it does not seem to work... -- Peter ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___
[NTG-context] Re: Support Chinese Date Conversion
On 11/29/2023 7:56 AM, Yihan Song wrote: Dears, I am opening a PR <https://github.com/contextgarden/context/pull/1> to improve the Chinese date conversion but it seems that repo is just a mirror site without development activities, can someone help to review this one? sending patched files is faster (i need to check and diff anyway) can you test with this: if name == "date" then -- We could do some number juggling instead but this is fast enough. There is -- no error checking here so we assume a proper year. Maybe a better name is -- asis (so that it can be used for more than dates). local vector = vector.normal for s in gmatch(tostring(n),".") do r = r + 1 ; result[r] = vector[tonumber(s)] end return concat(result) end (btw, we also need to adapt the lmt file ... once mkiv is frozen we only add to lmtx) 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 / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___
[NTG-context] Re: usage of conversion in \date
On 11/28/2023 6:09 PM, Peter Münster wrote: Hi, When printing a date in French, I would like to convert the "1" to "1\ier", but it does not work as I expect: --8<---cut here---start->8--- \startluacode -- from https://wiki.contextgarden.net/Command/defineconversion: interfaces.implement { name = "FRdate", public= true, arguments = "string", actions = function(s) local n = tonumber(s) if n == 1 then context"1\\ier" else context(s) end end } \stopluacode \def\ier{\highordinalstr{er}} \mainlanguage[fr] \defineconversion[frd][\FRdate] \setuplanguage[fr][date={day:frd,\ ,month,\ ,year}] \starttext Conversion: \convertnumber{frd}{1}, \convertnumber{frd}{2} (OK)\\ Dates: \date[d=1], \date[d=2] (not OK) \stoptext --8<---cut here---end--->8--- How could I get "1\ier\ novembre 2023" please? \mainlanguage[fr] \setuplanguage[fr][date={day:++,\ ,month,\ ,year}] \starttext Dates: \date[d=1], \date[d=2] (not OK) \stoptext - 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 / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___
[NTG-context] Support Chinese Date Conversion
Dears, I am opening a PR <https://github.com/contextgarden/context/pull/1> to improve the Chinese date conversion but it seems that repo is just a mirror site without development activities, can someone help to review this one? Thanks in advance. Cheers, Yihan ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___
[NTG-context] usage of conversion in \date
Hi, When printing a date in French, I would like to convert the "1" to "1\ier", but it does not work as I expect: --8<---cut here---start->8--- \startluacode -- from https://wiki.contextgarden.net/Command/defineconversion: interfaces.implement { name = "FRdate", public= true, arguments = "string", actions = function(s) local n = tonumber(s) if n == 1 then context"1\\ier" else context(s) end end } \stopluacode \def\ier{\highordinalstr{er}} \mainlanguage[fr] \defineconversion[frd][\FRdate] \setuplanguage[fr][date={day:frd,\ ,month,\ ,year}] \starttext Conversion: \convertnumber{frd}{1}, \convertnumber{frd}{2} (OK)\\ Dates: \date[d=1], \date[d=2] (not OK) \stoptext --8<---cut here---end--->8--- How could I get "1\ier\ novembre 2023" please? TIA for any help, -- Peter ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___
Re: [NTG-context] save the date: TUG 2023 14–16th of July in Bonn, Germany!
Am 21.12.22 um 10:33 schrieb Pablo Rodriguez via ntg-context: On 12/19/22 20:59, Henning Hraban Ramm via ntg-context wrote: Not much more to say, it’s still only announced somewhat inofficially... Many thanks for the announcement, Hraban. I’ve just found https://tug.org/tug2023/. Thank you! The German organizers told me there was no announcement by TUG yet (maybe there wasn’t when I posted). Hraban ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___
Re: [NTG-context] save the date: TUG 2023 14–16th of July in Bonn, Germany!
On 12/19/22 20:59, Henning Hraban Ramm via ntg-context wrote: > Not much more to say, it’s still only announced somewhat inofficially... Many thanks for the announcement, Hraban. I’ve just found https://tug.org/tug2023/. Just in case it might help, Pablo ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___
[NTG-context] save the date: TUG 2023 14–16th of July in Bonn, Germany!
Not much more to say, it’s still only announced somewhat inofficially... Hoping to meet you there, Hraban ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___
Re: [NTG-context] Failure to compile with new date code
On 10/25/2021 10:31 PM, Rik Kabel wrote: This has been part of my setup interaction for a couple of years. Documents all pass verapdf pdf3a testing. On Oct 25, 2021 15:54, Hans Hagen via ntg-context wrote: On 10/25/2021 7:54 PM, Pablo Rodriguez via ntg-context wrote: > On 10/25/21 4:45 PM, Rik Kabel via ntg-context wrote: >> Hello all, >> >> The example below continues to work with MkIV, but now fails with the >> most recent (ConTeXt ver: 2021.10.24 21:45) LMTX: >> >> \define\DraftOf {Draft of \date} >> \setupinteraction [date={\DraftOf}] > > Hi Rik, > > \setupinteraction[date=***] only accepts a date as input. > > Would it be possible that it was subtitle or title any of the options > you used? we can of course accept anything but because these dates end up in different spots it gets hairy ... also it can invalidate a pdf next upload: system > invalid time specification 'Draft of October 25, 2021' - 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] Failure to compile with new date code
On 10/25/2021 10:31 PM, Rik Kabel wrote: This has been part of my setup interaction for a couple of years. Documents all pass verapdf pdf3a testing. the date only ended up in some places but now we try to be consistent on all places On Oct 25, 2021 15:54, Hans Hagen via ntg-context wrote: On 10/25/2021 7:54 PM, Pablo Rodriguez via ntg-context wrote: > On 10/25/21 4:45 PM, Rik Kabel via ntg-context wrote: >> Hello all, >> >> The example below continues to work with MkIV, but now fails with the >> most recent (ConTeXt ver: 2021.10.24 21:45) LMTX: >> >> \define\DraftOf {Draft of \date} >> \setupinteraction [date={\DraftOf}] > > Hi Rik, > > \setupinteraction[date=***] only accepts a date as input. > > Would it be possible that it was subtitle or title any of the options > you used? we can of course accept anything but because these dates end up in different spots it gets hairy ... also it can invalidate a pdf 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 ___ -- - 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] Failure to compile with new date code
This has been part of my setup interaction for a couple of years. Documents all pass verapdf pdf3a testing.On Oct 25, 2021 15:54, Hans Hagen via ntg-context wrote:On 10/25/2021 7:54 PM, Pablo Rodriguez via ntg-context wrote: > On 10/25/21 4:45 PM, Rik Kabel via ntg-context wrote: >> Hello all, >> >> The example below continues to work with MkIV, but now fails with the >> most recent (ConTeXt ver: 2021.10.24 21:45) LMTX: >> >> \define\DraftOf {Draft of \date} >> \setupinteraction [date={\DraftOf}] > > Hi Rik, > > \setupinteraction[date=***] only accepts a date as input. > > Would it be possible that it was subtitle or title any of the options > you used? we can of course accept anything but because these dates end up in different spots it gets hairy ... also it can invalidate a pdf 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] Failure to compile with new date code
On 10/25/2021 7:54 PM, Pablo Rodriguez via ntg-context wrote: On 10/25/21 4:45 PM, Rik Kabel via ntg-context wrote: Hello all, The example below continues to work with MkIV, but now fails with the most recent (ConTeXt ver: 2021.10.24 21:45) LMTX: \define\DraftOf {Draft of \date} \setupinteraction [date={\DraftOf}] Hi Rik, \setupinteraction[date=***] only accepts a date as input. Would it be possible that it was subtitle or title any of the options you used? we can of course accept anything but because these dates end up in different spots it gets hairy ... also it can invalidate a pdf 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] Failure to compile with new date code
On 10/25/21 4:45 PM, Rik Kabel via ntg-context wrote: > Hello all, > > The example below continues to work with MkIV, but now fails with the > most recent (ConTeXt ver: 2021.10.24 21:45) LMTX: > > \define\DraftOf {Draft of \date} > \setupinteraction [date={\DraftOf}] Hi Rik, \setupinteraction[date=***] only accepts a date as input. Would it be possible that it was subtitle or title any of the options you used? Just in case it helps, Pablo -- http://www.ousia.tk ___ 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] Failure to compile with new date code
Rik Kabel via ntg-context schrieb am 25.10.2021 um 16:45: Hello all, The example below continues to work with MkIV, but now fails with the most recent (ConTeXt ver: 2021.10.24 21:45) LMTX: \define\DraftOf {Draft of \date} \setupinteraction [date={\DraftOf}] \starttext Fail with LMTX, works with MkIV. \stoptext If the answer is "don't do that" I can find another way to accomplish what this does -- not a big problem. But I do want to point out the difference in behavior. The date-key expects its argument in a certain format but you pass garbage values. See the following thread for more information: https://mailman.ntg.nl/pipermail/ntg-context/2021/103884.html Wolfgang ___ 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 ___
[NTG-context] Failure to compile with new date code
Hello all, The example below continues to work with MkIV, but now fails with the most recent (ConTeXt ver: 2021.10.24 21:45) LMTX: \define\DraftOf {Draft of \date} \setupinteraction [date={\DraftOf}] \starttext Fail with LMTX, works with MkIV. \stoptext If the answer is "don't do that" I can find another way to accomplish what this does -- not a big problem. But I do want to point out the difference in behavior. -- Rik ___ 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] setting date in \setupinteraction
On 10/20/21 4:02 PM, Hans Hagen via ntg-context wrote: > On 10/19/2021 10:38 PM, Michal Vlasák via ntg-context wrote: >> [...] >> The pattern doesn't catch all the PDF spec cases, but should match what >> ConTeXt emits. The timezone info gets overwritten by current timezone >> though. >> >> Requires the below patch. >[...] > i'll fix it but also clean up the existing code a bit > > (much has to do with omitting date and is for comparison reasons) Many thanks for the fix. It would be great that current timezone doesn’t overwrite the specified one. Pablo -- http://www.ousia.tk ___ 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] setting date in \setupinteraction
On 10/19/2021 10:38 PM, Michal Vlasák via ntg-context wrote: I don't know how official these interfaces are. But you can try adapting the following to your use case. \setupinteraction[state=start] %\luacode{lpdf.settime("2020-02-02 12:00")} %\luacode{lpdf.settime(1580641221)} \startluacode local Y, M, D, h, m, s, Zs, Zh, Zm = string.match("D:20200202120021+02'00'", "^D:(%d%d%d%d)(%d%d)(%d%d)(%d%d)(%d%d)(%d%d)([%+%-])(%d%d)%'(%d%d)%'$") local time = os.time{year=Y,month=M,day=D,hour=h,min=m,sec=s} lpdf.settime(time) \stopluacode \starttext This document is from 02.02.2020 at 12:00:21. \stoptext The pattern doesn't catch all the PDF spec cases, but should match what ConTeXt emits. The timezone info gets overwritten by current timezone though. Requires the below patch. Michal --- a/tex/context/base/mkiv/core-con.lua +++ b/tex/context/base/mkiv/core-con.lua @@ -1991,7 +1991,7 @@ function converters.totime(s) end local n = tonumber(s) if n and n >= 0 then -return date("*t",n) +return osdate("*t",n) end end diff --git a/tex/context/base/mkxl/lpdf-ini.lmt b/tex/context/base/mkxl/lpdf-ini.lmt index 7979b80..9703ac0 100644 --- a/tex/context/base/mkxl/lpdf-ini.lmt +++ b/tex/context/base/mkxl/lpdf-ini.lmt @@ -1123,7 +1123,7 @@ do n = converters.totime(n) if n then converters.settime(n) -timestamp = osdate("%Y-%m-%dT%X") .. ostimezone(true) -- probably not ok +timestamp = osdate("%Y-%m-%dT%X", ostime(n)) .. ostimezone(true) -- probably not ok end end if metadata then i'll fix it but also clean up the existing code a bit (much has to do with omitting date and is for comparison reasons) 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] setting date in \setupinteraction
On Tue Oct 19, 2021 at 8:51 PM CEST, Pablo Rodriguez via ntg-context wrote: > On 10/19/21 6:23 PM, Michal Vlasák via ntg-context wrote: > > On Tue Oct 19, 2021 at 5:47 PM CEST, Pablo Rodriguez via ntg-context wrote: > > [...] > > So this works: > > > > > > \setupinteraction[state=start, > > date={2022-02-02T12:00:21+02:00}] > > \starttext > > This document is from 02.02.2020 at 12:00:21. > > \stoptext > > > > This parameter sets the "ModDate" is that what you are after? > > Hi Michal, > > many thanks for your fast reply. > > I would like to import both metadata values (CreationDate and ModDate) > from another file (such as https://pdf.ousia.tk/metadata.pdf). > > Besides from the fact that LMTX doesn’t work with this (only MkIV does > [already reported]), isn’t no simpler way to get ISO 8601 formatting > from doc.Info.ModDate than the following one? > > \starttext > \startluacode > function document.transfer_metadata(name) > local main_doc = lpdf.epdf.load(name) > context.setupinteraction{ title = main_doc.Info.Title } > context.setupinteraction{ date = main_doc.Info.ModDate:sub(3,6) .. > "-" .. main_doc.Info.ModDate:sub(7,8) .. "-" .. > main_doc.Info.ModDate:sub(9,10) .. "T" .. > main_doc.Info.ModDate:sub(11,12) .. ":" .. > main_doc.Info.ModDate:sub(13,14) .. ":" .. > main_doc.Info.ModDate:sub(15,22):gsub("'", ":") } > context(main_doc.Info.Title .. "\\par") > lpdf.epdf.unload(name) > end > \stopluacode > \unexpanded\def\TransferMetadata#1% > {\ctxlua{document.transfer_metadata("#1")}} > \startTEXpage[offset=1em, align=center] > \TransferMetadata{metadata.pdf} > \stopTEXpage > \stoptext > > > Seems that "CreationDate" could be set by the SOURCE_DATE_EPOCH > > environment variable, but I am not succesfull with it right now. > > It would be fine to ble able to set CreationDate. Otherwise, having a > ModDate prior to CreationDate gives a weird impression. I don't know how official these interfaces are. But you can try adapting the following to your use case. \setupinteraction[state=start] %\luacode{lpdf.settime("2020-02-02 12:00")} %\luacode{lpdf.settime(1580641221)} \startluacode local Y, M, D, h, m, s, Zs, Zh, Zm = string.match("D:20200202120021+02'00'", "^D:(%d%d%d%d)(%d%d)(%d%d)(%d%d)(%d%d)(%d%d)([%+%-])(%d%d)%'(%d%d)%'$") local time = os.time{year=Y,month=M,day=D,hour=h,min=m,sec=s} lpdf.settime(time) \stopluacode \starttext This document is from 02.02.2020 at 12:00:21. \stoptext The pattern doesn't catch all the PDF spec cases, but should match what ConTeXt emits. The timezone info gets overwritten by current timezone though. Requires the below patch. Michal --- a/tex/context/base/mkiv/core-con.lua +++ b/tex/context/base/mkiv/core-con.lua @@ -1991,7 +1991,7 @@ function converters.totime(s) end local n = tonumber(s) if n and n >= 0 then -return date("*t",n) +return osdate("*t",n) end end diff --git a/tex/context/base/mkxl/lpdf-ini.lmt b/tex/context/base/mkxl/lpdf-ini.lmt index 7979b80..9703ac0 100644 --- a/tex/context/base/mkxl/lpdf-ini.lmt +++ b/tex/context/base/mkxl/lpdf-ini.lmt @@ -1123,7 +1123,7 @@ do n = converters.totime(n) if n then converters.settime(n) -timestamp = osdate("%Y-%m-%dT%X") .. ostimezone(true) -- probably not ok +timestamp = osdate("%Y-%m-%dT%X", ostime(n)) .. ostimezone(true) -- probably not ok end end if metadata then ___ 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] setting date in \setupinteraction
On 10/19/21 6:23 PM, Michal Vlasák via ntg-context wrote: > On Tue Oct 19, 2021 at 5:47 PM CEST, Pablo Rodriguez via ntg-context wrote: > [...] > So this works: > > > \setupinteraction[state=start, > date={2022-02-02T12:00:21+02:00}] > \starttext > This document is from 02.02.2020 at 12:00:21. > \stoptext > > This parameter sets the "ModDate" is that what you are after? Hi Michal, many thanks for your fast reply. I would like to import both metadata values (CreationDate and ModDate) from another file (such as https://pdf.ousia.tk/metadata.pdf). Besides from the fact that LMTX doesn’t work with this (only MkIV does [already reported]), isn’t no simpler way to get ISO 8601 formatting from doc.Info.ModDate than the following one? \starttext \startluacode function document.transfer_metadata(name) local main_doc = lpdf.epdf.load(name) context.setupinteraction{ title = main_doc.Info.Title } context.setupinteraction{ date = main_doc.Info.ModDate:sub(3,6) .. "-" .. main_doc.Info.ModDate:sub(7,8) .. "-" .. main_doc.Info.ModDate:sub(9,10) .. "T" .. main_doc.Info.ModDate:sub(11,12) .. ":" .. main_doc.Info.ModDate:sub(13,14) .. ":" .. main_doc.Info.ModDate:sub(15,22):gsub("'", ":") } context(main_doc.Info.Title .. "\\par") lpdf.epdf.unload(name) end \stopluacode \unexpanded\def\TransferMetadata#1% {\ctxlua{document.transfer_metadata("#1")}} \startTEXpage[offset=1em, align=center] \TransferMetadata{metadata.pdf} \stopTEXpage \stoptext > Seems that "CreationDate" could be set by the SOURCE_DATE_EPOCH > environment variable, but I am not succesfull with it right now. It would be fine to ble able to set CreationDate. Otherwise, having a ModDate prior to CreationDate gives a weird impression. Many thanks for your help, Pablo -- http://www.ousia.tk ___ 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] setting date in \setupinteraction
On Tue Oct 19, 2021 at 5:47 PM CEST, Pablo Rodriguez via ntg-context wrote: > Dear list, > > I have the following sample: > > \setupinteraction[state=start, > date={02.02.2022}] > \starttext > This document is from 02.02.2020 at 12:00:21. > \stoptext > > Which is the right way to get PDF dates working with \setupinteraction? According to lpdf-mis.lmt about the "date" parameter: -- users should enter the date in 2010-01-19T23:27:50+01:00 format -- and if not provided that way we use the creation time instead I can get this format also with `date --iso-8601=seconds` or the shorter `date -Iseconds`. So this works: \setupinteraction[state=start, date={2022-02-02T12:00:21+02:00}] \starttext This document is from 02.02.2020 at 12:00:21. \stoptext This parameter sets the "ModDate" is that what you are after? Seems that "CreationDate" could be set by the SOURCE_DATE_EPOCH environment variable, but I am not succesfull with it right now. Michal ___ 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 ___
[NTG-context] setting date in \setupinteraction
Dear list, I have the following sample: \setupinteraction[state=start, date={02.02.2022}] \starttext This document is from 02.02.2020 at 12:00:21. \stoptext Which is the right way to get PDF dates working with \setupinteraction? Many thanks for your help, Pablo -- http://www.ousia.tk ___ 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 ___
[NTG-context] date formatting
From Wikipedia: In English-language outside North America (mostly in Anglophone Europe and some countries in Australasia), full dates are written as 7 December 1941 (or 7th December 1941) and spoken as "the seventh of December, nineteen forty-one" (exceedingly common usage of "the" and "of"), with the occasional [my emphasis] usage of December 7, 1941 ("December the seventh, nineteen forty-one"). In common with most continental European usage, however, all-numeric dates are invariably ordered dd/mm/. From this I infer that \language[en] or \language[en-gb] should format dates normally in day-month-year order, reserving mont-day-year for \language[us] i.e. language[en-us]. But in ConTeXt both \language[en] and \language[en-gb] produce the us ordering for \currentdate. I would be pleased if ConTeXt could be changed to the above mentioned normal behaviour for english. That is [en] and [en-gb] produce the day-month-year order and that [us] and [en-us] month-day-year. dr. Hans van der Meer ___ 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] missing space after \date[] (was: printing the current date)
On 3/13/2021 12:10 AM, Peter Münster wrote: On Wed, Jan 27 2021, Wolfgang Schuster wrote: When not all optional arguments are used the space after the last given argument is gobbled. This was normal behavior for a long time until you changed the code in MkIV to keep them. Hi, What does that mean? Is that going to be changed? How should \date[] be used now in the text? For now, I do it like "bla \date[d=3]\ bla". Is there a nicer way? TIA for any hints, The problem with an interface with optional arguments is that it has to look ahead. There are actually some macros that use this feature to get rid of upcoming spaces (picking up two optional arguments where one is needed). So, no matter what solution is chosen: push back a space or not, it has some unpredictable character. This is why I always am explicit, as in \date[d=3]\ bla because no matter what happens bvehind the screens, the \ terminates the argument check so it will stay. (I admit that i'm mnore often bitten by the pushed back one than the gobbled one so i make it a habit to be explicit about spaces, like like i use \removeunwantedspaces when i'm not sure when there can be spaces that crept in). We can of course in lmtx bring back the 'push back a space' behaviour but we then also introduce some fuzzyness. Now we have "we scan upto n arguments and gobble spaces when doing so". Btw, there is also another aspect: when looking for optional arguments the next token gets looked at and that one can be in an upcoming macro or content. \startfoo[a][b] content \stopfoo \startfoo[a] [ that starts content \stopfoo so sometimes one needs \startfoo[a] \relax [ that starts content \stopfoo to abort the scanning. 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 ___
[NTG-context] missing space after \date[] (was: printing the current date)
On Wed, Jan 27 2021, Wolfgang Schuster wrote: > When not all optional arguments are used the space after the last > given argument is gobbled. This was normal behavior for a long time > until you changed the code in MkIV to keep them. Hi, What does that mean? Is that going to be changed? How should \date[] be used now in the text? For now, I do it like "bla \date[d=3]\ bla". Is there a nicer way? TIA for any hints, -- Peter ___ 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] printing the current date
Hans Hagen schrieb am 27.01.2021 um 22:31: On 1/27/2021 6:28 PM, Peter Münster wrote: On Sun, Jan 10 2021, Peter Münster wrote: \currentdate% same as \date, but I would expect the day of today... Should I fill a bug-report on the tracker? Perhaps also for the missing space after \date[]? Reporting here is faster. Can (lazy me) Wolfgang confirm the issue? 1. Wrong date The \date command has wrong/weird grouping which makes global changes for the day, month and year. \permanent\tolerant\protected\def\date[#1]#*[#2]% {\dontleavehmode \ifparameter#1\or \begingroup \letdummyparameter\c!d\normalday \letdummyparameter\c!m\normalmonth \letdummyparameter\c!y\normalyear \getdummyparameters[#1]% \normalexpanded {\endgroup \normalday \number\directdummyparameter\c!d\relax \normalmonth\number\directdummyparameter\c!m\relax \normalyear \number\directdummyparameter\c!y\relax}% \fi ...} 2. Missing space When not all optional arguments are used the space after the last given argument is gobbled. This was normal behavior for a long time until you changed the code in MkIV to keep them. \tolerant\def\foo[#1]#*[#2]% {[#1][#2]} \starttext a \foo [1] b a \foo [1] [2] b \stoptext Wolfgang ___ 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] printing the current date
On 1/27/2021 6:28 PM, Peter Münster wrote: On Sun, Jan 10 2021, Peter Münster wrote: \currentdate% same as \date, but I would expect the day of today... Should I fill a bug-report on the tracker? Perhaps also for the missing space after \date[]? Reporting here is faster. Can (lazy me) Wolfgang confirm the issue? 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] printing the current date
On Sun, Jan 10 2021, Peter Münster wrote: > \currentdate% same as \date, but I would expect the day of today... Should I fill a bug-report on the tracker? Perhaps also for the missing space after \date[]? TIA, -- Peter ___ 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 ___
[NTG-context] LMTX/MkIV difference in date handling
ConTeXt ver: 2021.01.11 17:27 LMTX fmt: 2021.1.11 The following works in MkIV, but not in LMTX: \def\Jahr{\currentdate[year]} \settaggedmetadata[ rights={© \Jahr{} Me} ] \starttext \strut \stoptext The error message is: 1 \def\Jahr{\currentdate[year]} 2 3 \settaggedmetadata[ 4 >> rights={© \Jahr{} Me} 5 ] 6 7 \starttext 8 \strut 9 \stoptext 10 You've closed more groups than you opened. Such booboos are generally harmless, so keep going. 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] printing the current date
On Sun, Jan 10 2021, Fabrice L wrote: > For exemple: > > \date[][weekday,day,month,year] and \currenttime[h,{\,:\,},m] Sorry, I should have mentioned, that I use the latest version: context-2021.01.08 -- Peter ___ 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] printing the current date
> Le 10 janv. 2021 à 13:23, Peter Münster a écrit : > > Hi, > > I would expect, that \currentdate prints the current date, but it does > not: > > --8<---cut here---start->8--- > \starttext > \date[d=1]% first day of this month, ok > > \date% again first day, last parameters are used, this is ok > > \currentdate% same as \date, but I would expect the day of today... > \stoptext > --8<---cut here---end--->8--- > > How could I print the current date please? For exemple: \date[][weekday,day,month,year] and \currenttime[h,{\,:\,},m] F. > > TIA for any hints, > -- > Peter > ___ > 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 ___
[NTG-context] printing the current date
Hi, I would expect, that \currentdate prints the current date, but it does not: --8<---cut here---start->8--- \starttext \date[d=1]% first day of this month, ok \date% again first day, last parameters are used, this is ok \currentdate% same as \date, but I would expect the day of today... \stoptext --8<---cut here---end--->8--- How could I print the current date please? TIA for any hints, -- Peter ___ 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 ___
[NTG-context] space after \date[]
Hi, There is no more space after \date[] with the latest version. Is this wanted, or a bug? Example: \starttext \date[d=1] X % no space before "X" \stoptext Kind regards, -- Peter ___ 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 ___
[NTG-context] tikz-module not up to date (synchronisation problem with contextgarden?)
Hi It's been a long time, since a solution for the 'module wrapping error' in tikz has been proposed here in the list: https://mailman.ntg.nl/pipermail/ntg-context/2017/090404.html Since July a fix has been published: https://github.com/pgf-tikz/pgf/commit/9b24e5cdb8246b1075d02c02c75ff8bcac642c16 A few days ago the release containing the fix was released. On contextgarden the manual under modules/t-tikz/doc/generic/pgf shows the current version 3.1.8b, but the source doesn't include the fix. I compared the source on context-garden (rsync:// contextgarden.net/minimals/current/modules/) with the zip ( https://github.com/pgf-tikz/pgf/archive/3.1.8b.zip). In the zip file the fix is included, so I'm puzzled... Is there a synchronisation-problem? Just wanted to mention it. It's not crucial. Thanks Christian ___ 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] Short weekday option for date command
Thank you Wolfgang! Adam On Wed, Apr 8, 2020 at 9:11 PM Wolfgang Schuster < wolfgang.schuster.li...@gmail.com> wrote: > Adam Reviczky schrieb am 08.04.2020 um 21:53: > > Thank you Hans and Wolfgang, > > > > I have updated the wiki (https://wiki.contextgarden.net/Command/date) > > with the new dayshort/daylong options, but I seem to get an empty value > > for every day after day 7, see example: > > > > \starttext > > \date[d=7,m=4,y=2008][{\dayshort\normalday},{,~},day,~,month,~,year] \par > > \date[d=8,m=4,y=2008][{\dayshort\normalday},{,~},day,~,month,~,year] > > \stoptext > > > > This gives me (note "sun" is missing in the second line): > > > > sat, 7 April 2008 > > , 8 April 2008 > > > > Am I using the options correctly? > > No, the \daylong and \dayshort expect a number between 1 and 7 and > result in a label for the requested day of the week but it's not meant > to be used in \currentdate. > > > Still using luatex and not luametatex. > > To get the short names with \currentdate you have to append ":mnem" to > the weekday, w, WEEKDAY or W keywords. > > \starttext > > \startlines > \date[d=7,m=4,y=2008][weekday,{,~},day,~,month,~,year] > \date[d=7,m=4,y=2008][weekday:mnem,{,~},day,~,month,~,year] > \date[d=8,m=4,y=2008][weekday,{,~},day,~,month,~,year] > \date[d=8,m=4,y=2008][weekday:mnem,{,~},day,~,month,~,year] > \stoplines > > \stoptext > > Wolfgang > ___ 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] Short weekday option for date command
Adam Reviczky schrieb am 08.04.2020 um 21:53: Thank you Hans and Wolfgang, I have updated the wiki (https://wiki.contextgarden.net/Command/date) with the new dayshort/daylong options, but I seem to get an empty value for every day after day 7, see example: \starttext \date[d=7,m=4,y=2008][{\dayshort\normalday},{,~},day,~,month,~,year] \par \date[d=8,m=4,y=2008][{\dayshort\normalday},{,~},day,~,month,~,year] \stoptext This gives me (note "sun" is missing in the second line): sat, 7 April 2008 , 8 April 2008 Am I using the options correctly? No, the \daylong and \dayshort expect a number between 1 and 7 and result in a label for the requested day of the week but it's not meant to be used in \currentdate. Still using luatex and not luametatex. To get the short names with \currentdate you have to append ":mnem" to the weekday, w, WEEKDAY or W keywords. \starttext \startlines \date[d=7,m=4,y=2008][weekday,{,~},day,~,month,~,year] \date[d=7,m=4,y=2008][weekday:mnem,{,~},day,~,month,~,year] \date[d=8,m=4,y=2008][weekday,{,~},day,~,month,~,year] \date[d=8,m=4,y=2008][weekday:mnem,{,~},day,~,month,~,year] \stoplines \stoptext Wolfgang ___ 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] Short weekday option for date command
Thank you Hans and Wolfgang, I have updated the wiki (https://wiki.contextgarden.net/Command/date) with the new dayshort/daylong options, but I seem to get an empty value for every day after day 7, see example: \starttext \date[d=7,m=4,y=2008][{\dayshort\normalday},{,~},day,~,month,~,year] \par \date[d=8,m=4,y=2008][{\dayshort\normalday},{,~},day,~,month,~,year] \stoptext This gives me (note "sun" is missing in the second line): sat, 7 April 2008 , 8 April 2008 Am I using the options correctly? Still using luatex and not luametatex. ConTeXt ver: 2020.04.08 14:34 MKIV beta fmt: 2020.4.8 int: english/english mtx-context | current version: 2020.04.08 14:34 This is LuaTeX, Version 1.13.0 (TeX Live 2020/Debian) Compiled with libpng 1.6.37; using 1.6.37 Compiled with lua version 5.3.5 Compiled with mplib version 2.00 Compiled with zlib 1.2.11; using 1.2.11 Development id: 7330 Thanks, Adam On Sat, Apr 4, 2020 at 11:24 AM Hans Hagen wrote: > On 4/4/2020 11:47 AM, Adam Reviczky wrote: > > Hi, > > > > Is there a way to achieve a short weekday option with \date[] to get 3 > > letter equivalents (Mon, Tue, Wed, Thu, Fri, Sat, Sun) similar to the > > monthshort either through context or lua? > Not currently but I will add the basics (I have to double check with WS > to see where if conflicts as such an extension involves additional > commands it has to go into the setups too) but others have to add the > abbreviations. > > 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] Short weekday option for date command
On 4/4/2020 11:47 AM, Adam Reviczky wrote: Hi, Is there a way to achieve a short weekday option with \date[] to get 3 letter equivalents (Mon, Tue, Wed, Thu, Fri, Sat, Sun) similar to the monthshort either through context or lua? Not currently but I will add the basics (I have to double check with WS to see where if conflicts as such an extension involves additional commands it has to go into the setups too) but others have to add the abbreviations. 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 ___
[NTG-context] Short weekday option for date command
Hi, Is there a way to achieve a short weekday option with \date[] to get 3 letter equivalents (Mon, Tue, Wed, Thu, Fri, Sat, Sun) similar to the monthshort either through context or lua? Thanks, Adam ___ 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] 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] Up-to-date documentation / tutorials. Where?
Is there not a simple place to get all the up-to-date documentation? If you install ConTeXt from http://www.pragma-ade.nl/install.htm in the installation tree you'll find docs under tex/texmf-context/doc/context/documents/ There you'll always find the docs at their last revision. Massi ___ 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] Up-to-date documentation / tutorials. Where?
On Sat, 29 Feb 2020 12:10:13 +0100 Gerben Wierda wrote: > Hello community, > > I have been (unsuccessfully) hunting for up-to-date tutorials/documentation > on ConTeXt/LuaTeX/METAPOST. What I find is sites that for instance end in > 2011. documentation that is from 2013, or on Pragme-ADE a show-man.pdf PDF > with an overview of documentation that doesn’t open any underlying document. > > Is there not a simple place to get all the up-to-date documentation? Take a look into the documentation folder [1] of your ConTeXt installation. A few of the documents mentions ConTeXt related extension to MetaPost but the basics haven't changed and the old tutorials work. [1] $TEXMF/tex/texmf-context/doc/context/documents/general/manuals List of all documents in the directory above: about.pdf bidi.pdf charts-mkiv.pdf cld-mkiv.pdf colors-mkiv.pdf columnsets.pdf details.pdf ecmascript-mkiv.pdf epub-mkiv-demo.epub epub-mkiv-demo.pdf epub-mkiv.pdf evenmore.pdf followingup.pdf fonts-mkiv.pdf graphics.pdf hybrid.pdf interaction.pdf languages-mkiv.pdf libraries-mkiv.pdf lowlevel-boxes.pdf lowlevel-conditionals.pdf lowlevel-expansion.pdf lowlevel-registers.pdf lua-mkiv.pdf luametafun.pdf luametatex.pdf luatex.pdf ma-cb-en.pdf math-mkiv.pdf metafun-p.pdf metafun-s.pdf mk.pdf mkiv-publications.pdf mmlexamp.pdf mmlprime.pdf mreadme.pdf musings.pdf nodes.pdf notnow.pdf onandon.pdf pagecolumns.pdf rules-mkiv.pdf spacing-mkiv.pdf spreadsheets-mkiv.pdf sql-mkiv.pdf steps-mkiv.pdf still.pdf svg-lmtx.pdf swiglib-mkiv.pdf templates-mkiv.pdf texit.pdf tiptrick.pdf tools-mkiv.pdf units-mkiv.pdf workflows-mkiv.pdf xml-mkiv.pdf xtables-mkiv.pdf Wolfgang ___ 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 ___
[NTG-context] Up-to-date documentation / tutorials. Where?
Hello community, I have been (unsuccessfully) hunting for up-to-date tutorials/documentation on ConTeXt/LuaTeX/METAPOST. What I find is sites that for instance end in 2011. documentation that is from 2013, or on Pragme-ADE a show-man.pdf PDF with an overview of documentation that doesn’t open any underlying document. Is there not a simple place to get all the up-to-date documentation? G ___ 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] Up-to-date documentation / tutorials. Where?
Hi, > Is there not a simple place to get all the up-to-date documentation? maybe not what you are looking for, but I think the list at https://tex.stackexchange.com/questions/448812/the-definitive-guide-to-context-mkiv-documentation is very helpful. ___ 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] \date is calculated wrong
On Wed, 2019-09-11 at 08:42 +0200, Hans Hagen wrote: > On 9/11/2019 4:15 AM, Martin Althoff wrote: > > Hi all, > > > > the \date is output wrong. Whatever value is given for d= I get the 11th. > > That is todays > > date. Not sure what would happen tomorrow > > > > Thanks for any fix suggestions. > > > > \starttext > > \date[d=16,m=9,y=2019][weekday, day,{. }, month, year] > > \stoptext > also in the latest beta? > > Hans > All fixed after updating to current version: 2019.09.10 20:03 Sorry for the noise, Thanks, Martin ___ 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] \date is calculated wrong
On 9/11/2019 4:15 AM, Martin Althoff wrote: Hi all, the \date is output wrong. Whatever value is given for d= I get the 11th. That is todays date. Not sure what would happen tomorrow Thanks for any fix suggestions. \starttext \date[d=16,m=9,y=2019][weekday, day,{. }, month, year] \stoptext also in the latest beta? 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 ___
[NTG-context] \date is calculated wrong
Hi all, the \date is output wrong. Whatever value is given for d= I get the 11th. That is todays date. Not sure what would happen tomorrow Thanks for any fix suggestions. \starttext \date[d=16,m=9,y=2019][weekday, day,{. }, month, year] \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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Problem of displaying a date with a macro
On 9/9/2019 3:24 PM, Fabrice Couvreur wrote: Hello, I just updated my version of ConTeXt and the bug is still present. Can you confirm ? Thank you. Fabrice Le mer. 28 août 2019 à 16:34, Aditya Mahajan <mailto:adit...@umich.edu>> a écrit : On Wed, 28 Aug 2019, Fabrice Couvreur wrote: > Hello, > The date display is incorrect : I get day 28 instead of day 2. > Thank you > Fabrice > > \defineframed > [headerframed] > [frame=off, > height=fit, > width=fit] > > \definecolor[ColorA][0.8(white)] > > > \startsetups [headertext] > > \setupheadertexts > [{\startframed [headerframed] > [foregroundstyle=bold,background=framewithshadow] > \getvariable{headertext}{title} > n\high{o}\,\getvariable{headertext}{number} > \stopframed}] > > \setupheadertexts > [{\startframed [headerframed] > [align=flushleft,foregroundstyle=] > Lycée LA SALLE, Lille\\ > \getvariable{headertext}{location} > \stopframed}] > > [{\startframed [headerframed] > [align=flushright,foregroundstyle=] > > \date[d=\getvariable{headertext}{day},m=\getvariable{headertext}{month},y=\getvariable{headertext}{year}] > \stopframed}] > > \stopsetups > > \setvariable{headertext}{set}{\directsetup{headertext}} > > \startuseMPgraphic{framewithshadow} > path p; > p:=origin--(OverlayWidth,0)--(OverlayWidth,OverlayHeight)--(0,OverlayHeight)--cycle; > fill p shifted (2,-2); > fill p withcolor 0.8white; > draw p; > setbounds currentpicture to p; > \stopuseMPgraphic > > \defineoverlay[framewithshadow][\useMPgraphic{framewithshadow}] > > \starttext > \setvariables > [headertext] > [title={Devoir maison}, > number={6}, > day={02}, > month={09}, > year={2019}, > location={Seconde B}, > time={}] > \input knuth > \stoptext There was a bug with the \date macro which I had reported a few days ago. This appears to be related to that. Should be fixed in the next beta. I have a chicken-egg issue to solve (probebly in the end have to drop something for consistency deep down) can you use for now: \date[d=21,m=2,y=2219] [month,{ },D,{, },year] \date[d=22,m=12,y=2119][month,{ },D,{, },year] -- - 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] Problem of displaying a date with a macro
Hi, On my installation of lmtx (version 2019.08.20 17:34), as well as mkiv (version 2019.08.24 22:42 MKIV) the following gives: \starttext \date[d=25,m=10,y=1999] \stoptext October 09, 1999. So the month and the year are correct, but not the day. Best regards: OK > On 9 Sep 2019, at 16:27, Pablo Rodriguez wrote: > > On 9/9/19 3:24 PM, Fabrice Couvreur wrote: >> Hello, >> I just updated my version of ConTeXt and the bug is still present. >> Can you confirm ? > > Hi Fabrice, > > I confirm that latest beta (from 2019.09.09 13:44), doesn’t change the > date in the following sample: > >\starttext >\date[d=25] >\stoptext > > I hope it helps, > > Pablo > -- > http://www.ousia.tk > ___ > 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] Problem of displaying a date with a macro
On 9/9/19 3:24 PM, Fabrice Couvreur wrote: > Hello, > I just updated my version of ConTeXt and the bug is still present. > Can you confirm ? Hi Fabrice, I confirm that latest beta (from 2019.09.09 13:44), doesn’t change the date in the following sample: \starttext \date[d=25] \stoptext I hope it helps, Pablo -- http://www.ousia.tk ___ 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] Problem of displaying a date with a macro
Hello, I just updated my version of ConTeXt and the bug is still present. Can you confirm ? Thank you. Fabrice Le mer. 28 août 2019 à 16:34, Aditya Mahajan a écrit : > On Wed, 28 Aug 2019, Fabrice Couvreur wrote: > > > Hello, > > The date display is incorrect : I get day 28 instead of day 2. > > Thank you > > Fabrice > > > > \defineframed > >[headerframed] > >[frame=off, > > height=fit, > > width=fit] > > > > \definecolor[ColorA][0.8(white)] > > > > > > \startsetups [headertext] > > > >\setupheadertexts > > [{\startframed [headerframed] > > [foregroundstyle=bold,background=framewithshadow] > > \getvariable{headertext}{title} > > n\high{o}\,\getvariable{headertext}{number} > > \stopframed}] > > > >\setupheadertexts > > [{\startframed [headerframed] > > [align=flushleft,foregroundstyle=] > > Lycée LA SALLE, Lille\\ > > \getvariable{headertext}{location} > > \stopframed}] > > > > [{\startframed [headerframed] > > [align=flushright,foregroundstyle=] > > > > > \date[d=\getvariable{headertext}{day},m=\getvariable{headertext}{month},y=\getvariable{headertext}{year}] > > \stopframed}] > > > > \stopsetups > > > > \setvariable{headertext}{set}{\directsetup{headertext}} > > > > \startuseMPgraphic{framewithshadow} > > path p; > > > p:=origin--(OverlayWidth,0)--(OverlayWidth,OverlayHeight)--(0,OverlayHeight)--cycle; > > fill p shifted (2,-2); > > fill p withcolor 0.8white; > > draw p; > > setbounds currentpicture to p; > > \stopuseMPgraphic > > > > \defineoverlay[framewithshadow][\useMPgraphic{framewithshadow}] > > > > \starttext > > \setvariables > > [headertext] > > [title={Devoir maison}, > >number={6}, > >day={02}, > >month={09}, > >year={2019}, > >location={Seconde B}, > >time={}] > > \input knuth > > \stoptext > > There was a bug with the \date macro which I had reported a few days ago. > This appears to be related to that. Should be fixed in the next beta. > > > Aditya___ > 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] Problem of displaying a date with a macro
On Wed, 28 Aug 2019, Fabrice Couvreur wrote: Hello, The date display is incorrect : I get day 28 instead of day 2. Thank you Fabrice \defineframed [headerframed] [frame=off, height=fit, width=fit] \definecolor[ColorA][0.8(white)] \startsetups [headertext] \setupheadertexts [{\startframed [headerframed] [foregroundstyle=bold,background=framewithshadow] \getvariable{headertext}{title} n\high{o}\,\getvariable{headertext}{number} \stopframed}] \setupheadertexts [{\startframed [headerframed] [align=flushleft,foregroundstyle=] Lycée LA SALLE, Lille\\ \getvariable{headertext}{location} \stopframed}] [{\startframed [headerframed] [align=flushright,foregroundstyle=] \date[d=\getvariable{headertext}{day},m=\getvariable{headertext}{month},y=\getvariable{headertext}{year}] \stopframed}] \stopsetups \setvariable{headertext}{set}{\directsetup{headertext}} \startuseMPgraphic{framewithshadow} path p; p:=origin--(OverlayWidth,0)--(OverlayWidth,OverlayHeight)--(0,OverlayHeight)--cycle; fill p shifted (2,-2); fill p withcolor 0.8white; draw p; setbounds currentpicture to p; \stopuseMPgraphic \defineoverlay[framewithshadow][\useMPgraphic{framewithshadow}] \starttext \setvariables [headertext] [title={Devoir maison}, number={6}, day={02}, month={09}, year={2019}, location={Seconde B}, time={}] \input knuth \stoptext There was a bug with the \date macro which I had reported a few days ago. This appears to be related to that. Should be fixed in the next beta. Aditya___ 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 ___
[NTG-context] Problem of displaying a date with a macro
Hello, The date display is incorrect : I get day 28 instead of day 2. Thank you Fabrice \defineframed [headerframed] [frame=off, height=fit, width=fit] \definecolor[ColorA][0.8(white)] \startsetups [headertext] \setupheadertexts [{\startframed [headerframed] [foregroundstyle=bold,background=framewithshadow] \getvariable{headertext}{title} n\high{o}\,\getvariable{headertext}{number} \stopframed}] \setupheadertexts [{\startframed [headerframed] [align=flushleft,foregroundstyle=] Lycée LA SALLE, Lille\\ \getvariable{headertext}{location} \stopframed}] [{\startframed [headerframed] [align=flushright,foregroundstyle=] \date[d=\getvariable{headertext}{day},m=\getvariable{headertext}{month},y=\getvariable{headertext}{year}] \stopframed}] \stopsetups \setvariable{headertext}{set}{\directsetup{headertext}} \startuseMPgraphic{framewithshadow} path p; p:=origin--(OverlayWidth,0)--(OverlayWidth,OverlayHeight)--(0,OverlayHeight)--cycle; fill p shifted (2,-2); fill p withcolor 0.8white; draw p; setbounds currentpicture to p; \stopuseMPgraphic \defineoverlay[framewithshadow][\useMPgraphic{framewithshadow}] \starttext \setvariables [headertext] [title={Devoir maison}, number={6}, day={02}, month={09}, year={2019}, location={Seconde B}, time={}] \input knuth \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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] \date in LMTX
On 8/18/2019 9:59 AM, Otared Kavian wrote: On 18 Aug 2019, at 05:25, Aditya Mahajan wrote: Hi, There is a bug with \date in LMTX. \starttext \date[d=10] \stoptext does not change the date. Works okay in MKIV. Hi, Actually it does not work in mkiv version 2019.08.14 11:26, nor in lmtx version 2019.08.14 11:44. But it works in mkiv version 2019.03.21 21:39 from TeXLive 2019. fixed in next beta - 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] \date in LMTX
> On 18 Aug 2019, at 05:25, Aditya Mahajan wrote: > > Hi, > > There is a bug with \date in LMTX. > > \starttext > \date[d=10] > \stoptext > > does not change the date. Works okay in MKIV. Hi, Actually it does not work in mkiv version 2019.08.14 11:26, nor in lmtx version 2019.08.14 11:44. But it works in mkiv version 2019.03.21 21:39 from TeXLive 2019. Best regards: OK ___ 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 ___
[NTG-context] \date in LMTX
Hi, There is a bug with \date in LMTX. \starttext \date[d=10] \stoptext does not change the date. Works okay in MKIV. Thanks, Aditya ___ 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] \date behaving strange
Great, that worked. Thanks for the quick solution. Changed the line, then ran: luatools --generate luatools --ini --compile cont-en On 09.02.19 20:59, Hans Hagen wrote: On 2/9/2019 2:39 PM, martin wrote: I'm getting a bit confused. The \date function doesn't result in a formatted date. That goes for some files that are a few weeks old. What am I missing? \starttext \date[d=2,m=3,y= 2018] \stoptext results in: d=2m=3y= 2018 An optional formatting parameter has no effect \date[d=1, m=4, y=2018][weekday, {\\}, dd,{-}, mm,-, year] line 446 of core-con.mkiv should be: {#2}{\currentdatespecification}{\labellanguage}% ___ 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] \date behaving strange
On 2/9/2019 2:39 PM, martin wrote: I'm getting a bit confused. The \date function doesn't result in a formatted date. That goes for some files that are a few weeks old. What am I missing? \starttext \date[d=2,m=3,y= 2018] \stoptext results in: d=2m=3y= 2018 An optional formatting parameter has no effect \date[d=1, m=4, y=2018][weekday, {\\}, dd,{-}, mm,-, year] line 446 of core-con.mkiv should be: {#2}{\currentdatespecification}{\labellanguage}% - 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 ___
[NTG-context] \date behaving strange
I'm getting a bit confused. The \date function doesn't result in a formatted date. That goes for some files that are a few weeks old. What am I missing? \starttext \date[d=2,m=3,y= 2018] \stoptext results in: d=2m=3y= 2018 An optional formatting parameter has no effect \date[d=1, m=4, y=2018][weekday, {\\}, dd,{-}, mm,-, year] using: mtx-context | current version: 2019.02.07 18:46 ___ 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 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] type="divDate">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 - 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 ___
[NTG-context] XML to ConTeXt: converting date attribute from ISO date
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 <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___ 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 ___
[NTG-context] Use of context in lua (was: date calculated with currentdate plus n days)
On 14.08.2018 16:58, Pablo Rodriguez wrote: > I rewrote your sample as (xtables are the only tables I know in ConTeXt): > > \starttext > \startlua > context.startxtable() > context.startxrow() > context.startxcell() > context("Note 1") > context.stopxcell() > context.startxcell() > context("Note 2") > context.stopxcell() > context.stopxrow() > context.startxrow() > context.startxcell() > context("Note 3") > context.stopxcell() > context.startxcell() > context("Note 4") > context.stopxcell() > context.stopxrow() > context.stopxtable() > \stoplua > \stoptext Seeing this example I wonder if there is already an example taking a csv-file and creating a table based on its content. I guess building blocks are readfile, loops and setting the stop sign (; oder ,). As I know a bit of Python, at least, I might be able to search for the building blocks in the doku. ;-) juh ___ 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] date calculated with currentdate plus n days
On 08/14/2018 09:24 AM, Henri Menke wrote: > On 14/08/18 17:29, Pablo Rodriguez wrote: >> [...] >> Where are those context.* Lua commands documented? >> >> I want to generate an xtable using Lua code, but I don’t know where to read. > > They aren't documented because they are just the context commands. You > can read more about how it works in > http://www.pragma-ade.nl/general/manuals/cld-mkiv.pdf Many thanks for your reply, Henri. I remember paging through the manual, it’s included in the distribution. I rewrote your sample as (xtables are the only tables I know in ConTeXt): \starttext \startlua context.startxtable() context.startxrow() context.startxcell() context("Note 1") context.stopxcell() context.startxcell() context("Note 2") context.stopxcell() context.stopxrow() context.startxrow() context.startxcell() context("Note 3") context.stopxcell() context.startxcell() context("Note 4") context.stopxcell() context.stopxrow() context.stopxtable() \stoplua \stoptext Many thanks for your help, Pablo -- http://www.ousia.tk ___ 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] date calculated with currentdate plus n days
On 14/08/18 17:29, Pablo Rodriguez wrote: On 08/14/2018 01:46 AM, Henri Menke wrote: On top of that I recommend to use context.date to get the correct formatting according to the current language options: \def\duedate{\ctxlua{ local t = os.date('*t', os.time()+ 10 * 24 * 3600) context.date{ d = t.day, m = t.month, y = t.year } }} Many thanks for your reply, Henri. Where are those context.* Lua commands documented? I want to generate an xtable using Lua code, but I don’t know where to read. They aren't documented because they are just the context commands. You can read more about how it works in http://www.pragma-ade.nl/general/manuals/cld-mkiv.pdf Here a little sample with an xtable: \starttext \startluacode local function duedate() local t = os.date('*t', os.time()+ 10 * 24 * 3600) context.date{ d = t.day, m = t.month, y = t.year } end context.startxtable{frame = "off"} context.NC() context("Note") context.NC() context("Date") context.NR() context.NC() context("Hand in before") context.NC() duedate() context.NR() context.stopxtable() \stopluacode \stoptext Many thanks for your help, Pablo ___ 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] date calculated with currentdate plus n days
On 08/14/2018 01:46 AM, Henri Menke wrote: > On top of that I recommend to use context.date to get the correct > formatting according to the current language options: > > \def\duedate{\ctxlua{ >local t = os.date('*t', os.time()+ 10 * 24 * 3600) >context.date{ d = t.day, m = t.month, y = t.year } > }} Many thanks for your reply, Henri. Where are those context.* Lua commands documented? I want to generate an xtable using Lua code, but I don’t know where to read. Many thanks for your help, Pablo -- http://www.ousia.tk ___ 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] date calculated with currentdate plus n days
On top of that I recommend to use context.date to get the correct formatting according to the current language options: \starttext \def\duedate{\ctxlua{ local t = os.date('*t', os.time()+ 10 * 24 * 3600) context.date{ d = t.day, m = t.month, y = t.year } }} \duedate \stoptext On 14/08/18 05:37, Jan U. Hasecke wrote: On 13.08.2018 17:57, Pablo Rodriguez wrote: if you don’t mind using Lua, here you have it: \starttext \def\duedate{\cldcontext{os.date('\letterpercent d/\letterpercent m/\letterpercent Y', os.time()+ 10 * 24 * 3600)}} \duedate \stoptext Just in case it helps, Thanks! I thought it should be possible with lua, but I found no entry point to use lua in context by defining new commands. juh ___ 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] date calculated with currentdate plus n days
On 13.08.2018 17:57, Pablo Rodriguez wrote: > if you don’t mind using Lua, here you have it: > > \starttext > \def\duedate{\cldcontext{os.date('\letterpercent d/\letterpercent > m/\letterpercent Y', os.time()+ 10 * 24 * 3600)}} > > \duedate > \stoptext > > Just in case it helps, Thanks! I thought it should be possible with lua, but I found no entry point to use lua in context by defining new commands. juh ___ 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] date calculated with currentdate plus n days
On 08/13/2018 05:19 PM, Jan U. Hasecke wrote: > Hi all, > > I want to insert a due date for payments in my invoice and I would like > to calculate it from \currentdate. Something like > > define \duedate = \currentdate plus 10 days > > Is this possible? Hi Jan-Ulrich, if you don’t mind using Lua, here you have it: \starttext \def\duedate{\cldcontext{os.date('\letterpercent d/\letterpercent m/\letterpercent Y', os.time()+ 10 * 24 * 3600)}} \duedate \stoptext Just in case it helps, Pablo -- http://www.ousia.tk ___ 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 ___
[NTG-context] date calculated with currentdate plus n days
Hi all, I want to insert a due date for payments in my invoice and I would like to calculate it from \currentdate. Something like define \duedate = \currentdate plus 10 days Is this possible? juh ___ 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] \nopdfcompression and no date information
On 06/24/2018 09:54 PM, Hans Hagen wrote: > On 6/23/2018 6:07 PM, Pablo Rodriguez wrote: >> [...] >> Is there a command (similar to \nopdfcompression) that has the same >> effect than compiling the document with "context --nodates"? > no, and there won't be either because this is a feature creep option but > you can try > > \enabledirectives[backend.date=no] Many thanks for your reply, Hans. The use is totally focused in a single file that I would like to recreate if needed (having the exact SHA512). Many thanks for your reply, Pablo -- http://www.ousia.tk ___ 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] \nopdfcompression and no date information
On 6/23/2018 6:07 PM, Pablo Rodriguez wrote: Dear list, I would like to avoid adding date info in certain PDF documents to be able to regenerate them having the same SHA512s. Is there a command (similar to \nopdfcompression) that has the same effect than compiling the document with "context --nodates"? no, and there won't be either because this is a feature creep option but you can try \enabledirectives[backend.date=no] 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 ___
[NTG-context] \nopdfcompression and no date information
Dear list, I would like to avoid adding date info in certain PDF documents to be able to regenerate them having the same SHA512s. Is there a command (similar to \nopdfcompression) that has the same effect than compiling the document with "context --nodates"? Many thanks for your help, Pablo -- http://www.ousia.tk ___ 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] Expansion of date inside \section
On 06/19/2016 11:51 PM, Hans Hagen wrote: > [...] > another possibility is > > \enabledirectives[references.bookmarks.preroll] Many thanks for this extremely useful directive, Hans. I have two improvement suggestions for it, shown in the following sample: \def\BookTitle{{\em A \ConTeXt\ Book}} \setupinteraction[state=start, title=\BookTitle] \enabledirectives[references.bookmarks.preroll] \placebookmarks[chapter,section][chapter,section] \starttext \chapter{\BookTitle} \section{\ConTeXt\ is \TeX, but not \LaTeX} \stoptext Would it be possible that \TeX (or \TEX) is translated as TeX? (ConTeXt is the PDF creator in the PDF documentation info). Would it be possible that this bookmark prerolling could be applied to PDF info fields? Many thanks for your help, Pablo -- http://www.ousia.tk ___ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Expansion of date inside \section
On 6/19/2016 10:17 PM, Mojca Miklavec wrote: Hi, I'm trying to generate daily reports and wanted to include the date in bookmarks, but there is some weird (non)expansion going on. I might just as well switch to lua for certain parts of the document (like cycling through dates), but I suspect that there must be some trivial hack to prevent me from getting my sections labeled date[y={2016},m={06},d={25}] \setupinteraction [state=start] \placebookmarks [chapter,section,subsection] [chapter,section] \setupinteractionscreen [option=bookmark] \def\generatesection#1#2#3{% \edef\dt{\date[y={#1},m={#2},d={#3}][year,-,mm,-,dd]} \setupheadertexts[{\dt}][pagenumber] \section{\dt} % \externalfigure[#1#2#3.pdf] } \starttext \chapter{Daily files} \generatesection{2016}{06}{25} \generatesection{2016}{06}{26} \stoptext first of all, did you try \startsection[title=foo,bookmark=bar] to separate between typeset text and bookmark (bookmark then can be #1-#2-#3) another possibility is \enabledirectives[references.bookmarks.preroll] - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Expansion of date inside \section
On 06/19/2016 08:17 PM, Mojca Miklavec wrote: Hi, I'm trying to generate daily reports and wanted to include the date in bookmarks, but there is some weird (non)expansion going on. I'm not quite sure what you're trying to do, but are you maybe missing a simple \setuphead[section][expansion=yes] ? Thomas ___ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Expansion of date inside \section
On 19 June 2016 at 22:17, Mojca Miklavec wrote: > Hi, > > I'm trying to generate daily reports and wanted to include the date in > bookmarks, but there is some weird (non)expansion going on. > > I might just as well switch to lua for certain parts of the document > (like cycling through dates), but I suspect that there must be some > trivial hack to prevent me from getting my sections labeled > date[y={2016},m={06},d={25}] ... other than using \section{#1-#2-#3} (which might also do the job for now). > \setupinteraction > [state=start] > \placebookmarks > [chapter,section,subsection] > [chapter,section] > \setupinteractionscreen > [option=bookmark] > > \def\generatesection#1#2#3{% > \edef\dt{\date[y={#1},m={#2},d={#3}][year,-,mm,-,dd]} > \setupheadertexts[{\dt}][pagenumber] > \section{\dt} > % \externalfigure[#1#2#3.pdf] > } > > \starttext > \chapter{Daily files} > \generatesection{2016}{06}{25} > \generatesection{2016}{06}{26} > \stoptext > > Thank you, > Mojca ___ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] Expansion of date inside \section
Hi, I'm trying to generate daily reports and wanted to include the date in bookmarks, but there is some weird (non)expansion going on. I might just as well switch to lua for certain parts of the document (like cycling through dates), but I suspect that there must be some trivial hack to prevent me from getting my sections labeled date[y={2016},m={06},d={25}] \setupinteraction [state=start] \placebookmarks [chapter,section,subsection] [chapter,section] \setupinteractionscreen [option=bookmark] \def\generatesection#1#2#3{% \edef\dt{\date[y={#1},m={#2},d={#3}][year,-,mm,-,dd]} \setupheadertexts[{\dt}][pagenumber] \section{\dt} % \externalfigure[#1#2#3.pdf] } \starttext \chapter{Daily files} \generatesection{2016}{06}{25} \generatesection{2016}{06}{26} \stoptext Thank you, Mojca ___ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] Include 'urldate' in *.bst (Url citations with last checked date)
Hi, for a document I'm currently writing I need to cite some online resources including their last accessed date. Adding \insertbiburl[..] to a citation style does work fine to get the urls printed. However, the *.bst styles only check for 'lastchecked' tag for a last accessed date. I don't know if there's any standard way for specifying the date but 'lastchecked' and 'urldate' seem to be two commonly used variants (as far as a quick web search tells - I'm on Zotero which also uses the last mentioned type). To get this temporary working for me I replaced the plain 'lastcheck' output in *.bst with: .. lastchecked empty$ {"" "\lastchecked" urldate do.out} {"" "\lastchecked" lastchecked do.out} if$ .. and added urldate to the list of known tags. Are there any chances to get this changed in the 'official' version (if there are no other points against this I don't see right now :))? Best regards, Jens ___ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Include 'urldate' in *.bst (Url citations with last checked date)
The new mkiv bibliography module does not use *.bst files at all. We can handle access date but there needs to be some sort of specification. I believe that the APA style only specifies "Retrieved from". I can work something in to use the fields "lastchecked" and/or "urldate". Alan On Fri, 11 Sep 2015 15:12:50 +0200 Hans Hagen <pra...@wxs.nl> wrote: > On 9/11/2015 10:29 AM, Jens Bertram wrote: > > Hi, > > > > for a document I'm currently writing I need to cite some online > > resources including their last accessed date. Adding > > \insertbiburl[..] to a citation style does work fine to get the urls > > printed. > > However, the *.bst styles only check for 'lastchecked' tag for a > > last accessed date. I don't know if there's any standard way for > > specifying the date but 'lastchecked' and 'urldate' seem to be two > > commonly used variants (as far as a quick web search tells - I'm on > > Zotero which also uses the last mentioned type). > > > > To get this temporary working for me I replaced the plain > > 'lastcheck' output in *.bst with: > > .. > > lastchecked empty$ > > {"" "\lastchecked" urldate do.out} > > {"" "\lastchecked" lastchecked do.out} if$ > > .. > > and added urldate to the list of known tags. > > > > Are there any chances to get this changed in the 'official' version > > (if there are no other points against this I don't see right > > now :))? > > I have no clue how bst files work (nor time to look into it) so > others have to decide on that. ___ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Include 'urldate' in *.bst (Url citations with last checked date)
On 9/11/2015 10:29 AM, Jens Bertram wrote: Hi, for a document I'm currently writing I need to cite some online resources including their last accessed date. Adding \insertbiburl[..] to a citation style does work fine to get the urls printed. However, the *.bst styles only check for 'lastchecked' tag for a last accessed date. I don't know if there's any standard way for specifying the date but 'lastchecked' and 'urldate' seem to be two commonly used variants (as far as a quick web search tells - I'm on Zotero which also uses the last mentioned type). To get this temporary working for me I replaced the plain 'lastcheck' output in *.bst with: .. lastchecked empty$ {"" "\lastchecked" urldate do.out} {"" "\lastchecked" lastchecked do.out} if$ .. and added urldate to the list of known tags. Are there any chances to get this changed in the 'official' version (if there are no other points against this I don't see right now :))? I have no clue how bst files work (nor time to look into it) so others have to decide on that. Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] Why is context.mkii out of date?
Hi, I created some documents with MKII and started wondering why pdfinfo was showing Creator:ConTeXt - 2013.06.07 17:34 Producer: pdfTeX-1.40.16 CreationDate: Sun May 3 11:18:14 2015 ModDate:ConTeXt - 2013.06.07 17:34 I first thought that I accidentally used TeX Live 2013 and had to tripple-check until I realized that context.mkii actually defines \edef\contextversion{2013.06.07 17:34} Why is that? While I understand that MkII is basically frozen, it would be nice if pdf reported the version of ConTeXt that was actually used. (ModDate might also be wrong. In MkIV it's the same as CreationDate. And in MkIV Creator uses one extra space at the beginning.) Thank you, Mojca ___ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Why is context.mkii out of date?
On 05/03/2015 11:27 AM, Mojca Miklavec wrote: [...] (ModDate might also be wrong. In MkIV it's the same as CreationDate. And in MkIV Creator uses one extra space at the beginning.) Hi Mojca, I see another mismatch, http://www.pragma-ade.com/general/qrcs/setup-en.pdf has the following ConTeXt version: Creator: ConTeXt - 2015.05.01 18:45 Producer: LuaTeX-0.80.0 CreationDate: Fri May 1 18:46:28 2015 (I use this file to check wheter a new beta has been released.) The same information is provided at http://pragma-ade.com/download-1.htm for the latest beta: 2015-05-01 18:47. But after having updated my distribution to latest beta (I did it yesterday), I get this info from one generated PDF document: Creator: ConTeXt - 2015.04.18 14:41 Producer: LuaTeX-0.80.0 CreationDate: Sun May 3 10:26:10 2015 Is this only a mismatch in numbers but also in files? Many thanks for your help, Pablo -- http://www.ousia.tk ___ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] Non-shortened month name in \date
Hello, \mainlanguage[cz] \starttext \date[d=1,m=3,y=2000][d,~,m,~,y]\par \date[d=1,m=3,y=2000][d,~,mm,~,y]\par \date[d=1,m=3,y=2000][d,~,month,~,y]\par \stoptext gives: 1 břez. 2000 1 03 2000 1 břez. 2000 Is there a way to get non-shortened month name, i.e. března instead břez.? Kind regards, Lukas -- Ing. Lukáš Procházka | mailto:l...@pontex.cz Pontex s. r. o. | mailto:pon...@pontex.cz | http://www.pontex.cz Bezová 1658 147 14 Praha 4 Tel: +420 241 096 751 Fax: +420 244 461 038 ___ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Non-shortened month name in \date
On 4/3/2015 1:44 PM, Procházka Lukáš Ing. - Pontex s. r. o. wrote: Hello, \mainlanguage[cz] \starttext \date[d=1,m=3,y=2000][d,~,m,~,y]\par \date[d=1,m=3,y=2000][d,~,mm,~,y]\par \date[d=1,m=3,y=2000][d,~,month,~,y]\par \stoptext gives: 1 břez. 2000 1 03 2000 1 břez. 2000 Is there a way to get non-shortened month name, i.e. března instead břez.? Kind regards, \starttext \date[d=1,m=3,y=2000][d,~,m,~,y]\par \date[d=1,m=3,y=2000][d,~,mm,~,y]\par \date[d=1,m=3,y=2000][d,~,month,~,y]\par \date[d=1,m=3,y=2000][d,~,month:mnem,~,y]\par \stoptext buglet: patch core-con.lua: elseif tag == v_month or tag == m then if currentlanguage == false then context(months[month] or unknown) elseif mnemonic then context.labeltext(monthmnem(month)) else context.labeltext(monthname(month)) end - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] expand date from CSV file
;-) Thanx Peter. I'm too not thought about solutions :-). I was so focused to mined data from a CSV file, and I've not think much about the appropriate algorithm. I love attentive and thoughtful people (although often I'm not alone such) Maybe I corrected in a subsequent e-mail properly. One more thanx. Jaroslav Hajtmar Dne 18.12.2014 v 13:37 Peter Münster napsal(a): On Thu, Dec 18 2014, Jaroslav Hajtmar wrote: if (year2000) then year=year+2000 end; Hi, What about Test;11/11/1999 ... ;-) ___ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] expand date from CSV file
Hi Pablo Here is a quick solution. However, it not treat the incorrect input data, ie it requires, however, correct input, otherwise it will collapse ... Jaroslav Hajtmar \usemodule[scancsv] \def\ddmm#1#2#3{% #1 - date, #2 - old separator, #3 - new separator \startlua parsedate=thirddata.scancsv.ParseCSVLine('#1','#2'); day=tonumber(parsedate[1]); month=tonumber(parsedate[2]); year=tonumber(parsedate[3]); if (year2000) then year=year+2000 end; tex.print(day..'#3'..month..'#3'..year); \stoplua } \unexpanded\def\lineaction{ \Name\ arrived on \ddmm{\Date}{/}{.} \\ } % Name;Date % ME;11/10/14 % You;05/02/14 % He;15/02/2014 % She;03/03/12 % It;03/03/14 \setheader \setsep{;} \setfiletoscan{mail.csv} \starttext \filelineaction \stoptext Dne 17.12.2014 22:20, Pablo Rodriguez napsal(a): Dear list, I have the following sample: \usemodule[scancsv] \unexpanded\def\lineaction{ \Name\ arrived on \Date\\ } \setheader \setsep{;} \setfiletoscan{mail.csv} \starttext \filelineaction \stoptext that reads data from mail.csv: Name;Date ME;11/10/14 You;05/02/14 He;15/02/2014 She;03/03/12 It;03/03/14 My question is simple (and not related to CSV data import): how can I define a command (ConTeXt or Lua) that changes date format from DD/MM/YY to DD/MM/ when required? Many thanks for your help, Pablo ___ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] expand date from CSV file
Hi Pablo, I am sending still slightly modified version (use local variables and better typographic output). It use of much variables, but at least it is clear how it works. For solution occurred me to use parsing function that I have been defined in the library, so that it can be successfully used. Sincerely Jaroslav Hajtmar \usemodule[scancsv] \def\ddmm#1#2#3{% #1 - date, #2 - old separator, #3 - new separator \startlua local parsedate=thirddata.scancsv.ParseCSVLine('#1','#2'); local day=tonumber(parsedate[1]); local month=tonumber(parsedate[2]); local year=tonumber(parsedate[3]); if (year2000) then year=year+2000 end; tex.print(day..'#3'..month..'#3'..year); \stoplua } \unexpanded\def\lineaction{ \Name\ arrived on \ddmm{\Date}{/}{.\\,} \\ } % Name;Date % ME;11/10/14 % You;05/02/14 % He;15/02/2014 % She;03/03/12 % It;03/03/14 \setheader \setsep{;} \setfiletoscan{mail.csv} \starttext \filelineaction \stoptext Dne 18.12.2014 9:39, Jaroslav Hajtmar napsal(a): Hi Pablo Here is a quick solution. However, it not treat the incorrect input data, ie it requires, however, correct input, otherwise it will collapse ... Jaroslav Hajtmar \usemodule[scancsv] \def\ddmm#1#2#3{% #1 - date, #2 - old separator, #3 - new separator \startlua parsedate=thirddata.scancsv.ParseCSVLine('#1','#2'); day=tonumber(parsedate[1]); month=tonumber(parsedate[2]); year=tonumber(parsedate[3]); if (year2000) then year=year+2000 end; tex.print(day..'#3'..month..'#3'..year); \stoplua } \unexpanded\def\lineaction{ \Name\ arrived on \ddmm{\Date}{/}{.} \\ } % Name;Date % ME;11/10/14 % You;05/02/14 % He;15/02/2014 % She;03/03/12 % It;03/03/14 \setheader \setsep{;} \setfiletoscan{mail.csv} \starttext \filelineaction \stoptext Dne 17.12.2014 22:20, Pablo Rodriguez napsal(a): Dear list, I have the following sample: \usemodule[scancsv] \unexpanded\def\lineaction{ \Name\ arrived on \Date\\ } \setheader \setsep{;} \setfiletoscan{mail.csv} \starttext \filelineaction \stoptext that reads data from mail.csv: Name;Date ME;11/10/14 You;05/02/14 He;15/02/2014 She;03/03/12 It;03/03/14 My question is simple (and not related to CSV data import): how can I define a command (ConTeXt or Lua) that changes date format from DD/MM/YY to DD/MM/ when required? Many thanks for your help, Pablo ___ 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 : http://foundry.supelec.fr/projects/contextrev/ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] expand date from CSV file
On Thu, Dec 18 2014, Jaroslav Hajtmar wrote: if (year2000) then year=year+2000 end; Hi, What about Test;11/11/1999 ... ;-) -- Peter ___ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] expand date from CSV file
On 12/18/2014 01:24 PM, Jaroslav Hajtmar wrote: Hi Pablo, I am sending still slightly modified version (use local variables and better typographic output). It use of much variables, but at least it is clear how it works. For solution occurred me to use parsing function that I have been defined in the library, so that it can be successfully used. Many thanks for your reply, Jaroslav. This is exactly what I need. Many thanks for your help, Pablo \usemodule[scancsv] \def\ddmm#1#2#3{% #1 - date, #2 - old separator, #3 - new separator \startlua local parsedate=thirddata.scancsv.ParseCSVLine('#1','#2'); local day=tonumber(parsedate[1]); local month=tonumber(parsedate[2]); local year=tonumber(parsedate[3]); if (year2000) then year=year+2000 end; tex.print(day..'#3'..month..'#3'..year); \stoplua } \unexpanded\def\lineaction{ \Name\ arrived on \ddmm{\Date}{/}{.\\,} \\ } % Name;Date % ME;11/10/14 % You;05/02/14 % He;15/02/2014 % She;03/03/12 % It;03/03/14 \setheader \setsep{;} \setfiletoscan{mail.csv} \starttext \filelineaction \stoptext Dne 18.12.2014 9:39, Jaroslav Hajtmar napsal(a): Hi Pablo Here is a quick solution. However, it not treat the incorrect input data, ie it requires, however, correct input, otherwise it will collapse ... Jaroslav Hajtmar \usemodule[scancsv] \def\ddmm#1#2#3{% #1 - date, #2 - old separator, #3 - new separator \startlua parsedate=thirddata.scancsv.ParseCSVLine('#1','#2'); day=tonumber(parsedate[1]); month=tonumber(parsedate[2]); year=tonumber(parsedate[3]); if (year2000) then year=year+2000 end; tex.print(day..'#3'..month..'#3'..year); \stoplua } \unexpanded\def\lineaction{ \Name\ arrived on \ddmm{\Date}{/}{.} \\ } % Name;Date % ME;11/10/14 % You;05/02/14 % He;15/02/2014 % She;03/03/12 % It;03/03/14 \setheader \setsep{;} \setfiletoscan{mail.csv} \starttext \filelineaction \stoptext Dne 17.12.2014 22:20, Pablo Rodriguez napsal(a): Dear list, I have the following sample: \usemodule[scancsv] \unexpanded\def\lineaction{ \Name\ arrived on \Date\\ } \setheader \setsep{;} \setfiletoscan{mail.csv} \starttext \filelineaction \stoptext that reads data from mail.csv: Name;Date ME;11/10/14 You;05/02/14 He;15/02/2014 She;03/03/12 It;03/03/14 My question is simple (and not related to CSV data import): how can I define a command (ConTeXt or Lua) that changes date format from DD/MM/YY to DD/MM/ when required? Many thanks for your help, Pablo -- http://www.ousia.tk ___ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] expand date from CSV file
On 12/18/2014 01:37 PM, Peter Münster wrote: On Thu, Dec 18 2014, Jaroslav Hajtmar wrote: if (year2000) then year=year+2000 end; Hi, What about Test;11/11/1999 ... ;-) Hi Peter, all dates start from this year :-). Pablo -- http://www.ousia.tk ___ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] expand date from CSV file
Hi Pablo. Peter pointed out an error in my solution. Thanks Peter! His message but pointed out that in fact is not the task as simple as it seems at first glance. In fact, a lot depends on what target group for those you solve a problem resp. whether e.g. date of birth of persons. What does it mean 03/01/00? It means 1/3/1900? Or does it mean 01/03/2000? Particular job you have to deal specifically separately. It occurred to me yet following solution that respects the current year as the year when he could anyone born. E.g. 19/12/14 means a newborn soul (ie. In fact, 12/19/2014), while 01/02/15 mean old man ie. in fact 01/02/1915. For the specific case you have to modify or create the solution separately. Greetings Jaroslav Hajtmar Here is new minimal example: \usemodule[scancsv] \def\ddmm#1#2#3{% #1 - date, #2 - old separator, #3 - new separator \startlua local parsedate=thirddata.scancsv.ParseCSVLine('#1','#2'); local day=tonumber(parsedate[1]); local month=tonumber(parsedate[2]); local year=tonumber(parsedate[3]); if (year100) then % when is only two digits year format then if year=14 then % it is very young person year=year+2000 else % this person has more than one hundred years year=year+1900; end; end; tex.print(day..'#3'..month..'#3'..year); \stoplua } \unexpanded\def\lineaction{ \Name\ born \Date\quad (\ddmm{\Date}{/}{.\\,}) \\ } % Content of CSV file: % Name;Date % ME;11/10/14 % You;05/02/14 % He;15/02/2014 % She;03/03/12 % It;03/03/14 % A;11/11/1999 % B;01/2/1964 % C;02/3/23 % D;03/4/64 % E;04/5/00 % F;05/6/01 % G;05/7/15 % H;05/7/1915 % Test0;1/2/00 % Test1;1/2/01 % Test2;1/2/02 % Test3;1/2/03 % Test4;1/2/04 % Test5;1/2/05 % Test6;1/2/06 % Test7;1/2/07 % Test8;1/2/08 % Test9;1/2/09 % Test10;1/2/10 % Test11;1/2/11 % Test12;1/2/12 % Test13;1/2/13 % Test14;1/2/14 % Test15;1/2/15 % Test16;1/2/16 % Test17;1/2/17 % Test18;1/2/18 % Test19;1/2/19 % Test20;1/2/20 \setheader \setsep{;} \setfiletoscan{mail.csv} \starttext \filelineaction \stoptext Dne 18.12.2014 19:07, Pablo Rodriguez napsal(a): On 12/18/2014 01:24 PM, Jaroslav Hajtmar wrote: Hi Pablo, I am sending still slightly modified version (use local variables and better typographic output). It use of much variables, but at least it is clear how it works. For solution occurred me to use parsing function that I have been defined in the library, so that it can be successfully used. Many thanks for your reply, Jaroslav. This is exactly what I need. Many thanks for your help, Pablo \usemodule[scancsv] \def\ddmm#1#2#3{% #1 - date, #2 - old separator, #3 - new separator \startlua local parsedate=thirddata.scancsv.ParseCSVLine('#1','#2'); local day=tonumber(parsedate[1]); local month=tonumber(parsedate[2]); local year=tonumber(parsedate[3]); if (year2000) then year=year+2000 end; tex.print(day..'#3'..month..'#3'..year); \stoplua } \unexpanded\def\lineaction{ \Name\ arrived on \ddmm{\Date}{/}{.\\,} \\ } % Name;Date % ME;11/10/14 % You;05/02/14 % He;15/02/2014 % She;03/03/12 % It;03/03/14 \setheader \setsep{;} \setfiletoscan{mail.csv} \starttext \filelineaction \stoptext Dne 18.12.2014 9:39, Jaroslav Hajtmar napsal(a): Hi Pablo Here is a quick solution. However, it not treat the incorrect input data, ie it requires, however, correct input, otherwise it will collapse ... Jaroslav Hajtmar \usemodule[scancsv] \def\ddmm#1#2#3{% #1 - date, #2 - old separator, #3 - new separator \startlua parsedate=thirddata.scancsv.ParseCSVLine('#1','#2'); day=tonumber(parsedate[1]); month=tonumber(parsedate[2]); year=tonumber(parsedate[3]); if (year2000) then year=year+2000 end; tex.print(day..'#3'..month..'#3'..year); \stoplua } \unexpanded\def\lineaction{ \Name\ arrived on \ddmm{\Date}{/}{.} \\ } % Name;Date % ME;11/10/14 % You;05/02/14 % He;15/02/2014 % She;03/03/12 % It;03/03/14 \setheader \setsep{;} \setfiletoscan{mail.csv} \starttext \filelineaction \stoptext Dne 17.12.2014 22:20, Pablo Rodriguez napsal(a): Dear list, I have the following sample: \usemodule[scancsv] \unexpanded\def\lineaction{ \Name\ arrived on \Date\\ } \setheader \setsep{;} \setfiletoscan{mail.csv} \starttext \filelineaction \stoptext that reads data from mail.csv: Name;Date ME;11/10/14 You;05/02/14 He;15/02/2014 She;03/03/12 It;03/03/14 My question is simple (and not related to CSV data import): how can I define a command (ConTeXt or Lua) that changes date format from DD/MM/YY to DD/MM/ when required? Many thanks for your help, Pablo ___ If your question is of interest to others
[NTG-context] expand date from CSV file
Dear list, I have the following sample: \usemodule[scancsv] \unexpanded\def\lineaction{ \Name\ arrived on \Date\\ } \setheader \setsep{;} \setfiletoscan{mail.csv} \starttext \filelineaction \stoptext that reads data from mail.csv: Name;Date ME;11/10/14 You;05/02/14 He;15/02/2014 She;03/03/12 It;03/03/14 My question is simple (and not related to CSV data import): how can I define a command (ConTeXt or Lua) that changes date format from DD/MM/YY to DD/MM/ when required? Many thanks for your help, Pablo -- http://www.ousia.tk ___ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] Date format problems
Hi all, I started using ConteXt a while ago, on the side line I still use LaTeX (old habits die hard). When converting my CV to ConTeXt I have a weird date problem. I hope one of you can point me in the right direction. I copy the start of the document from vi (line 4 is the relevant line): \setuppapersize[A4] 2 \setuplayout[style=\ss] 3 %\setupfooter[style=] 4 \setuplanguage[nl][date={dd, -, mm, -, year}] 5 6 \setupheadertexts[CV Guus Bonnema] 7 \setupfootertexts[\currentdate][pagenumber] 8 9 %\definebodyfont[10pt][ss][tfe=lbr at 105pt] 10 Line 4 is the relevant line here. What I expect to see in the footer is a date like either 29-07-2014 or 29 july 2014, but what I get is July 29, 2014. Also the log seems to indicate language en. What can I do to get the dutch date format? Regards, Guus Bonnema. ___ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Date format problems
Am 29.07.2014 10:02, schrieb A.J. Bonnema: I started using ConteXt a while ago, on the side line I still use LaTeX (old habits die hard). When converting my CV to ConTeXt I have a weird date problem. I hope one of you can point me in the right direction. I copy the start of the document from vi (line 4 is the relevant line): \setuppapersize[A4] 2 \setuplayout[style=\ss] 3 %\setupfooter[style=] 4 \setuplanguage[nl][date={dd, -, mm, -, year}] \mainlanguage[nl] Herbert 5 6 \setupheadertexts[CV Guus Bonnema] 7 \setupfootertexts[\currentdate][pagenumber] 8 9 %\definebodyfont[10pt][ss][tfe=lbr at 105pt] 10 Line 4 is the relevant line here. What I expect to see in the footer is a date like either 29-07-2014 or 29 july 2014, but what I get is July 29, 2014. Also the log seems to indicate language en. What can I do to get the dutch date format? ___ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Date format problems
On 07/29/2014 11:14 AM, Herbert Voss wrote: Am 29.07.2014 10:02, schrieb A.J. Bonnema: I started using ConteXt a while ago, on the side line I still use LaTeX (old habits die hard). When converting my CV to ConTeXt I have a weird date problem. I hope one of you can point me in the right direction. I copy the start of the document from vi (line 4 is the relevant line): \setuppapersize[A4] 2 \setuplayout[style=\ss] 3 %\setupfooter[style=] 4 \setuplanguage[nl][date={dd, -, mm, -, year}] \mainlanguage[nl] Herbert Thanks Herbert. I editted the wiki page of Command/date to add a remark on this connection. Please check for accuracy. Guus. ___ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___