ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Axel Kielhorn <tex@axelkielhorn.de>
To: "ntg-context@ntg.nl" <ntg-context@ntg.nl>
Subject: Re: XML to ConTeXt: converting date attribute from ISO date
Date: Wed, 11 Mar 2020 15:38:54 +0100	[thread overview]
Message-ID: <2FB86296-9961-4C2C-B96B-8BCFFD72A9AC@axelkielhorn.de> (raw)
In-Reply-To: <faf46a0b-2726-9dd8-d62b-8288e7fb1849@xs4all.nl>



> Am 11.03.2020 um 15:19 schrieb Hans Hagen <j.hagen@xs4all.nl>:
> 
> On 3/11/2020 3:12 PM, Axel Kielhorn wrote:
>>> Am 11.03.2020 um 15:01 schrieb Hans Hagen <j.hagen@xs4all.nl>:
>>> 
>>> 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
___________________________________________________________________________________

  parent reply	other threads:[~2020-03-11 14:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-30 14:17 Outputting custom types in MKiv bibliography Mike O'Connor
2016-05-05  8:39 ` luigi scarso
2018-08-15 10:27 ` XML to ConTeXt: converting date attribute from ISO date Mike O'Connor
2018-08-15 12:04   ` Hans Hagen
2020-03-11 13:14     ` Axel Kielhorn
2020-03-11 14:01       ` Hans Hagen
     [not found]         ` <B77FE72A-BC5E-4E34-A859-8CD860E9B978@axelkielhorn.de>
     [not found]           ` <faf46a0b-2726-9dd8-d62b-8288e7fb1849@xs4all.nl>
2020-03-11 14:38             ` Axel Kielhorn [this message]
2020-03-11 15:54               ` Axel Kielhorn
2020-03-11 19:22                 ` Hans Hagen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2FB86296-9961-4C2C-B96B-8BCFFD72A9AC@axelkielhorn.de \
    --to=tex@axelkielhorn.de \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).