Help on docx export

I could use some more help from the scripting wizards on this forum :wink:

I have a postprocessing script that does a few replacements and then calls pandoc in the form:

[code]/bin/sh
perl -pe
s/([[^[]]?@\w+.?])\s+./$1./g; # delete extra space
s/\S\K(?=[[^[]]?@\w+.?])/ /g; # add missing space before citation

… some other things here

’ $1 | pandoc -t latex -o $2
[/code]

This works fine. However, when, instead of latex, I specify -t docx , I get an error that “option `-o’ requires an argument FILE”.

I have then tried to specify per the Scrivener manual -o <$outputname>.docx in the Arguments field instead of in the script. This runs but it doesn’t produce the Word file. What am I doing wrong?

What does your arguments field look like? From how you have the script set up, I would expect to see:

<$inputfile> <$outputname>.docx

That would be two arguments, the first being used before the pipe with the Perl one-liners, the second argument used to instruct Pandoc on where to save the file.

It kind of sounds like you have something like this typed in:

<$inputfile> -o <$outputname.docx>

In that case $2 == “-o”. :slight_smile:

Indeed … apparently I still have trouble counting to three. :smiley: