-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create a pandoc-manubot-cite filter for pandoc #99
Conversation
As of 87d1e3c, I've implemented a proof of concept pandoc filter that extracts Since it seems feasible to create this filter, I thought I'd open the idea to discussion of its merits. The main benefits are:
The downsides are:
Lines 18 to 35 in 81394c0
If we want to switch from using |
manubot/pandoc_filter/cite.py
Outdated
""" | ||
parser = argparse.ArgumentParser(description='Pandoc filter for citation by persistent identifier') | ||
parser.add_argument('target_format') | ||
parser.add_argument('--pandocversion', help='The pandoc version.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
manubot/pandoc_filter/cite.py
Outdated
--filter=pandoc-manubot-cite \ | ||
--filter pandoc-citeproc \ | ||
manubot/pandoc_filter/tests/input-with-cites.md | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a difference between --filter=
and --filter
(with a space)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No
c818c12
to
6c02ac7
Compare
@agitter would be great for you to take a look at this. Would like to move forward with merging. |
Okay, I'll try to make time Friday or Saturday. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks good to me at a high level. I don't have much knowledge about panflute and its data structures so some of the details of the AST processing are still opaque to me. Many of my questions/comments are seeking to confirm I understand the processing correctly.
README.md
Outdated
specifying --filter=pandoc-manubot-cite. | ||
|
||
positional arguments: | ||
target_format |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are the valid values? It would be helpful even if this has a help message that says "any valid Pandoc format" or something brief.
--- | ||
# yaml_metadata_block with pandoc metadata | ||
citekey-aliases: | ||
tag:meta-review: url:https://greenelab.github.io/meta-review/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this tag:meta-review:
syntax temporary to be backwards compatible? Or is this how you envision using tags/aliases in the future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
Citing pre-defined citekey aliases [@tag:meta-review; @tag:deep-review]. | ||
|
||
Citing @raw:dongbo-conversation whose metadata is already in pandoc's reference metadata. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we see this being used? Is the idea that a valid Pandoc filter can't ignore valid reference metadata if someone were to use it outside the typical Manbot workflow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea is that we should support the standard pandoc methods for defining reference metadata in addition to any manubot magic. That means we need to support metadata.bibliography
(paths to bibliography files) and metadata.references
(CSL JSON style reference metadata), since these are the standard pandoc ways to specify reference metadata.
@@ -27,14 +30,18 @@ def test_example_manuscript(manuscript): | |||
"--output-directory", | |||
str(manuscript_dir.joinpath("output")), | |||
] | |||
if skip_citations: | |||
args.append("--skip-citations") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want to test that skip citations actually skips the citation processing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really because I view manubot process
as a command we're phasing out and test takes time to write. Relying on manubot/rootstock#300 to test --skip-citations
actually works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--skip-citations
is working in https://github.com/manubot/rootstock/runs/387673500 / manubot/rootstock@49dcfcd which relies on citation-tags.tsv
.
Co-Authored-By: Anthony Gitter <agitter@users.noreply.github.com>
be5bc4e is working. see https://travis-ci.com/manubot/rootstock/builds/144231641#L855 |
@agitter I'm going to merge and address additional feedback in subsequent PRs. |
Sounds good to me. I'll look over your responses and new commits here later in the week. |
Create a pandoc filter providing manubot's cite-by-ID functionality.
Todo:
references.json
to file in addition to pandoc metadata?