Yes, something like that, although mine is written in Perl and uses YAML::PP to parse both YAML and JSON which works just fine. :-) Den lör 7 sep. 2019 00:05Denis Maier skrev: > 1. I am almost sure that Pandoc will just ignore unknown fields, at least > that's what happened (unfortunately and to my disappointment) the last time > I have tried to use non-standard fields in a style. > > 2. If you don't want to hardcode the transliteration into one of the > existing fields, the easiest solution might be to use something along the > lines of this script. > > ``` > import json > import argparse > > parser = argparse.ArgumentParser(description='Merge title and subtitle > fields in CSL JSON with custom separator') > > parser.add_argument('-f', '--from', action="store", dest="from_file") > parser.add_argument('-t', '--to', action="store", dest="to_file") > parser.add_argument('-s', '--separator', action="store", dest="separator", > default=": ") > > args = parser.parse_args() > > # Load JSON File > > with open(args.from_file, 'r') as from_file: > references = json.load(from_file) > > # Merge Title and Subtitle Fields > > for reference in references: > try: > reference['title'] = reference['title'] + args.separator + > reference['subtitle'] > reference.pop('subtitle', None) > except: > pass > > # Write results back to File > > with open(args.to_file, "w") as to_file: > json.dump(references, to_file, indent=2,ensure_ascii=False) > > ``` > > This will merge title and subtitle fields, but you can of course adapt > this to merge `title` and `title:transliteration`. (You'll need to you have > your reference data available in CSL JSON.) > > Best, > Denis > > Am Freitag, 6. September 2019 21:49:16 UTC+2 schrieb BP: >> >> Thanks everyone, especially Denis for the interesting information. Not >> what I had hoped for but kind of what I had expected. Usability with >> Pandoc→LaTeX is a must for me. I guess I could write my own code to locate >> references, look up the data, invoke something which produces a >> bibliography in HTML, then massage that HTML into something Pandoc will >> convert into LaTeX appropriately. Sounds like a lot of work though — >> although not as much as implementing a whole citation processor! >> >> Another question is whether pandoc-citeproc will ignore unknown fields or >> throw an error? If the former I can have custom fields with the separate >> original and transliterated fields, as I need for my searching purposes and >> automatically update the combined version in the official fields. If the >> latter I'll need to produce a special version for Pandoc's consumption with >> the custom fields removed, which complicates things considerably. >> >> Den ons 4 sep. 2019 09:33BPJ skrev: >> >>> Does anyone know how to handle transliterated titles and names in >>> citations, when you want to include both the transliteration and the >>> original? Does CSL have any fields for that? >>> >>> TIA, >>> >>> /bpj >>> >> -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > https://groups.google.com/d/msgid/pandoc-discuss/38609be6-0edc-4755-b2e7-6448795c907c%40googlegroups.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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhD1Yk6diC3RVC4SnSyEx9avVOto0nX3ZzbOXqxmmzDHHA%40mail.gmail.com.