ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Aditya Mahajan <adityam@umich.edu>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: filter module / externalizing TikZ graphics
Date: Sun, 31 Jan 2021 01:39:46 -0500 (EST)	[thread overview]
Message-ID: <nycvar.YAK.7.78.908.2101310115090.831318@nqv-guvaxcnq> (raw)
In-Reply-To: <4041C61A-2ABC-4B7F-84C3-D8818BC238FF@fiee.net>

[-- Attachment #1: Type: text/plain, Size: 2943 bytes --]

On Sat, 30 Jan 2021, Henning Hraban Ramm wrote:

> >> If I use \starttikz[name=example], I get "JOBNAME-temp-tikzThick-example.tmp".
> >> I’d like to get something like "COMPONENTNAME-##-example.tmp" or a path like "COMPONENTNAME/example_##.tmp".
> >> Is there a configuration hook in the module to change name generation?
> > 
> > No. I don't quite understand the concern. How do you plan to use a `name=value` option?
> 
> The current auto-generated file names are uncomfortably long, and I’d like to know which contains what.

The idea was to avoid clash of names. That is why the file name starts with \jobname. I also want to avoid clash if you use multiple filters in the same file (a common use case for my projects), hence there is filtername. The -temp- is there because at some point context used to delete \jobname-temp-.tmp files if you passed the --purge option, but I see that it is no longer the case. Maybe that can be removed from the default name. The last part are the numbers, which are needed when caching results. 

> I’m not yet sure what would make the most sense for this project (at least sorting by chapter/component would), but I have an use case with LilyPond where I could save several LilyPond compile runs if I could influence the naming:
> 
> I got ~500 songs in their own component files, and I use them in different songbooklets with the same layout. E.g. there’s one containing all the songs and several with a subject (e.g. winter & christmas, children, medieval & fantasy, some author...).
> They all use [name=\currentcomponent]. If I could avoid the JOBNAME part of the file name, all booklets would use the same note PDFs. Now, the temp directory contains literally thousands of files.
> Since this is just for fun, the additional space and compile time is just a bit annoying and doesn’t affect others, but I like to streamline my workflows...

This is a relatively simple feature to add. I have pushed a new branch with this feature: https://github.com/adityam/filter/tree/prefix

I have added a new `prefix` option: you can use 

\defineexternalfilter[....][prefix=whatever]

and then the filter module will write the temp name as `whateverfilter0.ext` `whateverfilter1.ext`. The default value of prefix is \jobname-temp- (note trailing dash), so there should be no difference in the default output, but now you can configure the prefix if you want.

I am also open to making filter name as part of the prefix, so that you can have the ability to remove it if you wish. But I am hesitant to do so because it can lead to hard to debug errors if there is a clash in the prefix of two different filters. 

I haven't tested it beyond simple tests to make sure that nothing breaks. 
You can copy t-filter.mkiv from https://raw.githubusercontent.com/adityam/filter/prefix/t-filter.mkiv to your working directory and test if works for your situation. 


Aditya


[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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-01-31  6:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-25 15:42 Henning Hraban Ramm
2021-01-25 15:54 ` Henri Menke
2021-01-25 16:31 ` Hans Hagen
2021-01-25 16:41   ` Henning Hraban Ramm
2021-01-25 17:58     ` Aditya Mahajan
2021-01-25 19:08       ` Henning Hraban Ramm
2021-01-27 21:27         ` Henning Hraban Ramm
2021-01-28 13:51           ` filter module / " Henning Hraban Ramm
2021-01-29 23:13             ` Aditya Mahajan
2021-01-30  9:32               ` Henning Hraban Ramm
2021-01-31  6:39                 ` Aditya Mahajan [this message]
2021-03-06  8:12                   ` Henning Hraban Ramm

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=nycvar.YAK.7.78.908.2101310115090.831318@nqv-guvaxcnq \
    --to=adityam@umich.edu \
    --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).