Re: Problem using formatter

Benno Schulenberg <[email protected]> Sun, 24 Jul 2022 08:42:15 +0200
Newsgroups gmane.editors.nano.general
Message-ID <[email protected]>
Op 23-07-2022 om 16:59 schreef Robert Goulding:
> And I'm guessing this is because pandoc sends the converted text to stdout. But
> according to the nanorc manpage, the formatter command sends the buffer to a
> temporary file, executes the command on the file, and then replaces the buffer
> with the modified file. But of course pandoc does not alter the file. It could be
> told to, with the output file option (-o) -- but how would I do that?

If the formatter program is unable to actually replace the file (that is:
doesn't know an option like sed's --in-place), then you'll have to write
a little wrapper script.  For example:

  #!/bin/sh
  pandoc [other options] -o $1.formatted $1 &&
    mv $1.formatted $1

Benno
OpenPGP_signature (application/pgp-signature, 840 B) - not displayed