ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <j.hagen@xs4all.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>,
	Rudolf Bahr <quasi@quasi.de>
Subject: Re: Exchangeing content of variables between luacode and context
Date: Wed, 20 Nov 2019 09:24:44 +0100	[thread overview]
Message-ID: <d22c68d0-4b0a-4bb0-dfca-3f9dd548d3de@xs4all.nl> (raw)
In-Reply-To: <20191119193426.GA32147@nan>

On 11/19/2019 8:34 PM, Rudolf Bahr wrote:

> My 'actual problem' is more or less a design problem: Should in a book project
> ConTeXt be the master and Luacode the slave or vice versa? Both seems possible.

nearly always context is th emaster (it is anyway as it manages the 
process)

> The task to solve is to set a photo album with say 300 DIN A4 landscape pages.
> On every page there should be 1 to 4 columns filled with photos and texts mostly
> defined in layers.
> 
> Up to now I made all in ConTeXt manually by trying, for instance::
> - To estimate the width of layers, if neighboured layers should contain photos of
>    same height with respect to center horizontally all columns at end of page.

can be done in tex of lua

> - To complete abbreviations of long picture names; it's rather annoying doing
>    this by copy and paste with hundreds of photo names; instead I'd like to type
>    a short code and Luacode should complete it to the full name.

that can be done runtime ...

> - To estimate the shift amount of all columns together in order to horizontally
>    get them centered on the page.

can be done by tex or lua

> All of these tasks can be made best by Luacode functions. And I'd like to save
> their results in the ConTeXt program permanently. With 'tokens.setters.macro()'
> it's possible only in the same, Luacode calling ConTeXt run. In the following
> run, the macro shows its original value again and the Luacode program must be
> called again to alter it.

you can store info in the tuc file (there are examplex on the wiki and 
in the test suite) or you cam create a table, save it at the end of the 
run and load it at the start

(assuming that you cannot just recalculate the values each run, but i 
assume that you have a reason for not doing that)

> So I've to think about making Luacode the master and ConTeXt the slave. Then it'd
> be possible to embody Luacode's results permanently in the ConTeXt code. Vice versa
> a solution could be to store Luacode's results in a flattened Lua table on disc.
> But the perfect relating to their ConTeXt page remains difficult when inserting
> or deleting of pages in an ensemble of 300 pages should become necessary. Another
> much simpler solution would be the proposal above, namely, to copy the ConTeXt
> program step by step and page by page to another file and introducing the Luacode
> results simultaneously.

if each page can be recognized you can make a hash of its properties and 
store the page specific data using that hash

> In [1] there is a chapter with "stepper" commands, but I didn't understand that,
> so I can't say, whether they are suitable for this issue.

unrelated

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
___________________________________________________________________________________

  parent reply	other threads:[~2019-11-20  8:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-19 13:19 Rudolf Bahr
2019-11-19 15:55 ` Wolfgang Schuster
2019-11-19 19:34   ` Rudolf Bahr
2019-11-20  6:43     ` Henning Hraban Ramm
2019-11-20  8:24     ` Hans Hagen [this message]
2019-11-20 16:57       ` Rudolf Bahr

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=d22c68d0-4b0a-4bb0-dfca-3f9dd548d3de@xs4all.nl \
    --to=j.hagen@xs4all.nl \
    --cc=ntg-context@ntg.nl \
    --cc=quasi@quasi.de \
    /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).