ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Is it possible to set the output file name in the script
@ 2013-04-26 15:34 Cecil Westerhof
  2013-04-26 16:12 ` Hans Hagen
  0 siblings, 1 reply; 11+ messages in thread
From: Cecil Westerhof @ 2013-04-26 15:34 UTC (permalink / raw)
  To: mailing list for ConTeXt users

I am using a command line parameter to change the generated output. Is
it also possible to set the output file name depending on the
parameter?

-- 
Cecil Westerhof
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Is it possible to set the output file name in the script
  2013-04-26 15:34 Is it possible to set the output file name in the script Cecil Westerhof
@ 2013-04-26 16:12 ` Hans Hagen
  2013-04-26 16:50   ` Cecil Westerhof
  0 siblings, 1 reply; 11+ messages in thread
From: Hans Hagen @ 2013-04-26 16:12 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 4/26/2013 5:34 PM, Cecil Westerhof wrote:
> I am using a command line parameter to change the generated output. Is
> it also possible to set the output file name depending on the
> parameter?

--result=somename


-----------------------------------------------------------------
                                           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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Is it possible to set the output file name in the script
  2013-04-26 16:12 ` Hans Hagen
@ 2013-04-26 16:50   ` Cecil Westerhof
  2013-04-26 16:55     ` Hans Hagen
  0 siblings, 1 reply; 11+ messages in thread
From: Cecil Westerhof @ 2013-04-26 16:50 UTC (permalink / raw)
  To: mailing list for ConTeXt users

2013/4/26 Hans Hagen <pragma@wxs.nl>:
> On 4/26/2013 5:34 PM, Cecil Westerhof wrote:
>>
>> I am using a command line parameter to change the generated output. Is
>> it also possible to set the output file name depending on the
>> parameter?
>
>
> --result=somename

That is on the command line. Then you need to give two parameters. Not
a very big problem, but I would prefer one parameter. I like DRY. Less
that can go wrong.
-- 
Cecil Westerhof
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Is it possible to set the output file name in the script
  2013-04-26 16:50   ` Cecil Westerhof
@ 2013-04-26 16:55     ` Hans Hagen
  2013-04-26 17:01       ` Cecil Westerhof
  0 siblings, 1 reply; 11+ messages in thread
From: Hans Hagen @ 2013-04-26 16:55 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 4/26/2013 6:50 PM, Cecil Westerhof wrote:
> 2013/4/26 Hans Hagen <pragma@wxs.nl>:
>> On 4/26/2013 5:34 PM, Cecil Westerhof wrote:
>>>
>>> I am using a command line parameter to change the generated output. Is
>>> it also possible to set the output file name depending on the
>>> parameter?
>>
>>
>> --result=somename
>
> That is on the command line. Then you need to give two parameters. Not
> a very big problem, but I would prefer one parameter. I like DRY. Less
> that can go wrong.

not possible but you can access the outputfilename at the tex and lua end

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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Is it possible to set the output file name in the script
  2013-04-26 16:55     ` Hans Hagen
@ 2013-04-26 17:01       ` Cecil Westerhof
  2013-04-26 17:12         ` Hans Hagen
  0 siblings, 1 reply; 11+ messages in thread
From: Cecil Westerhof @ 2013-04-26 17:01 UTC (permalink / raw)
  To: mailing list for ConTeXt users

2013/4/26 Hans Hagen <pragma@wxs.nl>:
> On 4/26/2013 6:50 PM, Cecil Westerhof wrote:
>>
>> 2013/4/26 Hans Hagen <pragma@wxs.nl>:
>>>
>>> On 4/26/2013 5:34 PM, Cecil Westerhof wrote:
>>>>
>>>>
>>>> I am using a command line parameter to change the generated output. Is
>>>> it also possible to set the output file name depending on the
>>>> parameter?
>>>
>>>
>>>
>>> --result=somename
>>
>>
>> That is on the command line. Then you need to give two parameters. Not
>> a very big problem, but I would prefer one parameter. I like DRY. Less
>> that can go wrong.
>
>
> not possible but you can access the outputfilename at the tex and lua end

What do mean with that?

-- 
Cecil Westerhof
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Is it possible to set the output file name in the script
  2013-04-26 17:01       ` Cecil Westerhof
@ 2013-04-26 17:12         ` Hans Hagen
       [not found]           ` <CAG-LmmC2vTov3V6+GoUuGxgkoU7MXZu2-K=k07ajxbZZY2DGfg@mail.gmail.com>
  0 siblings, 1 reply; 11+ messages in thread
From: Hans Hagen @ 2013-04-26 17:12 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 4/26/2013 7:01 PM, Cecil Westerhof wrote:
> 2013/4/26 Hans Hagen <pragma@wxs.nl>:
>> On 4/26/2013 6:50 PM, Cecil Westerhof wrote:
>>>
>>> 2013/4/26 Hans Hagen <pragma@wxs.nl>:
>>>>
>>>> On 4/26/2013 5:34 PM, Cecil Westerhof wrote:
>>>>>
>>>>>
>>>>> I am using a command line parameter to change the generated output. Is
>>>>> it also possible to set the output file name depending on the
>>>>> parameter?
>>>>
>>>>
>>>>
>>>> --result=somename
>>>
>>>
>>> That is on the command line. Then you need to give two parameters. Not
>>> a very big problem, but I would prefer one parameter. I like DRY. Less
>>> that can go wrong.
>>
>>
>> not possible but you can access the outputfilename at the tex and lua end
>
> What do mean with that?

just grep for outputfile in lua and mkiv files

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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Fwd: Is it possible to set the output file name in the script
       [not found]           ` <CAG-LmmC2vTov3V6+GoUuGxgkoU7MXZu2-K=k07ajxbZZY2DGfg@mail.gmail.com>
@ 2013-04-26 19:08             ` Cecil Westerhof
  2013-04-26 19:49               ` Cecil Westerhof
  0 siblings, 1 reply; 11+ messages in thread
From: Cecil Westerhof @ 2013-04-26 19:08 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Again to Hans instead of to the list. I ‘hate’ gmail.


---------- Forwarded message ----------
From: Cecil Westerhof <cldwesterhof@gmail.com>
Date: 2013/4/26
Subject: Re: [NTG-context] Is it possible to set the output file name
in the script
To: Hans Hagen <pragma@wxs.nl>


2013/4/26 Hans Hagen <pragma@wxs.nl>:
> On 4/26/2013 7:01 PM, Cecil Westerhof wrote:
>>
>> 2013/4/26 Hans Hagen <pragma@wxs.nl>:
>>>
>>> On 4/26/2013 6:50 PM, Cecil Westerhof wrote:
>>>>
>>>>
>>>> 2013/4/26 Hans Hagen <pragma@wxs.nl>:
>>>>>
>>>>>
>>>>> On 4/26/2013 5:34 PM, Cecil Westerhof wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>> I am using a command line parameter to change the generated output. Is
>>>>>> it also possible to set the output file name depending on the
>>>>>> parameter?
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --result=somename
>>>>
>>>>
>>>>
>>>> That is on the command line. Then you need to give two parameters. Not
>>>> a very big problem, but I would prefer one parameter. I like DRY. Less
>>>> that can go wrong.
>>>
>>>
>>>
>>> not possible but you can access the outputfilename at the tex and lua end
>>
>>
>> What do mean with that?
>
>
> just grep for outputfile in lua and mkiv files

I have now (I need to use jobfilename, because I get an error when I
use outputfilename):
    \def\outputfilename{\jobfilename -\getvariable{meta}{type}}
    \def\outputfilenametwo{\jobfilename -\getvariable{meta}{type}}

When displaying outputfilenametwo I see that it is filled with the
correct value, but the output is still written to the same file.

--
Cecil Westerhof


-- 
Cecil Westerhof
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Is it possible to set the output file name in the script
  2013-04-26 19:08             ` Fwd: " Cecil Westerhof
@ 2013-04-26 19:49               ` Cecil Westerhof
  2013-04-26 20:07                 ` Cecil Westerhof
  2013-04-26 20:24                 ` Peter Münster
  0 siblings, 2 replies; 11+ messages in thread
From: Cecil Westerhof @ 2013-04-26 19:49 UTC (permalink / raw)
  To: mailing list for ConTeXt users

2013/4/26 Cecil Westerhof <cldwesterhof@gmail.com>:
> 2013/4/26 Hans Hagen <pragma@wxs.nl>:
>> On 4/26/2013 7:01 PM, Cecil Westerhof wrote:
>>>
>>> 2013/4/26 Hans Hagen <pragma@wxs.nl>:
>>>>
>>>> On 4/26/2013 6:50 PM, Cecil Westerhof wrote:
>>>>>
>>>>>
>>>>> 2013/4/26 Hans Hagen <pragma@wxs.nl>:
>>>>>>
>>>>>>
>>>>>> On 4/26/2013 5:34 PM, Cecil Westerhof wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> I am using a command line parameter to change the generated output. Is
>>>>>>> it also possible to set the output file name depending on the
>>>>>>> parameter?
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --result=somename
>>>>>
>>>>>
>>>>>
>>>>> That is on the command line. Then you need to give two parameters. Not
>>>>> a very big problem, but I would prefer one parameter. I like DRY. Less
>>>>> that can go wrong.
>>>>
>>>>
>>>>
>>>> not possible but you can access the outputfilename at the tex and lua end
>>>
>>>
>>> What do mean with that?
>>
>>
>> just grep for outputfile in lua and mkiv files
>
> I have now (I need to use jobfilename, because I get an error when I
> use outputfilename):
>     \def\outputfilename{\jobfilename -\getvariable{meta}{type}}
>     \def\outputfilenametwo{\jobfilename -\getvariable{meta}{type}}
>
> When displaying outputfilenametwo I see that it is filled with the
> correct value, but the output is still written to the same file.

The following script does what I want:
    #!/usr/bin/env bash

    set -o errexit
    set -o nounset

    declare -r DEFAULT=cecil
    declare -r DIR=${HOME}/Documenten/CV
    declare -r FILE=CV-Cecil-Westerhof
    declare -r SCRIPTNAME=$(basename ${0})

    declare RESULT
    declare TYPE

    if [[ ${#} -ge 1 ]] ; then
      TYPE=${1}; shift
    else
      TYPE=${DEFAULT}
    fi
    readonly TYPE

    if [[ ${#} -ne 0 ]] ; then
        echo "USAGE: ${SCRIPTNAME} [TYPE]"
        exit 1
    fi

    cd ${DIR}
    RESULT=${FILE}
    if [[ ${TYPE} != ${DEFAULT} ]] ; then
        RESULT+=-${TYPE}
    fi
    readonly RESULT

    context --CVType=${TYPE} --result=${RESULT} CV-Cecil-Westerhof

There is only one problem. If I first generate the default one and
after that a specific one, the default one does not exist anymore. I
suppose that when --result is used, first the pdf with the same name
as the tex file is generated and then moved. A little nuisance, but I
can live with it.

-- 
Cecil Westerhof
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Is it possible to set the output file name in the script
  2013-04-26 19:49               ` Cecil Westerhof
@ 2013-04-26 20:07                 ` Cecil Westerhof
  2013-04-26 20:24                 ` Peter Münster
  1 sibling, 0 replies; 11+ messages in thread
From: Cecil Westerhof @ 2013-04-26 20:07 UTC (permalink / raw)
  To: mailing list for ConTeXt users

2013/4/26 Cecil Westerhof <cldwesterhof@gmail.com>:
> The following script does what I want:
>     #!/usr/bin/env bash
>
>     set -o errexit
>     set -o nounset
>
>     declare -r DEFAULT=cecil
>     declare -r DIR=${HOME}/Documenten/CV
>     declare -r FILE=CV-Cecil-Westerhof
>     declare -r SCRIPTNAME=$(basename ${0})
>
>     declare RESULT
>     declare TYPE
>
>     if [[ ${#} -ge 1 ]] ; then
>       TYPE=${1}; shift
>     else
>       TYPE=${DEFAULT}
>     fi
>     readonly TYPE
>
>     if [[ ${#} -ne 0 ]] ; then
>         echo "USAGE: ${SCRIPTNAME} [TYPE]"
>         exit 1
>     fi
>
>     cd ${DIR}
>     RESULT=${FILE}
>     if [[ ${TYPE} != ${DEFAULT} ]] ; then
>         RESULT+=-${TYPE}
>     fi
>     readonly RESULT
>
>     context --CVType=${TYPE} --result=${RESULT} CV-Cecil-Westerhof
>
> There is only one problem. If I first generate the default one and
> after that a specific one, the default one does not exist anymore. I
> suppose that when --result is used, first the pdf with the same name
> as the tex file is generated and then moved. A little nuisance, but I
> can live with it.

That can be solved by renaming the tex-file to CV.tex. The script is now:
    #!/usr/bin/env bash

    set -o errexit
    set -o nounset

    declare -r DEFAULT=cecil
    declare -r DIR=${HOME}/Documenten/CV
    declare -r FILE=CV
    declare -r SCRIPTNAME=$(basename ${0})

    declare RESULT=CV-Cecil-Westerhof
    declare TYPE

    if [[ ${#} -ge 1 ]] ; then
      TYPE=${1}; shift
    else
      TYPE=${DEFAULT}
    fi
    readonly TYPE

    if [[ ${#} -ne 0 ]] ; then
        echo "USAGE: ${SCRIPTNAME} [TYPE]"
        exit 1
    fi

    cd ${DIR}
    if [[ ${TYPE} != ${DEFAULT} ]] ; then
        RESULT+=-${TYPE}
    fi
    readonly RESULT

    context --CVType=${TYPE} --result=${RESULT} ${FILE}

-- 
Cecil Westerhof
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Is it possible to set the output file name in the script
  2013-04-26 19:49               ` Cecil Westerhof
  2013-04-26 20:07                 ` Cecil Westerhof
@ 2013-04-26 20:24                 ` Peter Münster
  2013-04-26 20:40                   ` Cecil Westerhof
  1 sibling, 1 reply; 11+ messages in thread
From: Peter Münster @ 2013-04-26 20:24 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Fri, Apr 26 2013, Cecil Westerhof wrote:

> The following script does what I want:

Or shorter:

--8<---------------cut here---------------start------------->8---
#!/usr/bin/env bash
context --result=cv-${1:-cecil} CV-Cecil-Westerhof
--8<---------------cut here---------------end--------------->8---

In CV-Cecil-Westerhof.tex you can check the result file:

--8<---------------cut here---------------start------------->8---
\starttext
output file: \systemparameter{file} or \cldcontext{document.arguments.result}
\stoptext
--8<---------------cut here---------------end--------------->8---


> There is only one problem. If I first generate the default one and
> after that a specific one, the default one does not exist anymore.

A known bug: http://www.ntg.nl/pipermail/ntg-context/2008/035125.html

You could add it to the tracker: http://tracker.luatex.org/

-- 
           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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Is it possible to set the output file name in the script
  2013-04-26 20:24                 ` Peter Münster
@ 2013-04-26 20:40                   ` Cecil Westerhof
  0 siblings, 0 replies; 11+ messages in thread
From: Cecil Westerhof @ 2013-04-26 20:40 UTC (permalink / raw)
  To: mailing list for ConTeXt users

2013/4/26 Peter Münster <pmlists@free.fr>:
> On Fri, Apr 26 2013, Cecil Westerhof wrote:
>
>> The following script does what I want:
>
> Or shorter:
>
> --8<---------------cut here---------------start------------->8---
> #!/usr/bin/env bash
> context --result=cv-${1:-cecil} CV-Cecil-Westerhof
> --8<---------------cut here---------------end--------------->8---

Nope, when the parameter is cecil, I want to add nothing. Also I am a
little paranoid, so I want the script to not execute when there are to
many parameters.


>> There is only one problem. If I first generate the default one and
>> after that a specific one, the default one does not exist anymore.
>
> A known bug: http://www.ntg.nl/pipermail/ntg-context/2008/035125.html
>
> You could add it to the tracker: http://tracker.luatex.org/

I already went around it. But it would not hurt to report it.

-- 
Cecil Westerhof
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2013-04-26 20:40 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-26 15:34 Is it possible to set the output file name in the script Cecil Westerhof
2013-04-26 16:12 ` Hans Hagen
2013-04-26 16:50   ` Cecil Westerhof
2013-04-26 16:55     ` Hans Hagen
2013-04-26 17:01       ` Cecil Westerhof
2013-04-26 17:12         ` Hans Hagen
     [not found]           ` <CAG-LmmC2vTov3V6+GoUuGxgkoU7MXZu2-K=k07ajxbZZY2DGfg@mail.gmail.com>
2013-04-26 19:08             ` Fwd: " Cecil Westerhof
2013-04-26 19:49               ` Cecil Westerhof
2013-04-26 20:07                 ` Cecil Westerhof
2013-04-26 20:24                 ` Peter Münster
2013-04-26 20:40                   ` Cecil Westerhof

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).