Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add template variables for source and destination filename #3439

Merged
merged 1 commit into from
Feb 25, 2017

Conversation

rohieb
Copy link
Contributor

@rohieb rohieb commented Feb 12, 2017

see #3431

@rohieb rohieb force-pushed the issue/3431-add-filename-template-vars branch 2 times, most recently from 5145790 to 9a3b112 Compare February 12, 2017 23:49
@rohieb rohieb changed the title WIP: add template variables for source and destination filename add template variables for source and destination filename Feb 12, 2017
@rohieb rohieb force-pushed the issue/3431-add-filename-template-vars branch from 9a3b112 to c9bc4eb Compare February 12, 2017 23:50
@jgm
Copy link
Owner

jgm commented Feb 22, 2017

I'd prefer:

  • sourcefile, a list of the input file names (empty if stdin)
  • outputfile, the output file name

If you want to have it print (stdin), this can be done with a conditional in the template.

$if(sourcefile)$
$for(sourcefile)$
$sourcefile$
$endfor$
$else$
(stdin)
$endif$

What do you think?

@rohieb rohieb force-pushed the issue/3431-add-filename-template-vars branch from c9bc4eb to d488dc9 Compare February 24, 2017 23:28
@rohieb
Copy link
Contributor Author

rohieb commented Feb 24, 2017

Yes, this makes the code simpler, and simplicity is always a good idea. I've allowed myself to put your template snippet into the manual as an example how to handle the variables.

Looking at the tests, I find it a bit annoying that conversion to markdown now writes the sourcefile and outputfile into the Markdown output – I really only had intended them to be used in user-defined templates. What do you think, does that bother you?

@rohieb
Copy link
Contributor Author

rohieb commented Feb 25, 2017

(see Travis log, L705)

@jgm
Copy link
Owner

jgm commented Feb 25, 2017 via email

@rohieb
Copy link
Contributor Author

rohieb commented Feb 25, 2017 via email

@jgm
Copy link
Owner

jgm commented Feb 25, 2017

No, you did the right thing. I jumped to conclusions from the travis output, but in fact this seems to point to a bug somewhere else... I'll investigate.

jgm added a commit that referenced this pull request Feb 25, 2017
This allows us to add the variables AFTER using the metadata
to generate a YAML header (in the Markdown writer).

Addresses the problem shown by
https://travis-ci.org/jgm/pandoc/jobs/205154181#L705

See #3439
@jgm
Copy link
Owner

jgm commented Feb 25, 2017

OK, this should be fixed now.

@jgm jgm merged commit 699d289 into jgm:master Feb 25, 2017
@jgm
Copy link
Owner

jgm commented Feb 25, 2017

I fixed a few more things with subsequent commits. Glad you unearthed that bug; the Markdown writer was leaking variables in metadata blocks.

@rohieb
Copy link
Contributor Author

rohieb commented Feb 26, 2017

Happy to help 😄 But more importantly, happy for your help and patience, @jgm and @mb21! This was a great opportunity for me to get to know Haskell and pandoc more 😃

@rohieb rohieb deleted the issue/3431-add-filename-template-vars branch February 26, 2017 02:08
@jgm
Copy link
Owner

jgm commented Feb 26, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants