ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Pablo Rodriguez via ntg-context <ntg-context@ntg.nl>
To: "Michal Vlasák via ntg-context" <ntg-context@ntg.nl>
Cc: Pablo Rodriguez <oinos@gmx.es>
Subject: Re: setting date in \setupinteraction
Date: Tue, 19 Oct 2021 20:51:02 +0200	[thread overview]
Message-ID: <607946f5-9f4c-a4f4-c056-0edd75e3300a@gmx.es> (raw)
In-Reply-To: <CF3ITRMESQWS.2KUDQQPR2XL84@deimos>

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
___________________________________________________________________________________

  reply	other threads:[~2021-10-19 18:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-19 15:47 Pablo Rodriguez via ntg-context
2021-10-19 16:23 ` Michal Vlasák via ntg-context
2021-10-19 18:51   ` Pablo Rodriguez via ntg-context [this message]
2021-10-19 20:38     ` Michal Vlasák via ntg-context
2021-10-20 14:02       ` Hans Hagen via ntg-context
2021-10-21 16:38         ` Pablo Rodriguez via ntg-context

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=607946f5-9f4c-a4f4-c056-0edd75e3300a@gmx.es \
    --to=ntg-context@ntg.nl \
    --cc=oinos@gmx.es \
    /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).