Skip to content
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

Localizing parts of citations #122

Closed
ghost opened this issue Oct 27, 2022 · 5 comments
Closed

Localizing parts of citations #122

ghost opened this issue Oct 27, 2022 · 5 comments

Comments

@ghost
Copy link

ghost commented Oct 27, 2022

From: citation-style-language/locales#273

Would it be possible somehow to localize ie placenames or thesis genres of citations? One suggestion mentions a pandoc filter, but afaik a pandoc lua filter would only have access to contents of a citation, not knowing necesarily which tokens are up to be localized.

@jgm
Copy link
Owner

jgm commented Oct 27, 2022

Like the CSL people, I'd say this is out of scope.
Note that if you store your references in the metadata of a pandoc markdown document, you could use a pandoc filter to modify some of the metadata fields (e.g. publisher-place). Or, if you use a separate bibliography, you could use pandoc + a lua filter to create a new bibliography with modified fields.

@ghost
Copy link
Author

ghost commented Oct 28, 2022

Thanks for the quick reply. I store my references in a separate YAML file. I see I can access references and their fields with pandoc.utils.references(doc).

Do filters have any access to csl data? That way I could store localization data inside the csl xml ie:

<locale xml:lang="sl">
  <terms>
    <term name="Rome">Rim</term>
  </terms>
</locale>

@jgm
Copy link
Owner

jgm commented Oct 28, 2022

Do filters have any access to csl data?

No. (Though you can always use a Lua xml library and parse the csl yourself.)

@jgm jgm closed this as completed Oct 28, 2022
@badumont
Copy link

badumont commented Oct 28, 2022 via email

@ghost
Copy link
Author

ghost commented Oct 28, 2022

You can also set these variables in a YAML file and pass it along with your input files on the command line:

--- localized-terms: - en: Rome la: Roma de: Röm - en: London la: Londinium de: London --- So you will be able to access them directly in the Metadata table.

Thanks! Maybe I'll do that, I think pandoc-quotes.lua also does something similar for translating typographic quotemarks. (Although it would be nice to have both placenames and quotemarks localization data contained within the csl file.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants