From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/23395 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Denis Maier Newsgroups: gmane.text.pandoc Subject: Re: Transliterated and original titles/names in citations Date: Fri, 6 Sep 2019 15:04:38 -0700 (PDT) Message-ID: <38609be6-0edc-4755-b2e7-6448795c907c@googlegroups.com> References: <0c05fcec-fbb7-aed6-c1ec-e84610bcdd96@gmail.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_675_1387756549.1567807478452" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="99822"; mail-complaints-to="usenet@blaine.gmane.org" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBCQOJL5Q2QMRB55PZPVQKGQEOTH74DY-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sat Sep 07 00:04:42 2019 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-oi1-f183.google.com ([209.85.167.183]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1i6MLR-000Pqo-Na for gtp-pandoc-discuss@m.gmane.org; Sat, 07 Sep 2019 00:04:42 +0200 Original-Received: by mail-oi1-f183.google.com with SMTP id q21sf3561431oic.22 for ; Fri, 06 Sep 2019 15:04:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:date:from:to:message-id:in-reply-to:references:subject :mime-version:x-original-sender:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:list-subscribe :list-unsubscribe; bh=qGlefZE7+5oqiSsmPvs29U6WOTbO33iq12HkDJqidIc=; b=GPZFisOTsppmiO9yvb0E+upFrqkwVYP8wWoVKKdzPrDMK0LJKue5/d+OJn6lOh5ReF cCSO6dxZ3pI9QOZSAiLGfvQLAgwi7PldnP6cebGfBoTnintRzIPdOWboeyouzllp+q6n sl+4FxP2U1Xy8pQCdCjpxc+SEnncayx8C/anWAqZnVN5+MoAH5Lr/OtoWxSq4IcgXe94 ftIpPPKJ67PPvk3MEg4XnOou3EjYCx47ZFcMNHqxuOHd4WakChVIWubTkXrPQ0DHK2iF fsk1+TYZuN2dC5E4lKwLYowXinUjKq7kpoGngqIlcziKF5yw98uBfK07ulKdDfD/qa3F dL8A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:message-id:in-reply-to:references:subject:mime-version :x-original-sender:reply-to:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=qGlefZE7+5oqiSsmPvs29U6WOTbO33iq12HkDJqidIc=; b=l0zBu0/xKz/ZRx3ffX9GBjmUlIUHfqPdh9X1tWxmX8hk4eq8hUnASDBIAif3CyhRI3 27Aqkh2++5Y7plsVFdeQ3rCeG2Htn2CgeHbE+mRitbkgS9zopbM0fZAAYT5/UU6ClEAo cII4zmyv/UgTkvYRQ58dUnZmAfsP/pLczKz4rFtMKBAmnfOf453hIBX5i2twvtqtM/aY AfF/5CHysNHSJgkTH8bW+maCmeiPD6WM3KDWrawNEXIe2w6qIQNtmcEt7pU6ygzY0A4U IDipEWVVZW3pRwlYN2uP21BEeGLwCD12Eds2JetMTlE0MZ+t00oKREh5T/lqlf3zNtBF /kwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:date:from:to:message-id:in-reply-to :references:subject:mime-version:x-original-sender:reply-to :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=qGlefZE7+5oqiSsmPvs29U6WOTbO33iq12HkDJqidIc=; b=CKKozkV8OXJa5ZtB7AiIuRzcYlsjEXUWVuW/TtV2ga/NlglWGRfeLNcomro/fOJVBG wYwkRmKCqv0fc5eRk8vJnIc986wNm2tNJmH1FuYjSGvk6phrQeXjW454bBxS0vxhjeY6 ZzYV7cqMs4Mqr62UCti8GwtT6HHQv0frUctKHUbIuZ8sW5SlWA+0ZAmpuXZMuV38qHgZ K0qRqDfPKkFMLOWeQr1rOZON9bJF7L7L9XJA7PcrHq/BmH+EdV7N/ZEapLUxC4dZhi1G xeGxXjGVKiRKaObGnKZFd3YOiAgUBtfUs7m35UOg2csAWETsz6wzYC5+9polueBB47zu DtIQ== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: APjAAAV/Exb/WpIIJeJ2jNKV3qYWmedTT3Ujm4yXn7AlOzXQPEO6mb2I bd2orWqVGzsf0xNg4BFxb2c= X-Google-Smtp-Source: APXvYqwRs3O6zLBzUS4wbZgrXWUjmA52cW/tITzdf9QlX4rEk6zfHJRkpr+fA1HePlbVDLk/Mt7S3Q== X-Received: by 2002:a05:6830:1d4c:: with SMTP id p12mr6168073oth.333.1567807480079; Fri, 06 Sep 2019 15:04:40 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a9d:6343:: with SMTP id y3ls1426687otk.7.gmail; Fri, 06 Sep 2019 15:04:39 -0700 (PDT) X-Received: by 2002:a9d:da4:: with SMTP id 33mr9805113ots.288.1567807478973; Fri, 06 Sep 2019 15:04:38 -0700 (PDT) In-Reply-To: X-Original-Sender: maier.de-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Precedence: list Mailing-list: list pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; contact pandoc-discuss+owners-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-ID: X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.org gmane.text.pandoc:23395 Archived-At: ------=_Part_675_1387756549.1567807478452 Content-Type: multipart/alternative; boundary="----=_Part_676_1581848031.1567807478453" ------=_Part_676_1581848031.1567807478453 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 1. I am almost sure that Pandoc will just ignore unknown fields, at least= =20 that's what happened (unfortunately and to my disappointment) the last time= =20 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=20 existing fields, the easiest solution might be to use something along the= =20 lines of this script. ``` import json import argparse parser =3D argparse.ArgumentParser(description=3D'Merge title and subtitle= =20 fields in CSL JSON with custom separator') parser.add_argument('-f', '--from', action=3D"store", dest=3D"from_file") parser.add_argument('-t', '--to', action=3D"store", dest=3D"to_file") parser.add_argument('-s', '--separator', action=3D"store", dest=3D"separato= r",=20 default=3D": ") args =3D parser.parse_args() # Load JSON File with open(args.from_file, 'r') as from_file: references =3D json.load(from_file) # Merge Title and Subtitle Fields for reference in references: try: reference['title'] =3D reference['title'] + args.separator +=20 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=3D2,ensure_ascii=3DFalse) ``` This will merge title and subtitle fields, but you can of course adapt this= =20 to merge `title` and `title:transliteration`. (You'll need to you have your= =20 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=20 > what I had hoped for but kind of what I had expected. Usability with=20 > Pandoc=E2=86=92LaTeX is a must for me. I guess I could write my own code = to locate=20 > references, look up the data, invoke something which produces a=20 > bibliography in HTML, then massage that HTML into something Pandoc will= =20 > convert into LaTeX appropriately. Sounds like a lot of work though =E2=80= =94=20 > although not as much as implementing a whole citation processor! > > Another question is whether pandoc-citeproc will ignore unknown fields or= =20 > throw an error? If the former I can have custom fields with the separate= =20 > original and transliterated fields, as I need for my searching purposes a= nd=20 > automatically update the combined version in the official fields. If the= =20 > latter I'll need to produce a special version for Pandoc's consumption wi= th=20 > 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=20 >> citations, when you want to include both the transliteration and the=20 >> original? Does CSL have any fields for that? >> >> TIA, >> >> /bpj >> > --=20 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 e= mail 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. ------=_Part_676_1581848031.1567807478453 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
1. I am almost sure that Pandoc will just ignore unkn= own fields, at least that's what happened (unfortunately and to my disa= ppointment) the last time I have tried to use non-standard fields in a styl= e.

2. If you don't want to hardcode the transl= iteration into one of the existing fields, the easiest solution might be to= use something along the lines of this script.

```=
import json
import argparse

<= div>parser =3D argparse.ArgumentParser(description=3D'Merge title and s= ubtitle fields in CSL JSON with custom separator')

=
parser.add_argument('-f', '--from', action=3D"sto= re", dest=3D"from_file")
parser.add_argument('= -t', '--to', action=3D"store", dest=3D"to_file&q= uot;)
parser.add_argument('-s', '--separator', ac= tion=3D"store", dest=3D"separator", default=3D": &= quot;)

args =3D parser.parse_args()

=
# Load JSON File

with open(args.fro= m_file, 'r') as from_file:
=C2=A0 =C2=A0 references =3D j= son.load(from_file)

# Merge Title and Subtitle Fie= lds

for reference in references:
=C2=A0 = =C2=A0 try:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 reference['title'= ] =3D reference['title'] + args.separator + reference['subtitle= ']
=C2=A0 =C2=A0 =C2=A0 =C2=A0 reference.pop('subtitle= 9;, None)
=C2=A0 =C2=A0 except:
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 pass

# Write results back to File

with open(args.to_file, "w") as to_file:
=C2=A0 =C2=A0 json.dump(references, to_file, indent=3D2,ensure_ascii=3DFa= lse)

```

This w= ill merge title and subtitle fields, but you can of course adapt this to me= rge `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 schrie= b 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=E2=86=92La= TeX is a must for me. I guess I could write my own code to locate reference= s, look up the data, invoke something which produces a bibliography in HTML= , then massage that HTML into something Pandoc will convert into LaTeX appr= opriately. Sounds like a lot of work though =E2=80=94 although not as much = as implementing a whole citation processor!

Another question is whether pandoc-citeproc will ignore unkno= wn fields or throw an error? If the former I can have custom fields with th= e separate original and transliterated fields, as I need for my searching p= urposes and automatically update the combined version in the official field= s. If the latter I'll need to produce a special version for Pandoc'= s consumption with the custom fields removed, which complicates things cons= iderably.

Den on= s 4 sep. 2019 09:33BPJ <mel...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev:
Does anyone know how to handle transliterated titles an= d 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 &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pand= oc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@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.co= m.
------=_Part_676_1581848031.1567807478453-- ------=_Part_675_1387756549.1567807478452--