Simple Pandoc Template

Hi Bernardo
Pandoc NEWbie
Downloaded your Simple Pandoc Template…works great (.md->.docx) for new files created within the document. 2 questions

  1. How do I create a pdf (my preference would be a one-pager as Michael has described.
  2. When I drag my files into the app, I do not get the conversion, only .md. (NB: I changed the Template to PandocPreview but that does not seem to fix it.

Thoughts and many thanks for your Pandoc work!
Tom

Tom, I don’t understand this. Which app are you talking about?

The simple Pandoc Template v 0.2.tbx Simple Pandoc Template 02.tbx (488.2 KB)

Creating new files work perfectly. If I drag a note from another Tbx document into the file, it creates the .md file but not the .docx

I am certain I probably am doing something wrong. I am using the PandocPreview as my HTMLExportTemplate

Hope that helps
Tom

Tom, if you are dragging notes from other documents, you have to apply the Markdown prototype and then use the stamp to export it. Is this what you are doing?

Yes, that is exactly what I am doing. It seems to be failing in making the call over to Word to create the .docx format.

Very weird because if I create a new document within the Simple Pandoc Template 0.2 everything works fine.

Don’t spend a lot of time on it, I just wanted to make you aware. That was my intent. I appreciate all you contributions.

Tom

I looked into this. It seems that notes being dragged are arriving not as UTF-8, but as Western (MacOS Roman). This is making Pandoc complain about invalid characters. (It seems to be the linebreaks). Perhaps @eastgate could comment on this; I mean, whether this is something to be expected or some anomaly.

Word has no part in the conversion. Pandoc is doing all the work.

From where are the notes dragged?

Hi Mark and Bernard, I am dragging the notes from another tbx document. No images, just a plain note, using the HTMLExport standard template.

Hope that helps
Tom

Same as Tom. From another Tbx file.

Does this still work? Or has Monterey/Tinderbox 9 broken something?

I spotted a couple of calls to Tinderbox 8 in the AppleScript, but it still seems not to output anything on my system after I altered those.

Cheers,
MBB.

Check paths to pandoc haven’t changed and that pandoc is installed. IIRC, pandoc isn’t installed by default in macOS, although it should survive an major OS update (i.e. from 11.x to 12.x, etc. - I happily went from 10.14 to 12).

If calls are going to the command line (e.g. runCommand), Apple changed the default Unix shell—something most users don’t know of and never touch—from bash to zsh. Why, I’ve no idea (not my area of expertise!). But, that change might affect things.

Hi Mark,

Thanks, I didn’t think to check bash/zsh. I did know it had changed, but it is not something I ever use. I’ll have another look.

Cheers,
M.

Any feedback on that welcome, as I’ll add info to aTbref if pertinent. It’s something most Mac users know not of, let alone use. I know Eastgate are checking the bash/zsh aspect re Tinderbox calling the command line. I suspect fro calling something like pandoc that it is moot as you are just passing a path. Ergo, testing pandoc’s health via some other method is a good idea too (i.e. outside Tinderbox)

Hi Mark,

@satikusala’s simplified version works fine using the sample files he provided (though there are a couple of typos in the tbx file, and it seems that using Homebrew to install Pandoc puts it in a different place – I used Pandoc’s own package installer to avoid problems). @Bernard-0’s complex version is much too complex for me to troubleshoot myself. The calls to Tindrbox 8 were easy enough to spot, but otherwise I have not the faintest idea what is going on in there …

Cheers,
M.

1 Like

Sounds like the bigger doc needs a review, which as I well know is more effort than imagined. I have great plans to review my big bank of demos from v5 era (not least as each v5 window becomes a full document window) but it’s a real sump.

The useful thing is that this thread will, if nothing else, alert others having issues with the demo. Thanks.

1 Like

FYI, Homebrew makes maintaining updates much easier.

Can you point out the typos so that we can fix them?

Sure. I’ll re-download the originals (I didn’t keep a record of what I was doing). I remember that one was just a curly brace to close the link to Google, instead of a normal “)”. (You can see that in the screenshot above.) I’ll have to get back to you as I’m just about to go out (risking everything for a Christmas present!)

1 Like

Looking again, I think that might actually be the only typo – unless perhaps “Barefones” in the filename was supposed to be “Barebones” :grinning:

Thanks for putting this together, by the way. It is a very useful demo of what can be done with Pandoc. I’ve been pondering ways of making a sort of personal wiki for some time now, and I still haven’t got an answer. This might be part of it.

Cheers,
Martin.

1 Like

Complexity, in this case, stems from different sources.

  1. Pandoc itself, as a universal markup converter, takes several arguments and has dozens of optional flags, and not all of them apply to all formats it supports. Synthesizing all of this (or most of it) in a single template takes time and knowledge of the tools. At the time, I had neither :rofl: . That is, I knew Pandoc well enough, but not Tbx; and time was scarce.
  2. The template uses Pandoc, with all its complexity, for two different tasks: preview and export. The command is not the same in these two cases, nor are the flags used.
  3. I started out trying to achieve something even more complex than I already described. I actually wanted to recreate with Tbx a workflow I had been using with Scrivener to create the final version of my Ph.D. Thesis. The reason the first version of the template had so many attributes to be passed in the YAML header is that it relied on a previously prepared LaTeX template to create a Thesis/Dissertation PDF. However, I prepared this LaTeX template in Portuguese, thinking about my colleagues, and saw no reason to translate it to English and share it along with the Tbx file, seeing that there are already many good resources for this in English (not that they would work in the same way).

I ended up settling with Scrivener, set up to export a mixture of Markdown and LaTeX. The exported file is then processed with a long Ruby script that adjusts cross-references and bibliographical citations and draws information from an Excel Spreadsheet to create a multilingual glossary. (This is not really relevant to the problem at hand, but it is where the process culminated.)


After the failed Tbx with Pandoc experience for long-text writing and with a little more knowledge of how the software works, I started using it to manage the bibliography. I think it shines in this and that is severely undervalued for this purpose. It is possible to set it up to export BibTeX for compiling with LaTeX; JSON for feeding Alfred to use it as a search tool; Markdown with metadata such as authors, editors, publishers and keywords for browsing in DEVONthink (with autolinks on); TSV for exporting metadata to any app (not this format is really needed), and so on. It is also fairly easy to keep bibliographical entries in sync with the files stored in DEVONthink and retrieving highlighted passages to Tbx and storing it as one of the entry’s attribute.

For this, of course, there is no need to work with Pandoc, so no plans to update the template for now. Also, I am sure others are already preparing better alternatives.

1 Like