Hi all,
I'm trying to work way above my expertise and understanding, so you'll have to forgive me if I'm not able to express my goals as clearly as necessary.
Basically, here's what I'd like to do:
In my syllabus TBX file (shared he before), I have agents that collect reading notes and lesson plans and then an export template that spits the whole thing out for me to print nicely and use as notes in class.
The template is an envelope-style one. The agent gets this template:
Code:^value($DisplayName)^
^text^
^if(^get(ChildCount)^)^
^children(LessonPlanItem)^
While the "LessonPlanItem" merely consists of
Code:^text^
This results in me having to open up the export file in a word processor and apply light formatting.
I've been experimenting with running the whole output through Pandoc (essentially similar to a Markdown script). I couldn't figure out how to do that, mostly because I'm not really all that proficient at command line stuff--I just cut and paste from examples and cross my fingers!
I did, however, manage to cobble together a solution via Automator. I created a workflow that:
1. Gets specified finder file (the export file created by TBX)
2. Runs shell script:
Code:PATH=$HOME/.cabal/bin:/usr/local/bin:/usr/texbin:$PATH
for file in "$@"
do
output=${file%%.*}.docx
pandoc --smart "$file" -o "$output"
done
echo "$output"
PS: I copied this code from elsewhere, so I only have a limited understanding of how or why it works. I understand all the Pandoc options (e.g., --smart sets all the typography to smart quotes) but not the scripting.
3. Opens Finder item (which results in MS Word opening the newly created "export file.docx" in Word.
This lets me apply markdown formatting in TBX and end up with a properly formatted Word file--no more manual messing with things. I'm guessing I may have been able to create properly formatted HTML pages all along, but at this point I'm more comfortable with the whole Markdown-->Word processor workflow.
At any rate, I'm wondering whether I've added an unnecessary step by using Automator. Is there some way to call the Pandoc process through the runCommand and include that in the template itself, so that TBX itself will spit out the docx file?