Den sön 20 sep. 2020 11:04Denis Maier <denis.maier.lists-cl+VPiYnx/1AfugRpC6u6w@public.gmane.org> skrev:
Yes, that's probably right.

I'm currently in the process of figuring out the workflow. I was hoping I could away with not having too many tools involved. But maybe using an XML processing library with Python or some XSLT could be an easier solution than using pandoc filters for this. We'll see...

I don't know what, if anything the JATS writer makes of Pandoc spans and divs. Possibly you may need both one or more Pandoc filters to replace Pandoc spans and divs with raw markup which is more palatable to JATS *and* use an XML processing library. 

A benefit from using a Python XML library is that you can read in configuration from a YAML file, though obviously you can get the same benefit if you write your filters in Python instead of Lua. Also as I said earlier if the format is just one `KEY: VALUE` per line it is trivial to open the file in Lua, parse each line with a pattern `^\s*([_%w]+)\s*%:\s*(.*)` (note that `%w` does not include the underscore in Lua!) and populate a table with the captures. Note that you can put Lua libraries both in the Lua search path and in `~/.pandoc` and load them from a Lua filter!

Anyway you can probably hide away most of the ugliness in Pandoc defaults files and/or Makefiles and/or wrapper scripts. I use some Pandoc filters, pp <https://github.com/CDSoft/pp> macros (which also can convert CSV files to Markdown tables and fill in Mustache templates, as well as injecting the output of Python/Lua/shell code — I even can use Perl code through "shell" code with a suitable shebang line!) and custom LaTeX files injected into the preamble plus a similar set of tools for generating HTML from the same Markdown sources, all administered through one Pandoc defaults file per output format and a Makefile for generating sets of files or single files, with the source and target specified as Makefile variables on the command line. Thus I usually need not type a lot of command lines but typically just the make target and possibly specify a variable or two, and everything just happens, including removing temporary files if any, although I can usually just pipe everything from pp into pandoc. Usually I have one directory for files related to each output format `pdf-config`, `html-config` with the files in each dir called `pandoc.yaml`, `header.ltx`, `macros.pp.md` so the paths can be constructed by injecting a variable for the output format. The exception is CSS files which go into a `css` dir and are linked from each HTML file, and some filters (both Lua and Perl in my case) which are used for either output format which go into a `filters` directory or live in `~/.pandoc/filters/` or `~/bin/` if they are useful for multiple projects.

Well I guess most of this is obvious, but perhaps something in my workflow is useful.


Am 19.09.2020 um 21:05 schrieb BPJ:
Den lör 19 sep. 2020 13:14Denis Maier <denis.maier.lists-cl+VPiYnx/1AfugRpC6u6w@public.gmane.org> skrev:
Hi

Is it possible to set the language attribute directly on a paragraph or quotation?

The documentation gives this example:

::: {lang=fr-CA}
> Cette citation est écrite en français canadien.
:::

But, in JATS, this ends up as

<boxed-text xml:lang="fr-CA">
    <disp-quote>
      <p>Cette citation est écrite en français canadien.</p>
    </disp-quote>
  </boxed-text>

Is there a simple way to set attibute directly on a paragraph or a quotation? To get this:

    <disp-quote>
      <p xml:lang="fr-CA">Cette citation est écrite en français canadien.</p>
    </disp-quote>

Judging from this and your other recent posts you might benefit from postprocessing your JATS with an XML processing library in Perl/Python. Maybe XSLT. That would be like a Pandoc filter but you filter the XML output by pandoc rather than the Pandoc AST before the XML is generated.

Just a thought.

/bpj




Best,
Denis
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/efcd2673-1f02-fd29-c2e1-19b90f7d0ba2%40mailbox.org.
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhDsuZQVxqNP3bQAFqPHvgysG40WkgAPUtebadM27zvduA%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhD9Cvd1dY6svqCro%3DQpZEtn13T3xx8H2HAi78Z7CMq7qQ%40mail.gmail.com.