public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: Denis Maier <maier.de-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Re: Transliterated and original titles/names in citations
Date: Fri, 6 Sep 2019 15:04:38 -0700 (PDT)	[thread overview]
Message-ID: <38609be6-0edc-4755-b2e7-6448795c907c@googlegroups.com> (raw)
In-Reply-To: <CADAJKhAd8iPOD=-gaZn_7-03t07HjSTq0SiH9Bq=HJ=ymtSU1A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>


[-- Attachment #1.1: Type: text/plain, Size: 3298 bytes --]

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 <mel...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <javascript:>> 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.

[-- Attachment #1.2: Type: text/html, Size: 4755 bytes --]

  parent reply	other threads:[~2019-09-06 22:04 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-04  7:33 BPJ
     [not found] ` <0c05fcec-fbb7-aed6-c1ec-e84610bcdd96-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-09-04  8:53   ` Paulo Ney de Souza
2019-09-04 10:19   ` Denis Maier
2019-09-04 12:01   ` Joseph Reagle
2019-09-06 19:49   ` BPJ
     [not found]     ` <CADAJKhAd8iPOD=-gaZn_7-03t07HjSTq0SiH9Bq=HJ=ymtSU1A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-09-06 21:02       ` John MacFarlane
2019-09-06 22:04       ` Denis Maier [this message]
     [not found]         ` <38609be6-0edc-4755-b2e7-6448795c907c-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2019-09-07  8:59           ` BPJ
2019-09-06 23:18       ` Maria Shinoto
     [not found]         ` <A4E70922-943A-49D3-9D9A-F5AC38E025AA-7M2J4GrLiDedPOQpRHQ53DeJuz7u0hKX@public.gmane.org>
2019-09-07  5:45           ` Denis Maier
     [not found]             ` <f17993e8-dddc-4f10-a905-dc84fe6a5782-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2019-09-08  0:10               ` Maria Shinoto
     [not found]                 ` <F0FB7353-D963-4F54-BF29-F9477F194044-7M2J4GrLiDedPOQpRHQ53DeJuz7u0hKX@public.gmane.org>
2019-09-08  5:09                   ` Denis Maier
     [not found]                     ` <e4843c0c-7cf5-43fc-8653-83ddc075f954-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2019-09-08  9:40                       ` Maria Shinoto
2019-09-07 10:05   ` BPJ
     [not found]     ` <CADAJKhButR28wyxanhAEYJnjmnRtBQ8OraU0aZ86BHRmkm1SjA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-09-07 10:10       ` BPJ
     [not found]         ` <CADAJKhDm8bibSjJfrM6W69qM_j1N9tPHEgRwaic4bZmrsB1CVw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-09-08  6:37           ` 'Nick Bart' via pandoc-discuss
2019-09-07 21:41       ` Denis Maier
2019-09-08  0:18       ` Maria Shinoto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=38609be6-0edc-4755-b2e7-6448795c907c@googlegroups.com \
    --to=maier.de-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).