walle / gimli

Utility for converting markup files to pdf files
https://github.com/walle/gimli
MIT License
538 stars 44 forks source link

add support for a simple json ordering file #75

Closed sporritt closed 6 years ago

sporritt commented 8 years ago

Hi

I'm opening this as a PR primarily because it makes it easy to look at the individual changes, but I know that what I've currently got is a little rough around the edges and likely would need polishing if you wanted to merge.

I had a directory of .md files - the jsPlumb docs - from which I wanted to create a PDF. This tool made that very easy, but I couldn't see a way to control the ordering of the files (other than perhaps renaming them all) in the output PDF. So I added support for a JSON file consisting of a single array of file names (without extension):

[
  "foo",
  "bar",
  "baz"
]

It's expected to be called (hardcoded right now) order.json, and to be found in the current directory. Also another piece of behaviour that is hardcoded is that if a particular file is not listed in the ordering file, it is excluded from the PDF output.

Anyway - just wanted to float this idea past you. If you want to pursue it let me know and we can chat about what needs to happen to tighten it up.

walle commented 8 years ago

Hi @sporritt i'm sorry it has taken so long to reply to this. I haven't had time to look at it. Hopefully I get some time this weekend.

I'm not sure, but I think this functionality is already in place, I remember something about a pull request adding this a while back.

You could test invoking gimli with

$ gimli -f foo.md bar.md baz.md

to get the ordering correct. If this does not work I'll try to take a look at it this weekend.

sporritt commented 8 years ago

no problem on the delay. i dont know if ordering is supported on the command line already; i didn't try it....i have quite a few files and writing them all out on the command line each time would not be very appealing. having a single artefact where i can manage the order of files is a lot more manageable.

sporritt commented 6 years ago

oh well