From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/30907 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: BPJ Newsgroups: gmane.text.pandoc Subject: Re: Changing colons to full-stops in titles Date: Sat, 2 Jul 2022 22:02:51 +0200 Message-ID: References: <78df697a-50f5-46d0-b0b8-29a2cbc9509an@googlegroups.com> <2a8d940b3675472fb4b50ead406f6fc7@unibe.ch> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000007e522705e2d7fd05" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11949"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBCWMVYEK54FRB6GIQKLAMGQETCV6Q2A-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sat Jul 02 22:03:07 2022 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-wm1-f55.google.com ([209.85.128.55]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1o7jKd-0002wo-Js for gtp-pandoc-discuss@m.gmane-mx.org; Sat, 02 Jul 2022 22:03:07 +0200 Original-Received: by mail-wm1-f55.google.com with SMTP id r4-20020a1c4404000000b003a02fa133cesf2425742wma.2 for ; Sat, 02 Jul 2022 13:03:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1656792187; cv=pass; d=google.com; s=arc-20160816; b=FIDYVQRk5ZVhFdBQBS7vGN/9B6b8fdD9QhguNWgSRAo6UYN7HoQ5CCS7DlXDmJs7U7 tS9Kuex2j3EPzi5jHfUGGRL6QCaYuepK2X1ai99PuUvyrZy3WjI3N7Fb9y1HtQDUa6AO RMiDHRDZO9Zo28Fd1IVx+eltAD07W0S1MXG4IzJtKbxySEBc9ECRCv95klU072LpOYgN MDDKXDk+Ladd5zz+Ob+dQyoE1BZ4nSyJ+/brCXxU/RMQqKJgNHkTgy/J/atW6VjFsJBV 3OFd17jxYWbd4OuOda57i75JQbxv/3JQJr6QHDpw+FTPEIjMBeUkhrFuKbdWRX8DJ9hr vO5Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:to:subject:message-id:date:from :reply-to:in-reply-to:references:mime-version:sender:dkim-signature; bh=4ygaZ0c3DJFn5XqWSKgInJt9wadFvhXMTSYbNMGYaCA=; b=fQI5r9Pk1LYFGitoZUlpMI+EzUaLb/l1rHZzIjDXybLxJq3xJ1HsIyKtwGr9ng+KDa t52rGpsGR0kv35n11nPd7WP6ZDahL8a/aoUhjXehGwVGv9i29CQpzFjNqZ36sXVuv4FJ G3QEFjqCsRGK7aRvrR7XrscRuHCm8m2TIR1X/7pLgldykXU56BHgxVvK/0a8FgF8J7Cn Z9W9kmw2adQf8ijf3rq529bkKie6x1vOO49QHK0ynfQhRY+Q78gcaB8yIDzh6Cuvyfz2 go7voswAAtHiWGlEcSjlSNtuGNmcL8gn+kICG/wCwC0n/x6rJ15gvX7iGM6koK+vDKJq bIXA== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 209.85.218.43 as permitted sender) smtp.mailfrom=melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=sender:mime-version:references:in-reply-to:reply-to:from:date :message-id:subject:to:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=4ygaZ0c3DJFn5XqWSKgInJt9wadFvhXMTSYbNMGYaCA=; b=oW4uYVnd3eG5ZsNICB71QBrKuQltr4klgQyx6q6dEez89eLM6rO7kPyd9RKDbZg8nu rCQYa46pOxZIKpgTILQvNBSUXyFWRlzVoRmhQUFSlgY1+94TMZeJcnme5TlRc1U8z2Sx 487nm7XWQz1qkbkt7rPGlFrjYWQt6M/y8b1G2aBxnZF2UZ/YwQ4KQa8VDOnXQrzRt7xw qt0DG1D6OZYzsm47MxlPIF2mnzaEabMSlDFME3t+ZCkCj8Ox9W9AVQvhO0m2pSyb0oNr qgL03mt/Mir020mdRb2x5zY+rQGuaa5smg6V+v2GRYtAQ1BrvWpBukFG+YAYfo77Ibp8 X5jQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=sender:x-gm-message-state:mime-version:references:in-reply-to :reply-to:from:date:message-id:subject:to:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=4ygaZ0c3DJFn5XqWSKgInJt9wadFvhXMTSYbNMGYaCA=; b=JMz2aX4MXoQYwnw2r5wL8FIdzZWc+Hp0Xxut1Q1mRSImrvXalNrl1s/PwcqvGwW5t4 ARCHB7y93tIg6OvJd5zwgf0LlvH6nLN66GHhQODO9zIjZO3eaXH51mIKCPchIi+0Agjm 3hgfNxwjhbAavf01E7HM+PBxf0Q/Jz7Z/p3NXx2feQ6rn5pFld6Dr7ckC273DW2Er9B1 pFP30W/ccApbqTVUkfchmlj2adShR4wnE8craymMVakGIF8rzWR4wKLI22j+yntH6rZb 1uNJgHvjAHVknqet7gEn5KRxg+P8cSL3TX6OYp5/Cnk56p1cCVVfOBI4oThMLcof6O+B 1veQ== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AJIora8dJb9a/djlCr/IwXtRg1I1hLkFV2gJzfeULriTQZyx9wO9uCyL KMXuXdmZjdaCtME5OvKxsDY= X-Google-Smtp-Source: AGRyM1vci4WlkGsa6aSRg2/8UWCTeBVM1SZuJ3VigBC3mztFCUBl+mOPRJRbxYN/tWOo5tllbmivSQ== X-Received: by 2002:a5d:5444:0:b0:21d:6497:3210 with SMTP id w4-20020a5d5444000000b0021d64973210mr1407840wrv.587.1656792187259; Sat, 02 Jul 2022 13:03:07 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6000:156e:b0:21d:2eb7:c707 with SMTP id 14-20020a056000156e00b0021d2eb7c707ls15929732wrz.3.gmail; Sat, 02 Jul 2022 13:03:03 -0700 (PDT) X-Received: by 2002:a05:6000:70b:b0:21b:a816:85c6 with SMTP id bs11-20020a056000070b00b0021ba81685c6mr19221529wrb.639.1656792183049; Sat, 02 Jul 2022 13:03:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656792183; cv=none; d=google.com; s=arc-20160816; b=kMGkpdwq0EtagF/z3Fj64/obahLzdov77cTw3TNFScIqnYUGobzL85pSw/mqWfXyKm UmraGkP0hvp4ZHjJEW1hYjV6hZ1hariRX07tUojymbREEfNNyZD7oeUmhQaHVvB0Ulzc ENVHkibvv3DBheqEiDHR95JF5ESPh8RTasqWJHkUqVR7CpJaxdEIQzgEoAX1W/j/npu1 kEffKd+2FhhpWVSF5e/DcRQ2Xae7/1/lituSvfgRFgZLuZeyLRkGWNIs/ppPsthLylu5 /NAatEvUeKyKc3L1abN/B3sFG9BedU5zPGZLQvWnj+EJdcWRx8dDWqrkq6cOyyIlA99v 82tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:subject:message-id:date:from:reply-to:in-reply-to:references :mime-version; bh=8jChSqQuplRl/TgkT8N/p6wuClMviC6AgXyoM0AmHOo=; b=fDil2cBpmAHQ2fu2dmr5ulznMjqFCLAgspjemgQ0c2fXq4QXjeN+NFu1FTXcD2egjW yhqFnXsS7Vgf2E+mKenMXlXUN43+iegerk43ZoCc9AJ2PJUNpeqpjO7VlJjDd+D8u7To LKKI5PV92KsjML10wgKLOir3qx61YKyx7LrQG1UKnWTNx1SpN+e0xnPGkuSlQqvqNBSU WvPQNECWAk5L3IQCGKFquRoDzXNaMBDhie9j4r4sUx7Hu1q/QfTVNK/+FVo0UetyJny6 9Tosc905uCdei88Zhs8EGo04AnPPxkdEyOMub209bNwFc3q6J9POftYuFuxA0NpRt+cO aveg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 209.85.218.43 as permitted sender) smtp.mailfrom=melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Original-Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com. [209.85.218.43]) by gmr-mx.google.com with ESMTPS id v6-20020a5d59c6000000b0021d640c9fbbsi56249wry.8.2022.07.02.13.03.02 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 02 Jul 2022 13:03:02 -0700 (PDT) Received-SPF: pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 209.85.218.43 as permitted sender) client-ip=209.85.218.43; Original-Received: by mail-ej1-f43.google.com with SMTP id ay16so9809911ejb.6 for ; Sat, 02 Jul 2022 13:03:02 -0700 (PDT) X-Received: by 2002:a17:907:7f22:b0:726:8962:d5a6 with SMTP id qf34-20020a1709077f2200b007268962d5a6mr21001422ejc.717.1656792182312; Sat, 02 Jul 2022 13:03:02 -0700 (PDT) In-Reply-To: X-Original-Sender: melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 209.85.218.43 as permitted sender) smtp.mailfrom=melroch-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.io gmane.text.pandoc:30907 Archived-At: --0000000000007e522705e2d7fd05 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable string.gsub() optionally takes the maximum number of substitutions as a fourth argument, and you can reinsert capture groups in the replacement, so this should be fairly robust: ``````lua string.gsub(title, '%:(%s)', '.%1', 1) `````` Den fre 1 juli 2022 18:44John Carter Wood skrev: > Ah, of course, biblical references. Religious history is one of my fields= , > how could I miss that? > > Looking forward to trying this out! > > denis...-NSENcxR/0n0@public.gmane.org schrieb am Freitag, 1. Juli 2022 um 18:41:02 UTC+2: > >> A slightly more reliable version: >> >> >> >> ``` >> >> local stringify =3D pandoc.utils.stringify >> >> function Meta(m) >> >> if m.references ~=3D nil then >> >> for _, el in ipairs (m.references) do >> >> -- print(stringify(el.title)) >> >> el.title =3D pandoc.Str(string.gsub(stringify(el.title), ': ', '. = ')) >> >> -- print(el.title) >> >> end >> >> end >> >> return m >> >> end``` >> >> >> >> (This won=E2=80=99t replace colons in biblical references, e.g. Gen 1:1) >> >> >> >> You can test with this file : >> >> >> >> ```markdown >> >> --- >> >> references: >> >> - type: book >> >> id: doe >> >> author: >> >> - family: Doe >> >> given: Jane >> >> issued: >> >> date-parts: >> >> - - 2022 >> >> title: 'A book: with a subtitle and a reference to Gen 1:1, but that i= s >> not a problem' >> >> publisher: 'Whatever press' >> >> lang: de-De >> >> ... >> >> >> >> test [@doe] >> >> ``` >> >> >> >> The filter itself does not cover capitalization. For some reason, pandoc >> or citeproc applies title-case transformation here. I don=E2=80=99t thin= k it should >> though. >> >> >> >> *Von:* pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org *Im >> Auftrag von *John Carter Wood >> *Gesendet:* Freitag, 1. Juli 2022 18:24 >> *An:* pandoc-discuss >> *Betreff:* Re: Changing colons to full-stops in titles >> >> >> >> That's very interesting, thanks! I'll try it out when I get a chance in >> the coming days. >> >> I have thought about this issue of false positives while thinking about >> the option of some kind of filter. But...I think they would be very rare= . I >> have a hard time thinking of a title with a colon in it that shouldn't b= e >> -- in this case -- be turned into a dot. At least, I don't have anything= in >> my 1,200 references where I can see that that wouldn't apply. >> >> Although, of course, I'm sure there are some out there... >> >> Just a question: would this also ensure that the first word after the do= t >> is capitalised? Or does that open a new series of problems? :-) >> >> >> denis...-NSENcxR/0n0@public.gmane.org schrieb am Freitag, 1. Juli 2022 um 18:17:02 UTC+2: >> >> Here=E2=80=99s a very simple and absolutely unreliable version of a filt= er. This >> will replace every colon in a title with a period. >> >> >> >> ```lua >> >> local stringify =3D pandoc.utils.stringify >> >> function Meta(m) >> >> if m.references ~=3D nil then >> >> for _, el in ipairs (m.references) do >> >> print(stringify(el.title)) >> >> el.title =3D pandoc.Str(string.gsub(stringify(el.title), ':', '.')= ) >> >> print(el.title) >> >> end >> >> end >> >> return m >> >> end >> >> ``` >> >> >> >> Question is how this can be made robust enough to avoid false positives. >> >> >> >> >> >> *Von:* pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org *Im >> Auftrag von *John Carter Wood >> *Gesendet:* Freitag, 1. Juli 2022 17:52 >> *An:* pandoc-discuss >> *Betreff:* Re: Changing colons to full-stops in titles >> >> >> >> Thanks for the suggestions, a couple of which are kind of stretching my >> knowledge of these things, but I see where they're going. >> >> As to JGM's question: I am using a CSL json bibliography, so my titles >> are in a single field. ("title":"Science and religion: new perspectives = on >> the dialogue") >> >> The issue is that *most* of the journals / publishers I publish in use, >> as here, the colon. *Some* (mainly German) styles want the period. If I >> were solely interested in either one, I could choose and just enter the >> relevant punctuation in the title field. However, I want to continue sav= ing >> my bibliographic entries with a colon (because that's the most standard = one >> for me), but have the option of automatically converting them to a perio= d >> for those cases where I need to. If that makes sense. >> >> Thus: going through denis's options: >> >> 1. I have switched to json bibliographies from bibtex/biblatex as they >> seemed to offer more flexibility (I was running into issue with the stra= nge >> archival references I have to make in my field, and JSON seemed to work >> better in that regard). So this seems to not apply. >> >> 2. Seems to not apply, as I have a single title field >> >> 3. Sounds really interesting, and I use BBT, though it also sounds like = I >> would here have to create a separate bibliography file from my Zotero >> database for those publishers/styles that require the dot. This is not >> *too* onerous, as it would at least be automated. >> >> 4. Having a filter that I could simply apply (as part of a pandoc >> command, say) or not apply as relevant seems like the most flexible / >> efficient solution. I don't know lua, but if this is one possible way, t= hen >> I could use it as a (hopefully fairly simple?) way into learning it. >> >> >> >> Does this help to clarify my situation? >> >> >> >> denis...-NSENcxR/0n0@public.gmane.org schrieb am Freitag, 1. Juli 2022 um 17:34:55 UTC+2: >> >> Yes, that=E2=80=99s a known issue... >> >> There are a couple of possible solutions : >> >> >> >> 1. use biblatex databases and patch pandoc so it will concat title and >> subtitle fields using periods. (line 667 >> https://github.com/jgm/pandoc/blob/master/src/Text/Pandoc/Citeproc/BibTe= X.hs >> ) >> >> >> >> 2. I think pandoc=E2=80=99s citeproc will just treat every unknown varia= ble as a >> string variable (see >> https://github.com/jgm/citeproc/blob/3f94424db469c804cf2dac2d22dc7a18b61= 4f43e/src/Citeproc/Types.hs#L1054 >> and >> https://github.com/jgm/citeproc/blob/3f94424db469c804cf2dac2d22dc7a18b61= 4f43e/src/Citeproc/Types.hs#L901), >> so you should be able to use =C2=ABsubtitle=C2=BB in styles. (This will = give you >> warnings when using the style with Zotero and it won=E2=80=99t work reli= ably across >> implementations, but anyway ...) >> >> >> >> 3. if you=E2=80=99re using Zotero, you can leverage Zotero BBT=E2=80=99s= postscript >> feature to manipulate the JSON after exporting. >> >> E.g., this one : >> >> if (Translator.BetterCSL && item.title) { >> >> reference.title =3D reference.title.replace(/ : /g, '. ') >> >> } >> >> Not bullet-proof, but simple. You will want to choose a better separator= , >> maybe a double-bar or so. >> >> >> >> 4. Doing the with lua should also be possible... >> >> >> >> The question is: do you have the subtitle in a distinct field or is it >> just in the title field? >> >> >> >> *Von:* pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org *Im >> Auftrag von *John Carter Wood >> *Gesendet:* Freitag, 1. Juli 2022 16:39 >> *An:* pandoc-discuss >> *Betreff:* Changing colons to full-stops in titles >> >> >> >> I have one final (for now...) issue in setting up a CSL file (which I us= e >> with pandoc/citeproc and references in a json file). >> >> >> >> I'm not sure whether this is a CSL issue or whether it's an issue that >> can be solved via using a filter (or some other solution) in pandoc, but= I >> thought there might be some people here who might have faced a similar >> issue. >> >> >> >> The house style for here (German-based publisher) wants a *full-stop/per= iod >> *between main title and subtitle in citations / bibliographies; US/UK >> standard is a *colon* between main title and subtitle. And reference >> managers like Zotero -- IIUC -- save titles as single fields (at least t= hey >> are in my version of Zotero). So it doesn't seem like it is possible to >> control what delimiter is used between them via CSL. >> >> >> I have found various discussions of relevant title/subtitle division >> issues -- some going back quite a few years -- in forums on Zotero: >> >> >> https://forums.zotero.org/discussion/8077/separate-fields-for-title-and-= subtitle/ >> >> ...and CSL: >> >> >> https://discourse.citationstyles.org/t/handling-main-sub-title-splits-ci= teproc-js/1563/11 >> >> >> >> However, these were in part discussions among developers about *possible= * >> changes, and I'm not sure of the current status of this issue or whether >> there is a way to handle it. >> >> Would it be possible to automate turning colons in titles into full-stop= s >> via using a filter? If so is there such a filter already around? Can thi= s >> be done via CSL? >> >> >> >> Or is this, as of now, impossible? >> >> (Or is there a real simple solution that I have, as usual, overlooked...= ) >> >> -- >> >> You received this message because you are subscribed to the Google Group= s >> "pandoc-discuss" group. >> To unsubscribe from this group and stop receiving emails from it, send a= n >> email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/pandoc-discuss/78df697a-50f5-46d0-b0b8= -29a2cbc9509an%40googlegroups.com >> >> . >> >> -- >> You received this message because you are subscribed to the Google Group= s >> "pandoc-discuss" group. >> To unsubscribe from this group and stop receiving emails from it, send a= n >> email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/pandoc-discuss/a2d540a6-a435-4285-aed5= -018007d155cfn%40googlegroups.com >> >> . >> >> -- >> You received this message because you are subscribed to the Google Group= s >> "pandoc-discuss" group. >> To unsubscribe from this group and stop receiving emails from it, send a= n >> email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/pandoc-discuss/f0f222ef-e60e-4397-83ac= -bec1a6ac2d08n%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/b3deb0de-8ba0-4159-b9f3-= 1ecfbe68d457n%40googlegroups.com > > . > --=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/CADAJKhAU66TxJKMZdDM-KVabJpmKUVo5xyuAAN03F2b89jv9Ow%40mail.g= mail.com. --0000000000007e522705e2d7fd05 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
string.gsub() optionally takes the maximum number of subs= titutions as a fourth argument, and you can reinsert capture groups in the = replacement, so this should be fairly robust:

``````lua
string.gsub(title, '%:= (%s)', '.%1', 1)
``````


Den fre 1 juli 2022 18:44John Carter Wood <woodjo-ZOsAvrTRSvuEhhMi0yms2Q@public.gmane.org> skrev:
Ah, of course, biblical references. Religious hi= story is one of my fields, how could I miss that?

Looking forward t= o trying this out!

denis...-NSENcxR/0n0@public.gmane.org schrieb am Freitag, 1. Juli 2022 um 1= 8:41:02 UTC+2:

A slightly more reliable versio= n:

=C2=A0

```

local stringify =3D pandoc.util= s.stringify

function Meta(m)<= /span>

=C2=A0 if m.references ~=3D nil= then

=C2=A0=C2=A0=C2=A0 for _, el in= ipairs (m.references) do

=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 -- print(stringify(el.title))=

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = el.title =3D pandoc.Str(string.gsub(stringify(el.title), ': ', '= ;. '))

=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 -- print(el.title)

=C2=A0=C2=A0=C2=A0 end

=C2=A0 end

=C2=A0 return m

end```

=C2=A0

(This w= on=E2=80=99t replace colons in biblical references, e.g. Gen 1:1)=

=C2=A0

You can test with this file=C2= =A0:

=C2=A0

```markdown

---

references:

- type: book

=C2=A0 id: doe

=C2=A0 author:

=C2=A0 - family: Doe

=C2=A0=C2=A0=C2=A0 given: Jane

=C2=A0 issued:<= /u>

=C2=A0=C2=A0=C2=A0 date-parts:<= u>

=C2=A0=C2=A0=C2=A0 - - 2022<= /u>

=C2=A0 title: 'A book: with= a subtitle and a reference to Gen 1:1, but that is not a problem'

=C2=A0 publisher: 'Whatever= press'

=C2=A0 lang: de-De

...

=C2=A0

test [@doe]

```

=C2=A0

The filter itself does not cover capitalizatio= n. For some reason, pandoc or citeproc applies tit= le-case transformation here. I don=E2=80=99t think it should though.=

=C2=A0

Von: pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> Im Auftrag von John Carter Wood
Gesendet: Freitag, 1. Juli 2022 18:24
An: pandoc-discuss <pandoc-...@goo= glegroups.com>
Betreff: Re: Changing colons to full-stops in titles

=C2=A0

That's very inter= esting, thanks! I'll try it out when I get a chance in the coming days.

I have thought about this issue of false positives while thinking about the= option of some kind of filter. But...I think they would be very rare. I ha= ve a hard time thinking of a title with a colon in it that shouldn't be= -- in this case -- be turned into a dot. At least, I don't have anything in my 1,200 references where I ca= n see that that wouldn't apply.

Although, of course, I'm sure there are some out there...

Just a question: would this also ensure that the first word after the dot i= s capitalised? Or does that open a new series of problems? :-)


denis...-NSENcxR/0n0@public.gmane.org= schrieb am Freitag, 1. Juli 2022 um 18:17:02 UTC+2:

Here=E2=80=99s a very simple an= d absolutely unreliable version of a filter. This will replace every colon = in a title with a period.

=C2=A0

```lua

local stringify =3D pandoc.util= s.stringify

function Meta(m)<= u>

=C2=A0 if m.references ~=3D nil= then

=C2=A0=C2=A0=C2=A0 for _, el in= ipairs (m.references) do

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = print(stringify(el.title))

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = el.title =3D pandoc.Str(string.gsub(stringify(el.title), ':', '= .'))

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 print(el.title)

=C2=A0=C2=A0=C2=A0 end

=C2=A0 end

=C2=A0 return m

end

```

=C2=A0

Question is how this can be mad= e robust enough to avoid false positives.

=C2=A0

=C2=A0

Von: pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org= <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> Im Auftrag von John Carter Wood
Gesendet: Freitag, 1. Juli 2022 17:52
An: pandoc-discuss <pandoc-.= ..@googlegroups.com>
Betreff: Re: Changing colons to full-stops in titles

=C2=A0

Thanks for the sugges= tions, a couple of which are kind of stretching my knowledge of these thing= s, but I see where they're going.

As to JGM's question: I am using a CSL json bibliography, so my titles = are in a single field. ("title":"Science and religion: new p= erspectives on the dialogue")

The issue is that *most* of the journals / publishers I publish in use, as = here, the colon. *Some* (mainly German) styles want the period. If I were s= olely interested in either one, I could choose and just enter the relevant = punctuation in the title field. However, I want to continue saving my bibliographic entries with a colon (= because that's the most standard one for me), but have the option of au= tomatically converting them to a period for those cases where I need to. If= that makes sense.

Thus: going through denis's options:

1. I have switched to json bibliographies from bibte= x/biblatex as they seemed to offer more flexibility (I was running into iss= ue with the strange archival references I have to make in my field, and JSON seemed to work better in that regard). So this = seems to not apply.

2. Seems to not apply, as I have a single title fiel= d

3. Sounds really interesting, and I use BBT, though = it also sounds like I would here have to create a separate bibliography fil= e from my Zotero database for those publishers/styles that require the dot. This is not *too* onerous, as it would at least be a= utomated.

4. Having a filter that I could simply apply (as par= t of a pandoc command, say) or not apply as relevant seems like the most fl= exible / efficient solution. I don't know lua, but if this is one possible way, then I could use it as a (hopefully fairly si= mple?) way into learning it.

=C2=A0

Does this help to cla= rify my situation?

=C2=A0

denis...@unibe.= ch schrieb am Freitag, 1. Juli 2022 um 17:34:55 UTC+2:=

Yes, that=E2=80=99s a known iss= ue...

There are a couple of possible = solutions=C2=A0:

=C2=A0

1. use biblatex databases and p= atch pandoc so it will concat title and subtitle fields using periods. (line 667 https://github.com/jgm/pandoc/b= lob/master/src/Text/Pandoc/Citeproc/BibTeX.hs)<= /u>

=C2=A0

2. I think pandoc=E2=80=99s citeproc will just treat= every unknown variable as a string variable (see https://github.com/= jgm/citeproc/blob/3f94424db469c804cf2dac2d22dc7a18b614f43e/src/Citeproc/Typ= es.hs#L1054 and https://github.com/jgm/citeproc/blob/3f94424db469c804cf2dac2d22dc7a18b614f4= 3e/src/Citeproc/Types.hs#L901), so you should be able to use =C2=ABsubt= itle=C2=BB in styles. (This will give you warnings when using the style wit= h Zotero and it won=E2=80=99t work reliably across implementations, but anyway ...)

=C2=A0

3. if you=E2=80=99re using Zote= ro, you can leverage Zotero BBT=E2=80=99s postscript feature to manipulate = the JSON after exporting.

E.g., this one=C2=A0:=

if (Translator.BetterCSL &&= amp; item.title) {

=C2=A0 reference.title =3D refe= rence.title.replace(/ : /g, '. ')

}

Not bullet-proof, but simple. Y= ou will want to choose a better separator, maybe a double-bar or so.=

=C2=A0

4. Doing the with lua should also be possible...<= /u>

=C2=A0

The question is: do you have the subtitle in a disti= nct field or is it just in the title field?

=C2=A0

Von: pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org= <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> Im Auftrag von John Carter Wood
Gesendet: Freitag, 1. Juli 2022 16:39
An: pandoc-discuss <pandoc-.= ..@googlegroups.com>
Betreff: Changing colons to full-stops in titles

=C2=A0

I have one final (for now...) issue in setting up a = CSL file (which I use with pandoc/citeproc and references in a json file).

=C2=A0

I'm not sure whether this is a CSL issue or whet= her it's an issue that can be solved via using a filter (or some other = solution) in pandoc, but I thought there might be some people here who might have faced a similar issue.

=C2=A0

The house style for here (German-based publisher) wa= nts a full-stop/period between main title and subtitle in citations / bibl= iographies; US/UK standard is a colon between main title and subtitle. And reference managers like Z= otero -- IIUC -- save titles as single fields (at least they are in my vers= ion of Zotero). So it doesn't seem like it is possible to control what = delimiter is used between them via CSL.


I have found various discussions of relevant title/subtitle division issues= -- some going back quite a few years -- in forums on Zotero:

https://fo= rums.zotero.org/discussion/8077/separate-fields-for-title-and-subtitle/=

...and CSL:

ht= tps://discourse.citationstyles.org/t/handling-main-sub-title-splits-citepro= c-js/1563/11

=C2=A0

However, these were i= n part discussions among developers about possible changes, and I'm not sure of the current status of this= issue or whether there is a way to handle it.

Would it be possible to automate turning colons in t= itles into full-stops via using a filter? If so is there such a filter alre= ady around? Can this be done via CSL?

=C2=A0

Or is this, as of now, impossible?

(Or is there a real simple solution that I have, as usual, overlooked...) <= u>

--

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-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<= /span>.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/78df697a-50f5-46d0-b0b8-29= a2cbc9509an%40googlegroups.com.

--
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 pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<= /span>.

--
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 pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.

--
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 pandoc-discuss+unsubscribe-/JYPxA39Uh4Ykp1iOSErHA@public.gmane.org= m.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/b3deb0de-8= ba0-4159-b9f3-1ecfbe68d457n%40googlegroups.com.

--
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/CADAJKhAU66TxJKMZdDM-KVabJpmKUVo5xyuAAN03= F2b89jv9Ow%40mail.gmail.com.
--0000000000007e522705e2d7fd05--