pelican-plugins / pandoc-reader

Pandoc Reader is a Pelican plugin that processes Markdown content via Pandoc
11 stars 3 forks source link

Citations and single bibliography file #16

Closed reagle closed 3 years ago

reagle commented 3 years ago

First, an aside, it is not necessary to add "+citations", in PANDOC_EXTENSIONS for citations to work, as indicated in the documentation.

Second, you might note that users can include a YAML reference section as part of the markdown file.

Finally, would it be possible to designate a single file in the configuration, for example:

PANDOC_ARGS = [
    "--citeproc",
    "--bibliography=%s/joseph/readings.yaml" % HOME,
    "--mathjax",
    "--tab-stop",
    "4",
]
nandac commented 3 years ago

@reagle Could you please tell me where in the documentation it says +citations extension is not needed so that I may read it in detail and change the plugin accordingly.

Would you mind telling me what exactly is needed for citations to work. I am fairly new to Pandoc so I need some hand-holding.

I think YAML references should work although I have not tested it out.

Last but not least:

PANDOC_ARGS = [
    "--citeproc",
    "--bibliography=%s/joseph/readings.yaml" % HOME,
    "--mathjax",
    "--tab-stop",
    "4",
]

Should work although I would specify the bibliography part as:

"--bibliography={}/joseph/readings.yaml".format(HOME)"

Kindly let me know if you have issues with the above and I appreciate the feedback.

Many thanks.

reagle commented 3 years ago

In the screenshot below, it says +citations is needed and it is not. pandoc --list-extensions html tells you it is default on.

Screen Shot 2020-12-09 at 9 09 20 AM

So you can just remove that.

reagle commented 3 years ago

BTW: a f-string worked for me.

PANDOC_ARGS = [
    "--citeproc",
    f"--bibliography={HOME}/joseph/readings.yaml",
    "--mathjax",
    "--tab-stop",
    "4",
]
nandac commented 3 years ago

@reagle thank you so much for telling me about the pandoc --list-extensions command and the Python f string syntax both of which I did not know about.

I will take out the check for citations being set in the code for now and publish a new release when I get a spare moment.

Is it likely that Pandoc will ever switch off citations by default instead of keeping it on in the future?

I would like to minimize the number of Pandoc commands I run in the plugin as it tends to slow down processing which is one way that I can ensure that it is always on.

reagle commented 3 years ago

Is it likely that Pandoc will ever switch off citations by default instead of keeping it on in the future?

I don't think so. At some point, Pandoc will move to assuming CommonMark is the default input type (rather than Pandoc's own markdown variant) but for most things they will be similar and +citations is the default there too.

nandac commented 3 years ago

@reagle I have just published a new version of the plugin that does not require the need to specify the citations extension. I have also provided a link to your script in the README to convert pelican metadata to pandoc metadata.