public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Changing colons to full-stops in titles
@ 2022-07-01 14:38     ` John Carter Wood
       [not found]       ` <78df697a-50f5-46d0-b0b8-29a2cbc9509an-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 27+ messages in thread
From: John Carter Wood @ 2022-07-01 14:38 UTC (permalink / raw)
  To: pandoc-discuss


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

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). 

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/period 
*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 they 
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-citeproc-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-stops 
via using a filter? If so is there such a filter already around? Can this 
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 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/78df697a-50f5-46d0-b0b8-29a2cbc9509an%40googlegroups.com.

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

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: Changing colons to full-stops in titles
       [not found]       ` <78df697a-50f5-46d0-b0b8-29a2cbc9509an-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2022-07-01 15:30         ` John MacFarlane
       [not found]           ` <m2sfnkvoih.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
  2022-07-01 15:34         ` denis.maier-NSENcxR/0n0
  2022-07-02 16:28         ` BPJ
  2 siblings, 1 reply; 27+ messages in thread
From: John MacFarlane @ 2022-07-01 15:30 UTC (permalink / raw)
  To: John Carter Wood, pandoc-discuss


CSL doesn't have a subtitle field.  So, if you're using
a CSL bibliography, you'll need to put both the main and
the subtitle in the "title" field. And then you can just put in
the period instead of the colon.

Hence this problem only really arises if you're using,
say, a bibtex bibliography with separate title and subtitle
fields. Then pandoc will have to combine these to form
the CSL "title" field, and to do this it will add a colon.

This isn't configurable, but why not just use a CSL JSON
or YAML bibliography with a single title field; then you
can use whatever separator you want? You can use pandoc
for the initial conversion from bibtex.

John Carter Wood <woodjo-ZOsAvrTRSvuEhhMi0yms2Q@public.gmane.org> writes:

> 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). 
>
> 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/period 
> *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 they 
> 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-citeproc-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-stops 
> via using a filter? If so is there such a filter already around? Can this 
> 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 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/78df697a-50f5-46d0-b0b8-29a2cbc9509an%40googlegroups.com.


^ permalink raw reply	[flat|nested] 27+ messages in thread

* AW: Changing colons to full-stops in titles
       [not found]       ` <78df697a-50f5-46d0-b0b8-29a2cbc9509an-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  2022-07-01 15:30         ` John MacFarlane
@ 2022-07-01 15:34         ` denis.maier-NSENcxR/0n0
       [not found]           ` <f440b082946148b884b45ed1a3421de4-NSENcxR/0n0@public.gmane.org>
  2022-07-02 16:28         ` BPJ
  2 siblings, 1 reply; 27+ messages in thread
From: denis.maier-NSENcxR/0n0 @ 2022-07-01 15:34 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 4172 bytes --]

Yes, that’s 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/BibTeX.hs)

2. I think pandoc’s citeproc will just treat every unknown variable as a string variable (see https://github.com/jgm/citeproc/blob/3f94424db469c804cf2dac2d22dc7a18b614f43e/src/Citeproc/Types.hs#L1054 and https://github.com/jgm/citeproc/blob/3f94424db469c804cf2dac2d22dc7a18b614f43e/src/Citeproc/Types.hs#L901), so you should be able to use «subtitle» in styles. (This will give you warnings when using the style with Zotero and it won’t work reliably across implementations, but anyway ...)

3. if you’re using Zotero, you can leverage Zotero BBT’s postscript feature to manipulate the JSON after exporting.
E.g., this one :
if (Translator.BetterCSL && item.title) {
  reference.title = 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-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> Im Auftrag von John Carter Wood
Gesendet: Freitag, 1. Juli 2022 16:39
An: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Betreff: Changing colons to full-stops in titles

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).

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/period 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 they 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-citeproc-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-stops via using a filter? If so is there such a filter already around? Can this 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 Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@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<https://groups.google.com/d/msgid/pandoc-discuss/78df697a-50f5-46d0-b0b8-29a2cbc9509an%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
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/f440b082946148b884b45ed1a3421de4%40unibe.ch.

[-- Attachment #2: Type: text/html, Size: 9597 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* AW: Changing colons to full-stops in titles
       [not found]           ` <m2sfnkvoih.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
@ 2022-07-01 15:41             ` denis.maier-NSENcxR/0n0
  0 siblings, 0 replies; 27+ messages in thread
From: denis.maier-NSENcxR/0n0 @ 2022-07-01 15:41 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw, woodjo-ZOsAvrTRSvuEhhMi0yms2Q

> CSL doesn't have a subtitle field.  So, if you're using a CSL bibliography, you'll
> need to put both the main and the subtitle in the "title" field. And then you
> can just put in the period instead of the colon.

The problem is that people use the database for publications in different languages. So you cannot just use a period instead of a colon.

Denis


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: Changing colons to full-stops in titles
       [not found]           ` <f440b082946148b884b45ed1a3421de4-NSENcxR/0n0@public.gmane.org>
@ 2022-07-01 15:52             ` John Carter Wood
       [not found]               ` <a2d540a6-a435-4285-aed5-018007d155cfn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 27+ messages in thread
From: John Carter Wood @ 2022-07-01 15:52 UTC (permalink / raw)
  To: pandoc-discuss


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

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 saving 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 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 bibtex/biblatex as they 
seemed to offer more flexibility (I was running into issue 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 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, then 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’s 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/BibTeX.hs
> )
>
>  
>
> 2. I think pandoc’s citeproc will just treat every unknown variable as a 
> string variable (see 
> https://github.com/jgm/citeproc/blob/3f94424db469c804cf2dac2d22dc7a18b614f43e/src/Citeproc/Types.hs#L1054 
> and 
> https://github.com/jgm/citeproc/blob/3f94424db469c804cf2dac2d22dc7a18b614f43e/src/Citeproc/Types.hs#L901), 
> so you should be able to use «subtitle» in styles. (This will give you 
> warnings when using the style with Zotero and it won’t work reliably across 
> implementations, but anyway ...)
>
>  
>
> 3. if you’re using Zotero, you can leverage Zotero BBT’s postscript 
> feature to manipulate the JSON after exporting.
>
> E.g., this one :
>
> if (Translator.BetterCSL && item.title) {
>
>   reference.title = 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 <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> *Im 
> Auftrag von *John Carter Wood
> *Gesendet:* Freitag, 1. Juli 2022 16:39
> *An:* pandoc-discuss <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
> *Betreff:* Changing colons to full-stops in titles
>
>  
>
> 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). 
>
>  
>
> 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/period *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 they 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-citeproc-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-stops 
> via using a filter? If so is there such a filter already around? Can this 
> 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 Groups 
> "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> 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 
> <https://groups.google.com/d/msgid/pandoc-discuss/78df697a-50f5-46d0-b0b8-29a2cbc9509an%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/a2d540a6-a435-4285-aed5-018007d155cfn%40googlegroups.com.

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

^ permalink raw reply	[flat|nested] 27+ messages in thread

* AW: Changing colons to full-stops in titles
       [not found]               ` <a2d540a6-a435-4285-aed5-018007d155cfn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2022-07-01 16:16                 ` denis.maier-NSENcxR/0n0
       [not found]                   ` <bc85a4891eec431f846ee69f9fcbe167-NSENcxR/0n0@public.gmane.org>
  0 siblings, 1 reply; 27+ messages in thread
From: denis.maier-NSENcxR/0n0 @ 2022-07-01 16:16 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 7439 bytes --]

Here’s a very simple and absolutely unreliable version of a filter. This will replace every colon in a title with a period.

```lua
local stringify = pandoc.utils.stringify
function Meta(m)
  if m.references ~= nil then
    for _, el in ipairs (m.references) do
      print(stringify(el.title))
      el.title = 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-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> Im Auftrag von John Carter Wood
Gesendet: Freitag, 1. Juli 2022 17:52
An: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
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 saving 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 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 bibtex/biblatex as they seemed to offer more flexibility (I was running into issue 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 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, then 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<mailto:denis...-NSENcxR/0n0@public.gmane.org> schrieb am Freitag, 1. Juli 2022 um 17:34:55 UTC+2:
Yes, that’s 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/BibTeX.hs)

2. I think pandoc’s citeproc will just treat every unknown variable as a string variable (see https://github.com/jgm/citeproc/blob/3f94424db469c804cf2dac2d22dc7a18b614f43e/src/Citeproc/Types.hs#L1054 and https://github.com/jgm/citeproc/blob/3f94424db469c804cf2dac2d22dc7a18b614f43e/src/Citeproc/Types.hs#L901), so you should be able to use «subtitle» in styles. (This will give you warnings when using the style with Zotero and it won’t work reliably across implementations, but anyway ...)

3. if you’re using Zotero, you can leverage Zotero BBT’s postscript feature to manipulate the JSON after exporting.
E.g., this one :
if (Translator.BetterCSL && item.title) {
  reference.title = 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 <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> Im Auftrag von John Carter Wood
Gesendet: Freitag, 1. Juli 2022 16:39
An: pandoc-discuss <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Betreff: Changing colons to full-stops in titles

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).

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/period 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 they 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-citeproc-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-stops via using a filter? If so is there such a filter already around? Can this 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 Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an 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<https://groups.google.com/d/msgid/pandoc-discuss/78df697a-50f5-46d0-b0b8-29a2cbc9509an%40googlegroups.com?utm_medium=email&utm_source=footer>.
--
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@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<https://groups.google.com/d/msgid/pandoc-discuss/a2d540a6-a435-4285-aed5-018007d155cfn%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
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/bc85a4891eec431f846ee69f9fcbe167%40unibe.ch.

[-- Attachment #2: Type: text/html, Size: 17556 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: Changing colons to full-stops in titles
       [not found]                   ` <bc85a4891eec431f846ee69f9fcbe167-NSENcxR/0n0@public.gmane.org>
@ 2022-07-01 16:23                     ` John Carter Wood
       [not found]                       ` <f0f222ef-e60e-4397-83ac-bec1a6ac2d08n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 27+ messages in thread
From: John Carter Wood @ 2022-07-01 16:23 UTC (permalink / raw)
  To: pandoc-discuss


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

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 be 
-- 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 dot 
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’s a very simple and absolutely unreliable version of a filter. This 
> will replace every colon in a title with a period.
>
>  
>
> ```lua
>
> local stringify = pandoc.utils.stringify
>
> function Meta(m)
>
>   if m.references ~= nil then
>
>     for _, el in ipairs (m.references) do
>
>       print(stringify(el.title))
>
>       el.title = 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 <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> *Im 
> Auftrag von *John Carter Wood
> *Gesendet:* Freitag, 1. Juli 2022 17:52
> *An:* pandoc-discuss <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
> *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 saving 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 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 bibtex/biblatex as they 
> seemed to offer more flexibility (I was running into issue 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 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, then 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’s 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/BibTeX.hs
> )
>
>  
>
> 2. I think pandoc’s citeproc will just treat every unknown variable as a 
> string variable (see 
> https://github.com/jgm/citeproc/blob/3f94424db469c804cf2dac2d22dc7a18b614f43e/src/Citeproc/Types.hs#L1054 
> and 
> https://github.com/jgm/citeproc/blob/3f94424db469c804cf2dac2d22dc7a18b614f43e/src/Citeproc/Types.hs#L901), 
> so you should be able to use «subtitle» in styles. (This will give you 
> warnings when using the style with Zotero and it won’t work reliably across 
> implementations, but anyway ...)
>
>  
>
> 3. if you’re using Zotero, you can leverage Zotero BBT’s postscript 
> feature to manipulate the JSON after exporting.
>
> E.g., this one :
>
> if (Translator.BetterCSL && item.title) {
>
>   reference.title = 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 <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> *Im 
> Auftrag von *John Carter Wood
> *Gesendet:* Freitag, 1. Juli 2022 16:39
> *An:* pandoc-discuss <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
> *Betreff:* Changing colons to full-stops in titles
>
>  
>
> 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). 
>
>  
>
> 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/period 
> *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 they 
> 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-citeproc-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-stops 
> via using a filter? If so is there such a filter already around? Can this 
> 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 Groups 
> "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> 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 
> <https://groups.google.com/d/msgid/pandoc-discuss/78df697a-50f5-46d0-b0b8-29a2cbc9509an%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> -- 
> 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-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 
> <https://groups.google.com/d/msgid/pandoc-discuss/a2d540a6-a435-4285-aed5-018007d155cfn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/f0f222ef-e60e-4397-83ac-bec1a6ac2d08n%40googlegroups.com.

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

^ permalink raw reply	[flat|nested] 27+ messages in thread

* AW: Changing colons to full-stops in titles
       [not found]                       ` <f0f222ef-e60e-4397-83ac-bec1a6ac2d08n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2022-07-01 16:40                         ` denis.maier-NSENcxR/0n0
       [not found]                           ` <2a8d940b3675472fb4b50ead406f6fc7-NSENcxR/0n0@public.gmane.org>
  0 siblings, 1 reply; 27+ messages in thread
From: denis.maier-NSENcxR/0n0 @ 2022-07-01 16:40 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 9965 bytes --]

A slightly more reliable version:

```
local stringify = pandoc.utils.stringify
function Meta(m)
  if m.references ~= nil then
    for _, el in ipairs (m.references) do
      -- print(stringify(el.title))
      el.title = pandoc.Str(string.gsub(stringify(el.title), ': ', '. '))
      -- print(el.title)
    end
  end
  return m
end```

(This won’t 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 is 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’t think it should though.

Von: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> Im Auftrag von John Carter Wood
Gesendet: Freitag, 1. Juli 2022 18:24
An: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
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 be -- 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 dot is capitalised? Or does that open a new series of problems? :-)


denis...-NSENcxR/0n0@public.gmane.org<mailto:denis...-NSENcxR/0n0@public.gmane.org> schrieb am Freitag, 1. Juli 2022 um 18:17:02 UTC+2:
Here’s a very simple and absolutely unreliable version of a filter. This will replace every colon in a title with a period.

```lua
local stringify = pandoc.utils.stringify
function Meta(m)
  if m.references ~= nil then
    for _, el in ipairs (m.references) do
      print(stringify(el.title))
      el.title = 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 <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> Im Auftrag von John Carter Wood
Gesendet: Freitag, 1. Juli 2022 17:52
An: pandoc-discuss <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
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 saving 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 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 bibtex/biblatex as they seemed to offer more flexibility (I was running into issue 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 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, then 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’s 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/BibTeX.hs)

2. I think pandoc’s citeproc will just treat every unknown variable as a string variable (see https://github.com/jgm/citeproc/blob/3f94424db469c804cf2dac2d22dc7a18b614f43e/src/Citeproc/Types.hs#L1054 and https://github.com/jgm/citeproc/blob/3f94424db469c804cf2dac2d22dc7a18b614f43e/src/Citeproc/Types.hs#L901), so you should be able to use «subtitle» in styles. (This will give you warnings when using the style with Zotero and it won’t work reliably across implementations, but anyway ...)

3. if you’re using Zotero, you can leverage Zotero BBT’s postscript feature to manipulate the JSON after exporting.
E.g., this one :
if (Translator.BetterCSL && item.title) {
  reference.title = 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 <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> Im Auftrag von John Carter Wood
Gesendet: Freitag, 1. Juli 2022 16:39
An: pandoc-discuss <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Betreff: Changing colons to full-stops in titles

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).

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/period 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 they 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-citeproc-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-stops via using a filter? If so is there such a filter already around? Can this 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 Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an 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<https://groups.google.com/d/msgid/pandoc-discuss/78df697a-50f5-46d0-b0b8-29a2cbc9509an%40googlegroups.com?utm_medium=email&utm_source=footer>.
--
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-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<https://groups.google.com/d/msgid/pandoc-discuss/a2d540a6-a435-4285-aed5-018007d155cfn%40googlegroups.com?utm_medium=email&utm_source=footer>.
--
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@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<https://groups.google.com/d/msgid/pandoc-discuss/f0f222ef-e60e-4397-83ac-bec1a6ac2d08n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
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/2a8d940b3675472fb4b50ead406f6fc7%40unibe.ch.

[-- Attachment #2: Type: text/html, Size: 26339 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: Changing colons to full-stops in titles
       [not found]                           ` <2a8d940b3675472fb4b50ead406f6fc7-NSENcxR/0n0@public.gmane.org>
@ 2022-07-01 16:43                             ` John Carter Wood
       [not found]                               ` <b3deb0de-8ba0-4159-b9f3-1ecfbe68d457n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  2022-07-01 16:54                             ` AW: " Sukil Etxenike arizaleta
  2022-07-05 10:02                             ` John Carter Wood
  2 siblings, 1 reply; 27+ messages in thread
From: John Carter Wood @ 2022-07-01 16:43 UTC (permalink / raw)
  To: pandoc-discuss


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

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 = pandoc.utils.stringify
>
> function Meta(m)
>
>   if m.references ~= nil then
>
>     for _, el in ipairs (m.references) do
>
>       -- print(stringify(el.title))
>
>       el.title = pandoc.Str(string.gsub(stringify(el.title), ': ', '. '))
>
>       -- print(el.title)
>
>     end
>
>   end
>
>   return m
>
> end```
>
>  
>
> (This won’t 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 is 
> 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’t think it should 
> though.
>
>  
>
> *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-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
> *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 be 
> -- 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 dot 
> 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’s a very simple and absolutely unreliable version of a filter. This 
> will replace every colon in a title with a period.
>
>  
>
> ```lua
>
> local stringify = pandoc.utils.stringify
>
> function Meta(m)
>
>   if m.references ~= nil then
>
>     for _, el in ipairs (m.references) do
>
>       print(stringify(el.title))
>
>       el.title = 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 <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> *Im 
> Auftrag von *John Carter Wood
> *Gesendet:* Freitag, 1. Juli 2022 17:52
> *An:* pandoc-discuss <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
> *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 saving 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 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 bibtex/biblatex as they 
> seemed to offer more flexibility (I was running into issue 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 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, then 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’s 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/BibTeX.hs
> )
>
>  
>
> 2. I think pandoc’s citeproc will just treat every unknown variable as a 
> string variable (see 
> https://github.com/jgm/citeproc/blob/3f94424db469c804cf2dac2d22dc7a18b614f43e/src/Citeproc/Types.hs#L1054 
> and 
> https://github.com/jgm/citeproc/blob/3f94424db469c804cf2dac2d22dc7a18b614f43e/src/Citeproc/Types.hs#L901), 
> so you should be able to use «subtitle» in styles. (This will give you 
> warnings when using the style with Zotero and it won’t work reliably across 
> implementations, but anyway ...)
>
>  
>
> 3. if you’re using Zotero, you can leverage Zotero BBT’s postscript 
> feature to manipulate the JSON after exporting.
>
> E.g., this one :
>
> if (Translator.BetterCSL && item.title) {
>
>   reference.title = 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 <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> *Im 
> Auftrag von *John Carter Wood
> *Gesendet:* Freitag, 1. Juli 2022 16:39
> *An:* pandoc-discuss <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
> *Betreff:* Changing colons to full-stops in titles
>
>  
>
> 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). 
>
>  
>
> 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/period 
> *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 they 
> 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-citeproc-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-stops 
> via using a filter? If so is there such a filter already around? Can this 
> 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 Groups 
> "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> 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 
> <https://groups.google.com/d/msgid/pandoc-discuss/78df697a-50f5-46d0-b0b8-29a2cbc9509an%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> -- 
> 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-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 
> <https://groups.google.com/d/msgid/pandoc-discuss/a2d540a6-a435-4285-aed5-018007d155cfn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> -- 
> 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-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 
> <https://groups.google.com/d/msgid/pandoc-discuss/f0f222ef-e60e-4397-83ac-bec1a6ac2d08n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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.

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

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: AW: Changing colons to full-stops in titles
       [not found]                           ` <2a8d940b3675472fb4b50ead406f6fc7-NSENcxR/0n0@public.gmane.org>
  2022-07-01 16:43                             ` John Carter Wood
@ 2022-07-01 16:54                             ` Sukil Etxenike arizaleta
       [not found]                               ` <6621a84d-37f3-6741-bb0a-d4bfd6dac4bf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2022-07-05 10:02                             ` John Carter Wood
  2 siblings, 1 reply; 27+ messages in thread
From: Sukil Etxenike arizaleta @ 2022-07-01 16:54 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 12807 bytes --]

Denis, you beat me to it (I forgot about stringify and I ws not making 
progress).

El 01/07/2022 a las 18:23, John Carter Wood escribió:

> would this also ensure that the first word after the dot is capitalised? 

No, it won't ensure that the first character after the full stop is a 
capital. For that, you can change this line:

       el.title = pandoc.Str(string.gsub(stringify(el.title), ':', '.'))

With this one (haven't tested it but I think it should work):

       el.title = pandoc.Str(string.gsub(stringify(el.title), ': (%l)', 
'. %1'.lower()))

Hth,

Sukil


El 01/07/2022 a las 18:40, denis.maier-NSENcxR/0n0@public.gmane.org escribió:
>
> A slightly more reliable version:
>
> ```
>
> local stringify = pandoc.utils.stringify
>
> function Meta(m)
>
>   if m.references ~= nil then
>
>     for _, el in ipairs (m.references) do
>
>       -- print(stringify(el.title))
>
>       el.title = pandoc.Str(string.gsub(stringify(el.title), ': ', '. '))
>
> -- print(el.title)
>
> end
>
> end
>
> return m
>
> end```
>
> (This won’t 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 
> is 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’t 
> think it should though.
>
> *Von:*pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org 
> <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> *Im Auftrag von *John Carter Wood
> *Gesendet:* Freitag, 1. Juli 2022 18:24
> *An:* pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
> *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 be -- 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 
> dot 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’s a very simple and absolutely unreliable version of a
>     filter. This will replace every colon in a title with a period.
>
>     ```lua
>
>     local stringify = pandoc.utils.stringify
>
>     function Meta(m)
>
>       if m.references ~= nil then
>
>         for _, el in ipairs (m.references) do
>
>           print(stringify(el.title))
>
>           el.title = 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 <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
>     *Im Auftrag von *John Carter Wood
>     *Gesendet:* Freitag, 1. Juli 2022 17:52
>     *An:* pandoc-discuss <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
>     *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 saving 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 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 bibtex/biblatex as
>     they seemed to offer more flexibility (I was running into issue
>     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 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, then 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’s 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/BibTeX.hs
>         <https://github.com/jgm/pandoc/blob/master/src/Text/Pandoc/Citeproc/BibTeX.hs>)
>
>         2. I think pandoc’s citeproc will just treat every unknown
>         variable as a string variable (see
>         https://github.com/jgm/citeproc/blob/3f94424db469c804cf2dac2d22dc7a18b614f43e/src/Citeproc/Types.hs#L1054
>         <https://github.com/jgm/citeproc/blob/3f94424db469c804cf2dac2d22dc7a18b614f43e/src/Citeproc/Types.hs#L1054>
>         and
>         https://github.com/jgm/citeproc/blob/3f94424db469c804cf2dac2d22dc7a18b614f43e/src/Citeproc/Types.hs#L901),
>         so you should be able to use «subtitle» in styles. (This will
>         give you warnings when using the style with Zotero and it
>         won’t work reliably across implementations, but anyway ...)
>
>         3. if you’re using Zotero, you can leverage Zotero BBT’s
>         postscript feature to manipulate the JSON after exporting.
>
>         E.g., this one :
>
>         if (Translator.BetterCSL && item.title) {
>
>           reference.title = 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
>         <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> *Im Auftrag von *John Carter Wood
>         *Gesendet:* Freitag, 1. Juli 2022 16:39
>         *An:* pandoc-discuss <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
>         *Betreff:* Changing colons to full-stops in titles
>
>         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).
>
>         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/period *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 they
>         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-citeproc-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-stops via using a filter? If so is there such a filter
>         already around? Can this 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 Groups "pandoc-discuss" group.
>         To unsubscribe from this group and stop receiving emails from
>         it, send an 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
>         <https://groups.google.com/d/msgid/pandoc-discuss/78df697a-50f5-46d0-b0b8-29a2cbc9509an%40googlegroups.com?utm_medium=email&utm_source=footer>.
>
>     -- 
>     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-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
>     <https://groups.google.com/d/msgid/pandoc-discuss/a2d540a6-a435-4285-aed5-018007d155cfn%40googlegroups.com?utm_medium=email&utm_source=footer>.
>
> -- 
> 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/f0f222ef-e60e-4397-83ac-bec1a6ac2d08n%40googlegroups.com 
> <https://groups.google.com/d/msgid/pandoc-discuss/f0f222ef-e60e-4397-83ac-bec1a6ac2d08n%40googlegroups.com?utm_medium=email&utm_source=footer>.
>
> -- 
> 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/2a8d940b3675472fb4b50ead406f6fc7%40unibe.ch 
> <https://groups.google.com/d/msgid/pandoc-discuss/2a8d940b3675472fb4b50ead406f6fc7%40unibe.ch?utm_medium=email&utm_source=footer>.

-- 
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/6621a84d-37f3-6741-bb0a-d4bfd6dac4bf%40gmail.com.

[-- Attachment #2: Type: text/html, Size: 43357 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: AW: Changing colons to full-stops in titles
       [not found]                               ` <6621a84d-37f3-6741-bb0a-d4bfd6dac4bf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2022-07-01 17:28                                 ` Sukil Etxenike arizaleta
  0 siblings, 0 replies; 27+ messages in thread
From: Sukil Etxenike arizaleta @ 2022-07-01 17:28 UTC (permalink / raw)
  To: pandoc-discuss

[-- Attachment #1: Type: text/plain, Size: 13440 bytes --]

Woops, I mean this one (upper, not lower), and I needed a colon right 
before it, not a period):

       el.title = pandoc.Str(string.gsub(stringify(el.title), ': (%l)', 
'. %1':upper()))


Hth,
Sukil

El 01/07/2022 a las 18:54, Sukil Etxenike arizaleta escribió:
>
> Denis, you beat me to it (I forgot about stringify and I ws not making 
> progress).
>
> El 01/07/2022 a las 18:23, John Carter Wood escribió:
>
>> would this also ensure that the first word after the dot is capitalised? 
>
> No, it won't ensure that the first character after the full stop is a 
> capital. For that, you can change this line:
>
>       el.title = pandoc.Str(string.gsub(stringify(el.title), ':', '.'))
>
> With this one (haven't tested it but I think it should work):
>
>       el.title = pandoc.Str(string.gsub(stringify(el.title), ': (%l)', 
> '. %1'.lower()))
>
> Hth,
>
> Sukil
>
>
> El 01/07/2022 a las 18:40, denis.maier-NSENcxR/0n0@public.gmane.org escribió:
>>
>> A slightly more reliable version:
>>
>> ```
>>
>> local stringify = pandoc.utils.stringify
>>
>> function Meta(m)
>>
>>   if m.references ~= nil then
>>
>>     for _, el in ipairs (m.references) do
>>
>>       -- print(stringify(el.title))
>>
>>       el.title = pandoc.Str(string.gsub(stringify(el.title), ': ', '. '))
>>
>> -- print(el.title)
>>
>> end
>>
>> end
>>
>> return m
>>
>> end```
>>
>> (This won’t 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 is 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’t 
>> think it should though.
>>
>> *Von:*pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org 
>> <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> *Im Auftrag von *John Carter Wood
>> *Gesendet:* Freitag, 1. Juli 2022 18:24
>> *An:* pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
>> *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 be -- 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 
>> dot 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’s a very simple and absolutely unreliable version of a
>>     filter. This will replace every colon in a title with a period.
>>
>>     ```lua
>>
>>     local stringify = pandoc.utils.stringify
>>
>>     function Meta(m)
>>
>>       if m.references ~= nil then
>>
>>         for _, el in ipairs (m.references) do
>>
>>           print(stringify(el.title))
>>
>>           el.title = 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 <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
>>     *Im Auftrag von *John Carter Wood
>>     *Gesendet:* Freitag, 1. Juli 2022 17:52
>>     *An:* pandoc-discuss <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
>>     *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 saving 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
>>     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 bibtex/biblatex as
>>     they seemed to offer more flexibility (I was running into issue
>>     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 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, then 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’s 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/BibTeX.hs
>>         <https://github.com/jgm/pandoc/blob/master/src/Text/Pandoc/Citeproc/BibTeX.hs>)
>>
>>         2. I think pandoc’s citeproc will just treat every unknown
>>         variable as a string variable (see
>>         https://github.com/jgm/citeproc/blob/3f94424db469c804cf2dac2d22dc7a18b614f43e/src/Citeproc/Types.hs#L1054
>>         <https://github.com/jgm/citeproc/blob/3f94424db469c804cf2dac2d22dc7a18b614f43e/src/Citeproc/Types.hs#L1054>
>>         and
>>         https://github.com/jgm/citeproc/blob/3f94424db469c804cf2dac2d22dc7a18b614f43e/src/Citeproc/Types.hs#L901),
>>         so you should be able to use «subtitle» in styles. (This will
>>         give you warnings when using the style with Zotero and it
>>         won’t work reliably across implementations, but anyway ...)
>>
>>         3. if you’re using Zotero, you can leverage Zotero BBT’s
>>         postscript feature to manipulate the JSON after exporting.
>>
>>         E.g., this one :
>>
>>         if (Translator.BetterCSL && item.title) {
>>
>>           reference.title = 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
>>         <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> *Im Auftrag von *John Carter Wood
>>         *Gesendet:* Freitag, 1. Juli 2022 16:39
>>         *An:* pandoc-discuss <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
>>         *Betreff:* Changing colons to full-stops in titles
>>
>>         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).
>>
>>         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/period *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 they
>>         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-citeproc-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-stops via using a filter? If so is there such a
>>         filter already around? Can this 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 Groups "pandoc-discuss" group.
>>         To unsubscribe from this group and stop receiving emails from
>>         it, send an 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
>>         <https://groups.google.com/d/msgid/pandoc-discuss/78df697a-50f5-46d0-b0b8-29a2cbc9509an%40googlegroups.com?utm_medium=email&utm_source=footer>.
>>
>>     -- 
>>     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-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
>>     <https://groups.google.com/d/msgid/pandoc-discuss/a2d540a6-a435-4285-aed5-018007d155cfn%40googlegroups.com?utm_medium=email&utm_source=footer>.
>>
>> -- 
>> 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/f0f222ef-e60e-4397-83ac-bec1a6ac2d08n%40googlegroups.com 
>> <https://groups.google.com/d/msgid/pandoc-discuss/f0f222ef-e60e-4397-83ac-bec1a6ac2d08n%40googlegroups.com?utm_medium=email&utm_source=footer>.
>>
>> -- 
>> 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/2a8d940b3675472fb4b50ead406f6fc7%40unibe.ch 
>> <https://groups.google.com/d/msgid/pandoc-discuss/2a8d940b3675472fb4b50ead406f6fc7%40unibe.ch?utm_medium=email&utm_source=footer>.

-- 
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/b77d6ecf-8648-d6bc-3818-5a44cadd8a48%40gmail.com.

[-- Attachment #2: Type: text/html, Size: 46977 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: Changing colons to full-stops in titles
       [not found]       ` <78df697a-50f5-46d0-b0b8-29a2cbc9509an-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  2022-07-01 15:30         ` John MacFarlane
  2022-07-01 15:34         ` denis.maier-NSENcxR/0n0
@ 2022-07-02 16:28         ` BPJ
  2 siblings, 0 replies; 27+ messages in thread
From: BPJ @ 2022-07-02 16:28 UTC (permalink / raw)
  To: pandoc-discuss


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

I added an option for joining the subtitle to the title (with a
configurable separator) to my bibtex cleanup script (a wrapper around
BibTeX::Parser). Note that it replaces macros with Unicode characters by
default. Use the -D option to stop that!

/bpj

Den fre 1 juli 2022 16:39John Carter Wood <woodjo-ZOsAvrTRSvuEhhMi0yms2Q@public.gmane.org> skrev:

> 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).
>
> 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/period
> *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 they
> 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-citeproc-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-stops
> via using a filter? If so is there such a filter already around? Can this
> 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 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/78df697a-50f5-46d0-b0b8-29a2cbc9509an%40googlegroups.com
> <https://groups.google.com/d/msgid/pandoc-discuss/78df697a-50f5-46d0-b0b8-29a2cbc9509an%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CADAJKhBNaKPSMf4MQcoNVHvzgLV8xoFxn71giUhFKWpq5roPSQ%40mail.gmail.com.

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

[-- Attachment #2: cleanbib.zip --]
[-- Type: application/zip, Size: 4204 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: Changing colons to full-stops in titles
       [not found]                               ` <b3deb0de-8ba0-4159-b9f3-1ecfbe68d457n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2022-07-02 20:02                                 ` BPJ
       [not found]                                   ` <CADAJKhAU66TxJKMZdDM-KVabJpmKUVo5xyuAAN03F2b89jv9Ow-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 27+ messages in thread
From: BPJ @ 2022-07-02 20:02 UTC (permalink / raw)
  To: pandoc-discuss

[-- Attachment #1: Type: text/plain, Size: 12222 bytes --]

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 <woodjo-ZOsAvrTRSvuEhhMi0yms2Q@public.gmane.org> 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 = pandoc.utils.stringify
>>
>> function Meta(m)
>>
>>   if m.references ~= nil then
>>
>>     for _, el in ipairs (m.references) do
>>
>>       -- print(stringify(el.title))
>>
>>       el.title = pandoc.Str(string.gsub(stringify(el.title), ': ', '. '))
>>
>>       -- print(el.title)
>>
>>     end
>>
>>   end
>>
>>   return m
>>
>> end```
>>
>>
>>
>> (This won’t 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 is
>> 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’t think it should
>> though.
>>
>>
>>
>> *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-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
>> *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 be
>> -- 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 dot
>> 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’s a very simple and absolutely unreliable version of a filter. This
>> will replace every colon in a title with a period.
>>
>>
>>
>> ```lua
>>
>> local stringify = pandoc.utils.stringify
>>
>> function Meta(m)
>>
>>   if m.references ~= nil then
>>
>>     for _, el in ipairs (m.references) do
>>
>>       print(stringify(el.title))
>>
>>       el.title = 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 <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> *Im
>> Auftrag von *John Carter Wood
>> *Gesendet:* Freitag, 1. Juli 2022 17:52
>> *An:* pandoc-discuss <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
>> *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 saving
>> 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 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 bibtex/biblatex as they
>> seemed to offer more flexibility (I was running into issue 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 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, then
>> 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’s 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/BibTeX.hs
>> )
>>
>>
>>
>> 2. I think pandoc’s citeproc will just treat every unknown variable as a
>> string variable (see
>> https://github.com/jgm/citeproc/blob/3f94424db469c804cf2dac2d22dc7a18b614f43e/src/Citeproc/Types.hs#L1054
>> and
>> https://github.com/jgm/citeproc/blob/3f94424db469c804cf2dac2d22dc7a18b614f43e/src/Citeproc/Types.hs#L901),
>> so you should be able to use «subtitle» in styles. (This will give you
>> warnings when using the style with Zotero and it won’t work reliably across
>> implementations, but anyway ...)
>>
>>
>>
>> 3. if you’re using Zotero, you can leverage Zotero BBT’s postscript
>> feature to manipulate the JSON after exporting.
>>
>> E.g., this one :
>>
>> if (Translator.BetterCSL && item.title) {
>>
>>   reference.title = 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 <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> *Im
>> Auftrag von *John Carter Wood
>> *Gesendet:* Freitag, 1. Juli 2022 16:39
>> *An:* pandoc-discuss <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
>> *Betreff:* Changing colons to full-stops in titles
>>
>>
>>
>> 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).
>>
>>
>>
>> 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/period
>> *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 they
>> 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-citeproc-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-stops
>> via using a filter? If so is there such a filter already around? Can this
>> 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 Groups
>> "pandoc-discuss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> 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
>> <https://groups.google.com/d/msgid/pandoc-discuss/78df697a-50f5-46d0-b0b8-29a2cbc9509an%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> --
>> 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-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
>> <https://groups.google.com/d/msgid/pandoc-discuss/a2d540a6-a435-4285-aed5-018007d155cfn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> --
>> 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-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
>> <https://groups.google.com/d/msgid/pandoc-discuss/f0f222ef-e60e-4397-83ac-bec1a6ac2d08n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> 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
> <https://groups.google.com/d/msgid/pandoc-discuss/b3deb0de-8ba0-4159-b9f3-1ecfbe68d457n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CADAJKhAU66TxJKMZdDM-KVabJpmKUVo5xyuAAN03F2b89jv9Ow%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 23574 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: Changing colons to full-stops in titles
       [not found]                                   ` <CADAJKhAU66TxJKMZdDM-KVabJpmKUVo5xyuAAN03F2b89jv9Ow-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2022-07-03  5:41                                     ` Paulo Ney de Souza
       [not found]                                       ` <CAFVhNZMyj_GZ=Ao_1qR2rwnAAYAaQ=Maf880cGLRv7yD_ianpQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 27+ messages in thread
From: Paulo Ney de Souza @ 2022-07-03  5:41 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 13956 bytes --]

I got interested in another aspect of the posting -- the program "
cleanbib.pl" by Benct.

I installed it in Ubuntu, and found out it does not process perfectly valid
TeX code like characters that end or have a space in the middle, or that it
processes \c{e}, but not the comma-accent any of the other vowels...

I prepared the torture test below to show the problems:

@Book{hobbit,
  title    = {Les \oe uf  de la serpente},
  address = {Bla\v zi\'c},
  publisher = {\c{a} \c{e} \c{i} \c{o} \c{u}},
}

and above all, how does this compare to:

    https://ctan.org/tex-archive/support/bibtexperllibs/LaTeX-ToUnicode

Paulo Ney


On Sat, Jul 2, 2022 at 1:03 PM BPJ <bpj-J3H7GcXPSITLoDKTGw+V6w@public.gmane.org> wrote:

> 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 <woodjo-ZOsAvrTRSvuEhhMi0yms2Q@public.gmane.org> 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 = pandoc.utils.stringify
>>>
>>> function Meta(m)
>>>
>>>   if m.references ~= nil then
>>>
>>>     for _, el in ipairs (m.references) do
>>>
>>>       -- print(stringify(el.title))
>>>
>>>       el.title = pandoc.Str(string.gsub(stringify(el.title), ': ', '.
>>> '))
>>>
>>>       -- print(el.title)
>>>
>>>     end
>>>
>>>   end
>>>
>>>   return m
>>>
>>> end```
>>>
>>>
>>>
>>> (This won’t 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
>>> is 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’t think it
>>> should though.
>>>
>>>
>>>
>>> *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-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
>>> *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 be
>>> -- 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
>>> dot 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’s a very simple and absolutely unreliable version of a filter. This
>>> will replace every colon in a title with a period.
>>>
>>>
>>>
>>> ```lua
>>>
>>> local stringify = pandoc.utils.stringify
>>>
>>> function Meta(m)
>>>
>>>   if m.references ~= nil then
>>>
>>>     for _, el in ipairs (m.references) do
>>>
>>>       print(stringify(el.title))
>>>
>>>       el.title = 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 <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> *Im
>>> Auftrag von *John Carter Wood
>>> *Gesendet:* Freitag, 1. Juli 2022 17:52
>>> *An:* pandoc-discuss <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
>>> *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 saving
>>> 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 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 bibtex/biblatex as they
>>> seemed to offer more flexibility (I was running into issue 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 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, then
>>> 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’s 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/BibTeX.hs
>>> )
>>>
>>>
>>>
>>> 2. I think pandoc’s citeproc will just treat every unknown variable as a
>>> string variable (see
>>> https://github.com/jgm/citeproc/blob/3f94424db469c804cf2dac2d22dc7a18b614f43e/src/Citeproc/Types.hs#L1054
>>> and
>>> https://github.com/jgm/citeproc/blob/3f94424db469c804cf2dac2d22dc7a18b614f43e/src/Citeproc/Types.hs#L901),
>>> so you should be able to use «subtitle» in styles. (This will give you
>>> warnings when using the style with Zotero and it won’t work reliably across
>>> implementations, but anyway ...)
>>>
>>>
>>>
>>> 3. if you’re using Zotero, you can leverage Zotero BBT’s postscript
>>> feature to manipulate the JSON after exporting.
>>>
>>> E.g., this one :
>>>
>>> if (Translator.BetterCSL && item.title) {
>>>
>>>   reference.title = 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 <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> *Im
>>> Auftrag von *John Carter Wood
>>> *Gesendet:* Freitag, 1. Juli 2022 16:39
>>> *An:* pandoc-discuss <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
>>> *Betreff:* Changing colons to full-stops in titles
>>>
>>>
>>>
>>> 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).
>>>
>>>
>>>
>>> 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/period
>>> *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 they
>>> 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-citeproc-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-stops via using a filter? If so is there such a filter already around?
>>> Can this 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
>>> Groups "pandoc-discuss" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an 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
>>> <https://groups.google.com/d/msgid/pandoc-discuss/78df697a-50f5-46d0-b0b8-29a2cbc9509an%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> --
>>> 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-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
>>> <https://groups.google.com/d/msgid/pandoc-discuss/a2d540a6-a435-4285-aed5-018007d155cfn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> --
>>> 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-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
>>> <https://groups.google.com/d/msgid/pandoc-discuss/f0f222ef-e60e-4397-83ac-bec1a6ac2d08n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> 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
>> <https://groups.google.com/d/msgid/pandoc-discuss/b3deb0de-8ba0-4159-b9f3-1ecfbe68d457n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> 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/CADAJKhAU66TxJKMZdDM-KVabJpmKUVo5xyuAAN03F2b89jv9Ow%40mail.gmail.com
> <https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhAU66TxJKMZdDM-KVabJpmKUVo5xyuAAN03F2b89jv9Ow%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAFVhNZMyj_GZ%3DAo_1qR2rwnAAYAaQ%3DMaf880cGLRv7yD_ianpQ%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 25987 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: Changing colons to full-stops in titles
       [not found]                                       ` <CAFVhNZMyj_GZ=Ao_1qR2rwnAAYAaQ=Maf880cGLRv7yD_ianpQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2022-07-03 12:15                                         ` BPJ
       [not found]                                           ` <CADAJKhBjTdgbY-xDouhDGfnE+J+V5c3v0FUA2Hn00z59==WeLw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 27+ messages in thread
From: BPJ @ 2022-07-03 12:15 UTC (permalink / raw)
  To: pandoc-discuss

[-- Attachment #1: Type: text/plain, Size: 15507 bytes --]

It's an upstream bug in LaTeX::ToUnicode. I just had never run into it
AFAIK because all the .bib files I had written myself or downloaded from
the libraries I use had used `\"{a}` rather than `\"a` which doesn't hit
the bug. I have located the bug and am working on a patch. Thanks for
discovering this! (There are a lot of unattended bugs though. Do you want
me to send you the patch when it is ready?)

Den sön 3 juli 2022 07:42Paulo Ney de Souza <pauloney-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev:

> I got interested in another aspect of the posting -- the program "
> cleanbib.pl" by Benct.
>
> I installed it in Ubuntu, and found out it does not process perfectly
> valid TeX code like characters that end or have a space in the middle, or
> that it processes \c{e}, but not the comma-accent any of the other vowels...
>
> I prepared the torture test below to show the problems:
>
> @Book{hobbit,
>   title    = {Les \oe uf  de la serpente},
>   address = {Bla\v zi\'c},
>   publisher = {\c{a} \c{e} \c{i} \c{o} \c{u}},
> }
>
> and above all, how does this compare to:
>
>     https://ctan.org/tex-archive/support/bibtexperllibs/LaTeX-ToUnicode
>
> Paulo Ney
>
>
> On Sat, Jul 2, 2022 at 1:03 PM BPJ <bpj-J3H7GcXPSITLoDKTGw+V6w@public.gmane.org> wrote:
>
>> 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 <woodjo-ZOsAvrTRSvuEhhMi0yms2Q@public.gmane.org> 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 = pandoc.utils.stringify
>>>>
>>>> function Meta(m)
>>>>
>>>>   if m.references ~= nil then
>>>>
>>>>     for _, el in ipairs (m.references) do
>>>>
>>>>       -- print(stringify(el.title))
>>>>
>>>>       el.title = pandoc.Str(string.gsub(stringify(el.title), ': ', '.
>>>> '))
>>>>
>>>>       -- print(el.title)
>>>>
>>>>     end
>>>>
>>>>   end
>>>>
>>>>   return m
>>>>
>>>> end```
>>>>
>>>>
>>>>
>>>> (This won’t 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
>>>> is 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’t think it
>>>> should though.
>>>>
>>>>
>>>>
>>>> *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-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
>>>> *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 be
>>>> -- 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
>>>> dot 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’s a very simple and absolutely unreliable version of a filter.
>>>> This will replace every colon in a title with a period.
>>>>
>>>>
>>>>
>>>> ```lua
>>>>
>>>> local stringify = pandoc.utils.stringify
>>>>
>>>> function Meta(m)
>>>>
>>>>   if m.references ~= nil then
>>>>
>>>>     for _, el in ipairs (m.references) do
>>>>
>>>>       print(stringify(el.title))
>>>>
>>>>       el.title = 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 <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> *Im
>>>> Auftrag von *John Carter Wood
>>>> *Gesendet:* Freitag, 1. Juli 2022 17:52
>>>> *An:* pandoc-discuss <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
>>>> *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 saving
>>>> 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 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 bibtex/biblatex as they
>>>> seemed to offer more flexibility (I was running into issue 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 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, then
>>>> 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’s 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/BibTeX.hs
>>>> )
>>>>
>>>>
>>>>
>>>> 2. I think pandoc’s citeproc will just treat every unknown variable as
>>>> a string variable (see
>>>> https://github.com/jgm/citeproc/blob/3f94424db469c804cf2dac2d22dc7a18b614f43e/src/Citeproc/Types.hs#L1054
>>>> and
>>>> https://github.com/jgm/citeproc/blob/3f94424db469c804cf2dac2d22dc7a18b614f43e/src/Citeproc/Types.hs#L901),
>>>> so you should be able to use «subtitle» in styles. (This will give you
>>>> warnings when using the style with Zotero and it won’t work reliably across
>>>> implementations, but anyway ...)
>>>>
>>>>
>>>>
>>>> 3. if you’re using Zotero, you can leverage Zotero BBT’s postscript
>>>> feature to manipulate the JSON after exporting.
>>>>
>>>> E.g., this one :
>>>>
>>>> if (Translator.BetterCSL && item.title) {
>>>>
>>>>   reference.title = 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 <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> *Im
>>>> Auftrag von *John Carter Wood
>>>> *Gesendet:* Freitag, 1. Juli 2022 16:39
>>>> *An:* pandoc-discuss <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
>>>> *Betreff:* Changing colons to full-stops in titles
>>>>
>>>>
>>>>
>>>> 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).
>>>>
>>>>
>>>>
>>>> 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/period
>>>> *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 they
>>>> 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-citeproc-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-stops via using a filter? If so is there such a filter already around?
>>>> Can this 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
>>>> Groups "pandoc-discuss" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an 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
>>>> <https://groups.google.com/d/msgid/pandoc-discuss/78df697a-50f5-46d0-b0b8-29a2cbc9509an%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>> --
>>>> 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-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
>>>> <https://groups.google.com/d/msgid/pandoc-discuss/a2d540a6-a435-4285-aed5-018007d155cfn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>> --
>>>> 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-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
>>>> <https://groups.google.com/d/msgid/pandoc-discuss/f0f222ef-e60e-4397-83ac-bec1a6ac2d08n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> --
>>> 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
>>> <https://groups.google.com/d/msgid/pandoc-discuss/b3deb0de-8ba0-4159-b9f3-1ecfbe68d457n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> 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/CADAJKhAU66TxJKMZdDM-KVabJpmKUVo5xyuAAN03F2b89jv9Ow%40mail.gmail.com
>> <https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhAU66TxJKMZdDM-KVabJpmKUVo5xyuAAN03F2b89jv9Ow%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> 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/CAFVhNZMyj_GZ%3DAo_1qR2rwnAAYAaQ%3DMaf880cGLRv7yD_ianpQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/pandoc-discuss/CAFVhNZMyj_GZ%3DAo_1qR2rwnAAYAaQ%3DMaf880cGLRv7yD_ianpQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CADAJKhBjTdgbY-xDouhDGfnE%2BJ%2BV5c3v0FUA2Hn00z59%3D%3DWeLw%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 28047 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: Changing colons to full-stops in titles
       [not found]                                           ` <CADAJKhBjTdgbY-xDouhDGfnE+J+V5c3v0FUA2Hn00z59==WeLw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2022-07-03 16:53                                             ` Paulo Ney de Souza
       [not found]                                               ` <CAFVhNZNNsfQs_Lt8agoaseyrNfdhrVOC9GTusMEdfecJFCBnug-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 27+ messages in thread
From: Paulo Ney de Souza @ 2022-07-03 16:53 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 17001 bytes --]

On Sun, Jul 3, 2022 at 5:15 AM BPJ <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

> It's an upstream bug in LaTeX::ToUnicode.
>

On  LaTeX::ToUnicode ? I thought you only used BibTeX::Parser.

I just had never run into it AFAIK because all the .bib files I had written
> myself or downloaded from the libraries I use had used `\"{a}` rather than
> `\"a` which doesn't hit the bug. I have located the bug and am working on a
> patch. Thanks for discovering this! (There are a lot of unattended bugs
> though. Do you want me to send you the patch when it is ready?)
>

I know of some bugs on BibTeX::Parser (and none on LaTeX::ToUnicode). It
would be nice to have all of them listed o the issues of the project page:

    https://github.com/borisveytsman/BibTeXPerlLibs/issues

especially if you are producing a patch.

Paulo Ney



> Den sön 3 juli 2022 07:42Paulo Ney de Souza <pauloney-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev:
>
>> I got interested in another aspect of the posting -- the program "
>> cleanbib.pl" by Benct.
>>
>> I installed it in Ubuntu, and found out it does not process perfectly
>> valid TeX code like characters that end or have a space in the middle, or
>> that it processes \c{e}, but not the comma-accent any of the other vowels...
>>
>> I prepared the torture test below to show the problems:
>>
>> @Book{hobbit,
>>   title    = {Les \oe uf  de la serpente},
>>   address = {Bla\v zi\'c},
>>   publisher = {\c{a} \c{e} \c{i} \c{o} \c{u}},
>> }
>>
>> and above all, how does this compare to:
>>
>>     https://ctan.org/tex-archive/support/bibtexperllibs/LaTeX-ToUnicode
>>
>> Paulo Ney
>>
>>
>> On Sat, Jul 2, 2022 at 1:03 PM BPJ <bpj-J3H7GcXPSITLoDKTGw+V6w@public.gmane.org> wrote:
>>
>>> 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 <woodjo-ZOsAvrTRSvuEhhMi0yms2Q@public.gmane.org> 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 = pandoc.utils.stringify
>>>>>
>>>>> function Meta(m)
>>>>>
>>>>>   if m.references ~= nil then
>>>>>
>>>>>     for _, el in ipairs (m.references) do
>>>>>
>>>>>       -- print(stringify(el.title))
>>>>>
>>>>>       el.title = pandoc.Str(string.gsub(stringify(el.title), ': ', '.
>>>>> '))
>>>>>
>>>>>       -- print(el.title)
>>>>>
>>>>>     end
>>>>>
>>>>>   end
>>>>>
>>>>>   return m
>>>>>
>>>>> end```
>>>>>
>>>>>
>>>>>
>>>>> (This won’t 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
>>>>> is 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’t think it
>>>>> should though.
>>>>>
>>>>>
>>>>>
>>>>> *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-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
>>>>> *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 be -- 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
>>>>> dot 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’s a very simple and absolutely unreliable version of a filter.
>>>>> This will replace every colon in a title with a period.
>>>>>
>>>>>
>>>>>
>>>>> ```lua
>>>>>
>>>>> local stringify = pandoc.utils.stringify
>>>>>
>>>>> function Meta(m)
>>>>>
>>>>>   if m.references ~= nil then
>>>>>
>>>>>     for _, el in ipairs (m.references) do
>>>>>
>>>>>       print(stringify(el.title))
>>>>>
>>>>>       el.title = 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 <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> *Im
>>>>> Auftrag von *John Carter Wood
>>>>> *Gesendet:* Freitag, 1. Juli 2022 17:52
>>>>> *An:* pandoc-discuss <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
>>>>> *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 saving
>>>>> 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 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 bibtex/biblatex as they
>>>>> seemed to offer more flexibility (I was running into issue 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 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, then
>>>>> 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’s 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/BibTeX.hs
>>>>> )
>>>>>
>>>>>
>>>>>
>>>>> 2. I think pandoc’s citeproc will just treat every unknown variable as
>>>>> a string variable (see
>>>>> https://github.com/jgm/citeproc/blob/3f94424db469c804cf2dac2d22dc7a18b614f43e/src/Citeproc/Types.hs#L1054
>>>>> and
>>>>> https://github.com/jgm/citeproc/blob/3f94424db469c804cf2dac2d22dc7a18b614f43e/src/Citeproc/Types.hs#L901),
>>>>> so you should be able to use «subtitle» in styles. (This will give you
>>>>> warnings when using the style with Zotero and it won’t work reliably across
>>>>> implementations, but anyway ...)
>>>>>
>>>>>
>>>>>
>>>>> 3. if you’re using Zotero, you can leverage Zotero BBT’s postscript
>>>>> feature to manipulate the JSON after exporting.
>>>>>
>>>>> E.g., this one :
>>>>>
>>>>> if (Translator.BetterCSL && item.title) {
>>>>>
>>>>>   reference.title = 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 <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> *Im
>>>>> Auftrag von *John Carter Wood
>>>>> *Gesendet:* Freitag, 1. Juli 2022 16:39
>>>>> *An:* pandoc-discuss <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
>>>>> *Betreff:* Changing colons to full-stops in titles
>>>>>
>>>>>
>>>>>
>>>>> 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).
>>>>>
>>>>>
>>>>>
>>>>> 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/period
>>>>> *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 they
>>>>> 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-citeproc-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-stops via using a filter? If so is there such a filter already around?
>>>>> Can this 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
>>>>> Groups "pandoc-discuss" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an 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
>>>>> <https://groups.google.com/d/msgid/pandoc-discuss/78df697a-50f5-46d0-b0b8-29a2cbc9509an%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>>> --
>>>>> 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-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
>>>>> <https://groups.google.com/d/msgid/pandoc-discuss/a2d540a6-a435-4285-aed5-018007d155cfn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>>> --
>>>>> 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-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
>>>>> <https://groups.google.com/d/msgid/pandoc-discuss/f0f222ef-e60e-4397-83ac-bec1a6ac2d08n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>> --
>>>> 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
>>>> <https://groups.google.com/d/msgid/pandoc-discuss/b3deb0de-8ba0-4159-b9f3-1ecfbe68d457n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> --
>>> 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/CADAJKhAU66TxJKMZdDM-KVabJpmKUVo5xyuAAN03F2b89jv9Ow%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhAU66TxJKMZdDM-KVabJpmKUVo5xyuAAN03F2b89jv9Ow%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> 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/CAFVhNZMyj_GZ%3DAo_1qR2rwnAAYAaQ%3DMaf880cGLRv7yD_ianpQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/pandoc-discuss/CAFVhNZMyj_GZ%3DAo_1qR2rwnAAYAaQ%3DMaf880cGLRv7yD_ianpQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> 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/CADAJKhBjTdgbY-xDouhDGfnE%2BJ%2BV5c3v0FUA2Hn00z59%3D%3DWeLw%40mail.gmail.com
> <https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhBjTdgbY-xDouhDGfnE%2BJ%2BV5c3v0FUA2Hn00z59%3D%3DWeLw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAFVhNZNNsfQs_Lt8agoaseyrNfdhrVOC9GTusMEdfecJFCBnug%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 30139 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: Changing colons to full-stops in titles
       [not found]                                               ` <CAFVhNZNNsfQs_Lt8agoaseyrNfdhrVOC9GTusMEdfecJFCBnug-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2022-07-03 19:43                                                 ` BPJ
       [not found]                                                   ` <CADAJKhCjht=mJqUgEbyHQWcp+P5gKjYUoEfe4VQAOa6SS1b5Ag-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 27+ messages in thread
From: BPJ @ 2022-07-03 19:43 UTC (permalink / raw)
  To: pandoc-discuss

[-- Attachment #1: Type: text/plain, Size: 18513 bytes --]

Den sön 3 juli 2022 18:55Paulo Ney de Souza <pauloney-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev:

>
> On Sun, Jul 3, 2022 at 5:15 AM BPJ <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
>> It's an upstream bug in LaTeX::ToUnicode.
>>
>
> On  LaTeX::ToUnicode ? I thought you only used BibTeX::Parser.
>

Which uses LaTeX::ToUnicode in its `cleaned_*` methods.



> I just had never run into it AFAIK because all the .bib files I had
>> written myself or downloaded from the libraries I use had used `\"{a}`
>> rather than `\"a` which doesn't hit the bug. I have located the bug and am
>> working on a patch. Thanks for discovering this! (There are a lot of
>> unattended bugs though. Do you want me to send you the patch when it is
>> ready?)
>>
>
> I know of some bugs on BibTeX::Parser (and none on LaTeX::ToUnicode).
>

There are some on the old CPAN RT tracker. I don't know if they are de
facto fixed.


It would be nice to have all of them listed o the issues of the project
> page:
>
>     https://github.com/borisveytsman/BibTeXPerlLibs/issues
>

Thanks for the link. It is missing on MetaCPAN. One of the old bugs
complains about sloppy packaging.



> especially if you are producing a patch.
>

Well it will be listed when I submit a PR!



> Paulo Ney
>
>
>
>> Den sön 3 juli 2022 07:42Paulo Ney de Souza <pauloney-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev:
>>
>>> I got interested in another aspect of the posting -- the program "
>>> cleanbib.pl" by Benct.
>>>
>>> I installed it in Ubuntu, and found out it does not process perfectly
>>> valid TeX code like characters that end or have a space in the middle, or
>>> that it processes \c{e}, but not the comma-accent any of the other vowels...
>>>
>>> I prepared the torture test below to show the problems:
>>>
>>> @Book{hobbit,
>>>   title    = {Les \oe uf  de la serpente},
>>>   address = {Bla\v zi\'c},
>>>   publisher = {\c{a} \c{e} \c{i} \c{o} \c{u}},
>>> }
>>>
>>> and above all, how does this compare to:
>>>
>>>     https://ctan.org/tex-archive/support/bibtexperllibs/LaTeX-ToUnicode
>>>
>>> Paulo Ney
>>>
>>>
>>> On Sat, Jul 2, 2022 at 1:03 PM BPJ <bpj-J3H7GcXPSITLoDKTGw+V6w@public.gmane.org> wrote:
>>>
>>>> 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 <woodjo-ZOsAvrTRSvuEhhMi0yms2Q@public.gmane.org> 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 = pandoc.utils.stringify
>>>>>>
>>>>>> function Meta(m)
>>>>>>
>>>>>>   if m.references ~= nil then
>>>>>>
>>>>>>     for _, el in ipairs (m.references) do
>>>>>>
>>>>>>       -- print(stringify(el.title))
>>>>>>
>>>>>>       el.title = pandoc.Str(string.gsub(stringify(el.title), ': ', '.
>>>>>> '))
>>>>>>
>>>>>>       -- print(el.title)
>>>>>>
>>>>>>     end
>>>>>>
>>>>>>   end
>>>>>>
>>>>>>   return m
>>>>>>
>>>>>> end```
>>>>>>
>>>>>>
>>>>>>
>>>>>> (This won’t 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 is 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’t think it
>>>>>> should though.
>>>>>>
>>>>>>
>>>>>>
>>>>>> *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-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
>>>>>> *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 be -- 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
>>>>>> dot 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’s a very simple and absolutely unreliable version of a filter.
>>>>>> This will replace every colon in a title with a period.
>>>>>>
>>>>>>
>>>>>>
>>>>>> ```lua
>>>>>>
>>>>>> local stringify = pandoc.utils.stringify
>>>>>>
>>>>>> function Meta(m)
>>>>>>
>>>>>>   if m.references ~= nil then
>>>>>>
>>>>>>     for _, el in ipairs (m.references) do
>>>>>>
>>>>>>       print(stringify(el.title))
>>>>>>
>>>>>>       el.title = 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 <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> *Im
>>>>>> Auftrag von *John Carter Wood
>>>>>> *Gesendet:* Freitag, 1. Juli 2022 17:52
>>>>>> *An:* pandoc-discuss <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
>>>>>> *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 saving
>>>>>> 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 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 bibtex/biblatex as
>>>>>> they seemed to offer more flexibility (I was running into issue 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 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, then
>>>>>> 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’s 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/BibTeX.hs
>>>>>> )
>>>>>>
>>>>>>
>>>>>>
>>>>>> 2. I think pandoc’s citeproc will just treat every unknown variable
>>>>>> as a string variable (see
>>>>>> https://github.com/jgm/citeproc/blob/3f94424db469c804cf2dac2d22dc7a18b614f43e/src/Citeproc/Types.hs#L1054
>>>>>> and
>>>>>> https://github.com/jgm/citeproc/blob/3f94424db469c804cf2dac2d22dc7a18b614f43e/src/Citeproc/Types.hs#L901),
>>>>>> so you should be able to use «subtitle» in styles. (This will give you
>>>>>> warnings when using the style with Zotero and it won’t work reliably across
>>>>>> implementations, but anyway ...)
>>>>>>
>>>>>>
>>>>>>
>>>>>> 3. if you’re using Zotero, you can leverage Zotero BBT’s postscript
>>>>>> feature to manipulate the JSON after exporting.
>>>>>>
>>>>>> E.g., this one :
>>>>>>
>>>>>> if (Translator.BetterCSL && item.title) {
>>>>>>
>>>>>>   reference.title = 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 <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> *Im
>>>>>> Auftrag von *John Carter Wood
>>>>>> *Gesendet:* Freitag, 1. Juli 2022 16:39
>>>>>> *An:* pandoc-discuss <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
>>>>>> *Betreff:* Changing colons to full-stops in titles
>>>>>>
>>>>>>
>>>>>>
>>>>>> 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).
>>>>>>
>>>>>>
>>>>>>
>>>>>> 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/period
>>>>>> *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 they 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-citeproc-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-stops via using a filter? If so is there such a filter already around?
>>>>>> Can this 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
>>>>>> Groups "pandoc-discuss" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>> send an 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
>>>>>> <https://groups.google.com/d/msgid/pandoc-discuss/78df697a-50f5-46d0-b0b8-29a2cbc9509an%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>>
>>>>>> --
>>>>>> 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-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
>>>>>> <https://groups.google.com/d/msgid/pandoc-discuss/a2d540a6-a435-4285-aed5-018007d155cfn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>>
>>>>>> --
>>>>>> 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-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
>>>>>> <https://groups.google.com/d/msgid/pandoc-discuss/f0f222ef-e60e-4397-83ac-bec1a6ac2d08n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>>
>>>>> --
>>>>> 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
>>>>> <https://groups.google.com/d/msgid/pandoc-discuss/b3deb0de-8ba0-4159-b9f3-1ecfbe68d457n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>> --
>>>> 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/CADAJKhAU66TxJKMZdDM-KVabJpmKUVo5xyuAAN03F2b89jv9Ow%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhAU66TxJKMZdDM-KVabJpmKUVo5xyuAAN03F2b89jv9Ow%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> --
>>> 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/CAFVhNZMyj_GZ%3DAo_1qR2rwnAAYAaQ%3DMaf880cGLRv7yD_ianpQ%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/pandoc-discuss/CAFVhNZMyj_GZ%3DAo_1qR2rwnAAYAaQ%3DMaf880cGLRv7yD_ianpQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> 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/CADAJKhBjTdgbY-xDouhDGfnE%2BJ%2BV5c3v0FUA2Hn00z59%3D%3DWeLw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhBjTdgbY-xDouhDGfnE%2BJ%2BV5c3v0FUA2Hn00z59%3D%3DWeLw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> 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/CAFVhNZNNsfQs_Lt8agoaseyrNfdhrVOC9GTusMEdfecJFCBnug%40mail.gmail.com
> <https://groups.google.com/d/msgid/pandoc-discuss/CAFVhNZNNsfQs_Lt8agoaseyrNfdhrVOC9GTusMEdfecJFCBnug%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CADAJKhCjht%3DmJqUgEbyHQWcp%2BP5gKjYUoEfe4VQAOa6SS1b5Ag%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 33501 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: Changing colons to full-stops in titles
       [not found]                                                   ` <CADAJKhCjht=mJqUgEbyHQWcp+P5gKjYUoEfe4VQAOa6SS1b5Ag-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2022-07-04  9:09                                                     ` BPJ
  0 siblings, 0 replies; 27+ messages in thread
From: BPJ @ 2022-07-04  9:09 UTC (permalink / raw)
  To: pandoc-discuss

[-- Attachment #1: Type: text/plain, Size: 20441 bytes --]

It turns out "my" bug is already fixed in the development version of
LaTeX::ToUnicode. Compare the CPAN version

https://metacpan.org/dist/LaTeX-ToUnicode/source/lib/LaTeX/ToUnicode.pm#L46

with current master:

https://github.com/borisveytsman/BibTeXPerlLibs/blob/5d24b66bd2461f1f3fc4d9a28dd8774ad6c75829/LaTeX-ToUnicode/lib/LaTeX/ToUnicode.pm#L314

The crucial difference is `\w{1,1}` vs. `\w{1,2}`. Given e.g. `Fr\"oding`
the latter would always match two letters and try to look up
`$ACCENTS{'"'}{od}` rather than `$ACCENTS{'"'}{o}`, which would fail.

You should be able to install the development version by cloning the GitHub
repo, coding to LaTeX-ToUnicode and saying `cpanm --force .` The force is
because a couple of conversion tests (`\$` -> `$` and `\&` -> `&`) still
fail. If you don't have cpanm installed you need to say `cpan
App::cpanminus` first.

However it still fails one of my test cases which I wrote yesterday: it
leaves inputs like `\'{\ae}` and `\"{\ae}` which TeX is perfectly fine with
as `\'æ \"æ`. The first of these exists precomposed in Unicode because
Danish sometimes uses it so is definitely a bug and the second should
arguably be replaced with letter + combining mark, so I will likely make a
couple of pull requests as and when I have time.

/bpj


Den sön 3 juli 2022 21:43BPJ <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev:

>
>
> Den sön 3 juli 2022 18:55Paulo Ney de Souza <pauloney-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev:
>
>>
>> On Sun, Jul 3, 2022 at 5:15 AM BPJ <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>>
>>> It's an upstream bug in LaTeX::ToUnicode.
>>>
>>
>> On  LaTeX::ToUnicode ? I thought you only used BibTeX::Parser.
>>
>
> Which uses LaTeX::ToUnicode in its `cleaned_*` methods.
>
>
>
>> I just had never run into it AFAIK because all the .bib files I had
>>> written myself or downloaded from the libraries I use had used `\"{a}`
>>> rather than `\"a` which doesn't hit the bug. I have located the bug and am
>>> working on a patch. Thanks for discovering this! (There are a lot of
>>> unattended bugs though. Do you want me to send you the patch when it is
>>> ready?)
>>>
>>
>> I know of some bugs on BibTeX::Parser (and none on LaTeX::ToUnicode).
>>
>
> There are some on the old CPAN RT tracker. I don't know if they are de
> facto fixed.
>
>
> It would be nice to have all of them listed o the issues of the project
>> page:
>>
>>     https://github.com/borisveytsman/BibTeXPerlLibs/issues
>>
>
> Thanks for the link. It is missing on MetaCPAN. One of the old bugs
> complains about sloppy packaging.
>
>
>
>> especially if you are producing a patch.
>>
>
> Well it will be listed when I submit a PR!
>
>
>
>> Paulo Ney
>>
>>
>>
>>> Den sön 3 juli 2022 07:42Paulo Ney de Souza <pauloney-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev:
>>>
>>>> I got interested in another aspect of the posting -- the program "
>>>> cleanbib.pl" by Benct.
>>>>
>>>> I installed it in Ubuntu, and found out it does not process perfectly
>>>> valid TeX code like characters that end or have a space in the middle, or
>>>> that it processes \c{e}, but not the comma-accent any of the other vowels...
>>>>
>>>> I prepared the torture test below to show the problems:
>>>>
>>>> @Book{hobbit,
>>>>   title    = {Les \oe uf  de la serpente},
>>>>   address = {Bla\v zi\'c},
>>>>   publisher = {\c{a} \c{e} \c{i} \c{o} \c{u}},
>>>> }
>>>>
>>>> and above all, how does this compare to:
>>>>
>>>>     https://ctan.org/tex-archive/support/bibtexperllibs/LaTeX-ToUnicode
>>>>
>>>> Paulo Ney
>>>>
>>>>
>>>> On Sat, Jul 2, 2022 at 1:03 PM BPJ <bpj-J3H7GcXPSITLoDKTGw+V6w@public.gmane.org> wrote:
>>>>
>>>>> 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 <woodjo-ZOsAvrTRSvuEhhMi0yms2Q@public.gmane.org> 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 = pandoc.utils.stringify
>>>>>>>
>>>>>>> function Meta(m)
>>>>>>>
>>>>>>>   if m.references ~= nil then
>>>>>>>
>>>>>>>     for _, el in ipairs (m.references) do
>>>>>>>
>>>>>>>       -- print(stringify(el.title))
>>>>>>>
>>>>>>>       el.title = pandoc.Str(string.gsub(stringify(el.title), ': ',
>>>>>>> '. '))
>>>>>>>
>>>>>>>       -- print(el.title)
>>>>>>>
>>>>>>>     end
>>>>>>>
>>>>>>>   end
>>>>>>>
>>>>>>>   return m
>>>>>>>
>>>>>>> end```
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> (This won’t 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 is 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’t think it
>>>>>>> should though.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> *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-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
>>>>>>> *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 be -- 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 dot 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’s a very simple and absolutely unreliable version of a filter.
>>>>>>> This will replace every colon in a title with a period.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> ```lua
>>>>>>>
>>>>>>> local stringify = pandoc.utils.stringify
>>>>>>>
>>>>>>> function Meta(m)
>>>>>>>
>>>>>>>   if m.references ~= nil then
>>>>>>>
>>>>>>>     for _, el in ipairs (m.references) do
>>>>>>>
>>>>>>>       print(stringify(el.title))
>>>>>>>
>>>>>>>       el.title = 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 <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> *Im
>>>>>>> Auftrag von *John Carter Wood
>>>>>>> *Gesendet:* Freitag, 1. Juli 2022 17:52
>>>>>>> *An:* pandoc-discuss <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
>>>>>>> *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 saving
>>>>>>> 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 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 bibtex/biblatex as
>>>>>>> they seemed to offer more flexibility (I was running into issue 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 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, then
>>>>>>> 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’s 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/BibTeX.hs
>>>>>>> )
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> 2. I think pandoc’s citeproc will just treat every unknown variable
>>>>>>> as a string variable (see
>>>>>>> https://github.com/jgm/citeproc/blob/3f94424db469c804cf2dac2d22dc7a18b614f43e/src/Citeproc/Types.hs#L1054
>>>>>>> and
>>>>>>> https://github.com/jgm/citeproc/blob/3f94424db469c804cf2dac2d22dc7a18b614f43e/src/Citeproc/Types.hs#L901),
>>>>>>> so you should be able to use «subtitle» in styles. (This will give you
>>>>>>> warnings when using the style with Zotero and it won’t work reliably across
>>>>>>> implementations, but anyway ...)
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> 3. if you’re using Zotero, you can leverage Zotero BBT’s postscript
>>>>>>> feature to manipulate the JSON after exporting.
>>>>>>>
>>>>>>> E.g., this one :
>>>>>>>
>>>>>>> if (Translator.BetterCSL && item.title) {
>>>>>>>
>>>>>>>   reference.title = 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 <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> *Im
>>>>>>> Auftrag von *John Carter Wood
>>>>>>> *Gesendet:* Freitag, 1. Juli 2022 16:39
>>>>>>> *An:* pandoc-discuss <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
>>>>>>> *Betreff:* Changing colons to full-stops in titles
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> 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).
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> 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/period
>>>>>>> *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 they 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-citeproc-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-stops via using a filter? If so is there such a filter already around?
>>>>>>> Can this 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
>>>>>>> Groups "pandoc-discuss" group.
>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>> send an 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
>>>>>>> <https://groups.google.com/d/msgid/pandoc-discuss/78df697a-50f5-46d0-b0b8-29a2cbc9509an%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>> .
>>>>>>>
>>>>>>> --
>>>>>>> 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-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
>>>>>>> <https://groups.google.com/d/msgid/pandoc-discuss/a2d540a6-a435-4285-aed5-018007d155cfn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>> .
>>>>>>>
>>>>>>> --
>>>>>>> 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-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
>>>>>>> <https://groups.google.com/d/msgid/pandoc-discuss/f0f222ef-e60e-4397-83ac-bec1a6ac2d08n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>> .
>>>>>>>
>>>>>> --
>>>>>> 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
>>>>>> <https://groups.google.com/d/msgid/pandoc-discuss/b3deb0de-8ba0-4159-b9f3-1ecfbe68d457n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>>
>>>>> --
>>>>> 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/CADAJKhAU66TxJKMZdDM-KVabJpmKUVo5xyuAAN03F2b89jv9Ow%40mail.gmail.com
>>>>> <https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhAU66TxJKMZdDM-KVabJpmKUVo5xyuAAN03F2b89jv9Ow%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>> --
>>>> 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/CAFVhNZMyj_GZ%3DAo_1qR2rwnAAYAaQ%3DMaf880cGLRv7yD_ianpQ%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/pandoc-discuss/CAFVhNZMyj_GZ%3DAo_1qR2rwnAAYAaQ%3DMaf880cGLRv7yD_ianpQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> --
>>> 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/CADAJKhBjTdgbY-xDouhDGfnE%2BJ%2BV5c3v0FUA2Hn00z59%3D%3DWeLw%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhBjTdgbY-xDouhDGfnE%2BJ%2BV5c3v0FUA2Hn00z59%3D%3DWeLw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> 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/CAFVhNZNNsfQs_Lt8agoaseyrNfdhrVOC9GTusMEdfecJFCBnug%40mail.gmail.com
>> <https://groups.google.com/d/msgid/pandoc-discuss/CAFVhNZNNsfQs_Lt8agoaseyrNfdhrVOC9GTusMEdfecJFCBnug%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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/CADAJKhB7xCir7Gwq%3DXr%3DYh4jSfCfjqnfWNdWvYZoXE7idcbePQ%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 38122 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: Changing colons to full-stops in titles
       [not found]                           ` <2a8d940b3675472fb4b50ead406f6fc7-NSENcxR/0n0@public.gmane.org>
  2022-07-01 16:43                             ` John Carter Wood
  2022-07-01 16:54                             ` AW: " Sukil Etxenike arizaleta
@ 2022-07-05 10:02                             ` John Carter Wood
       [not found]                               ` <5c2a1a00-28b9-4846-9541-92baaf0d5200n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  2 siblings, 1 reply; 27+ messages in thread
From: John Carter Wood @ 2022-07-05 10:02 UTC (permalink / raw)
  To: pandoc-discuss


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

I have finally had a chance to try out Denis's lua filter but I don't seem 
to be able to get it to work. 

1. I saved the filter in my .pandoc/filters folder (as colon-to-dot.lua, 
attached)
2. I used the test .md file Denis provided (as dot-test.md, attached)
3. I used the pandoc command: pandoc dot-test.md --citeproc --lua-filter 
colon-to-dot.lua -o dot-test.docx

But what comes out looks like this: the colon is unchanged. 

[image: Screenshot from 2022-07-05 12-00-17.png]

What am I doing wrong? 


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 = pandoc.utils.stringify
>
> function Meta(m)
>
>   if m.references ~= nil then
>
>     for _, el in ipairs (m.references) do
>
>       -- print(stringify(el.title))
>
>       el.title = pandoc.Str(string.gsub(stringify(el.title), ': ', '. '))
>
>       -- print(el.title)
>
>     end
>
>   end
>
>   return m
>
> end```
>
>  
>
> (This won’t 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 is 
> 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’t think it should 
> though.
>
>  
>
> *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-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
> *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 be 
> -- 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 dot 
> 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’s a very simple and absolutely unreliable version of a filter. This 
> will replace every colon in a title with a period.
>
>  
>
> ```lua
>
> local stringify = pandoc.utils.stringify
>
> function Meta(m)
>
>   if m.references ~= nil then
>
>     for _, el in ipairs (m.references) do
>
>       print(stringify(el.title))
>
>       el.title = 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 <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> *Im 
> Auftrag von *John Carter Wood
> *Gesendet:* Freitag, 1. Juli 2022 17:52
> *An:* pandoc-discuss <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
> *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 saving 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 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 bibtex/biblatex as they 
> seemed to offer more flexibility (I was running into issue 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 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, then 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’s 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/BibTeX.hs
> )
>
>  
>
> 2. I think pandoc’s citeproc will just treat every unknown variable as a 
> string variable (see 
> https://github.com/jgm/citeproc/blob/3f94424db469c804cf2dac2d22dc7a18b614f43e/src/Citeproc/Types.hs#L1054 
> and 
> https://github.com/jgm/citeproc/blob/3f94424db469c804cf2dac2d22dc7a18b614f43e/src/Citeproc/Types.hs#L901), 
> so you should be able to use «subtitle» in styles. (This will give you 
> warnings when using the style with Zotero and it won’t work reliably across 
> implementations, but anyway ...)
>
>  
>
> 3. if you’re using Zotero, you can leverage Zotero BBT’s postscript 
> feature to manipulate the JSON after exporting.
>
> E.g., this one :
>
> if (Translator.BetterCSL && item.title) {
>
>   reference.title = 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 <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> *Im 
> Auftrag von *John Carter Wood
> *Gesendet:* Freitag, 1. Juli 2022 16:39
> *An:* pandoc-discuss <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
> *Betreff:* Changing colons to full-stops in titles
>
>  
>
> 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). 
>
>  
>
> 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/period 
> *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 they 
> 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-citeproc-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-stops 
> via using a filter? If so is there such a filter already around? Can this 
> 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 Groups 
> "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> 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 
> <https://groups.google.com/d/msgid/pandoc-discuss/78df697a-50f5-46d0-b0b8-29a2cbc9509an%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> -- 
> 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-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 
> <https://groups.google.com/d/msgid/pandoc-discuss/a2d540a6-a435-4285-aed5-018007d155cfn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> -- 
> 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-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 
> <https://groups.google.com/d/msgid/pandoc-discuss/f0f222ef-e60e-4397-83ac-bec1a6ac2d08n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/5c2a1a00-28b9-4846-9541-92baaf0d5200n%40googlegroups.com.

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

[-- Attachment #2: colon-to-dot.lua --]
[-- Type: text/x-lua, Size: 293 bytes --]

local stringify = pandoc.utils.stringify
function Meta(m)
  if m.references ~= nil then
    for _, el in ipairs (m.references) do
      -- print(stringify(el.title))
      el.title = pandoc.Str(string.gsub(stringify(el.title), ': ', '. '))
      -- print(el.title)
    end
  end
  return m
end

[-- Attachment #3: dot-test.md --]
[-- Type: text/markdown, Size: 273 bytes --]

---
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 is not a problem'
  publisher: 'Whatever press'
  lang: de-De
...

 

test [@doe]

[-- Attachment #4: Screenshot from 2022-07-05 12-00-17.png --]
[-- Type: image/png, Size: 10131 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: Changing colons to full-stops in titles
       [not found]                               ` <5c2a1a00-28b9-4846-9541-92baaf0d5200n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2022-07-05 10:16                                 ` Albert Krewinkel
       [not found]                                   ` <87h73vj1m1.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
  2022-07-05 10:38                                 ` denis.maier-NSENcxR/0n0
  1 sibling, 1 reply; 27+ messages in thread
From: Albert Krewinkel @ 2022-07-05 10:16 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw


John Carter Wood <woodjo-ZOsAvrTRSvuEhhMi0yms2Q@public.gmane.org> writes:

> I have finally had a chance to try out Denis's lua filter but I don't
> seem to be able to get it to work.
> 1. I saved the filter in my .pandoc/filters folder (as
> colon-to-dot.lua, attached)
> 2. I used the test .md file Denis provided (as dot-test.md, attached)
> 3. I used the pandoc command: pandoc dot-test.md --citeproc
> --lua-filter colon-to-dot.lua -o dot-test.docx
> But what comes out looks like this: the colon is unchanged.
> Screenshot from 2022-07-05 12-00-17.png
> What am I doing wrong?

I didn't test them, but these changes could help:

1. Change the order of `--citeproc` and `--lua-filter=...` on the
   command line. The order in which these are given is also the order
   in which they are applied. We want the Lua filter to be applied
   first.

2. Make sure that the `references` field is populated by filtering the
   Pandoc element and adding
   `doc.meta.references = pandoc.utils.references(doc)`

Here's the updated filter:

``` lua
function Pandoc (doc)
  local meta = doc.meta
  meta.references = pandoc.utils.references(doc)
  meta.bibliography = nil -- prevent citeproc from parsing this again

  for _, ref in ipairs (meta.references or {}) do
    ref.title = ref.title:walk {
      Str = function (str)
        return str:gsub(':$', ',')
      end
    }
  end

  return pandoc.Pandoc(doc.blocks, meta)
end
```

HTH

-- 
Albert Krewinkel
GPG: 8eed e3e2 e8c5 6f18 81fe  e836 388d c0b2 1f63 1124


^ permalink raw reply	[flat|nested] 27+ messages in thread

* AW: Changing colons to full-stops in titles
       [not found]                               ` <5c2a1a00-28b9-4846-9541-92baaf0d5200n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  2022-07-05 10:16                                 ` Albert Krewinkel
@ 2022-07-05 10:38                                 ` denis.maier-NSENcxR/0n0
  1 sibling, 0 replies; 27+ messages in thread
From: denis.maier-NSENcxR/0n0 @ 2022-07-05 10:38 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 11477 bytes --]

Try running the Lua filter before citeproc... Does that help?
________________________________________
Von: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> im Auftrag von John Carter Wood <woodjo-ZOsAvrTRSvuEhhMi0yms2Q@public.gmane.org>
Gesendet: Dienstag, 5. Juli 2022 12:02:39
An: pandoc-discuss
Betreff: Re: Changing colons to full-stops in titles

I have finally had a chance to try out Denis's lua filter but I don't seem to be able to get it to work.

1. I saved the filter in my .pandoc/filters folder (as colon-to-dot.lua, attached)
2. I used the test .md file Denis provided (as dot-test.md, attached)
3. I used the pandoc command: pandoc dot-test.md --citeproc --lua-filter colon-to-dot.lua -o dot-test.docx

But what comes out looks like this: the colon is unchanged.

[Screenshot from 2022-07-05 12-00-17.png]

What am I doing wrong?


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 = pandoc.utils.stringify
function Meta(m)
  if m.references ~= nil then
    for _, el in ipairs (m.references) do
      -- print(stringify(el.title))
      el.title = pandoc.Str(string.gsub(stringify(el.title), ': ', '. '))
      -- print(el.title)
    end
  end
  return m
end```

(This won’t 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 is 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’t think it should though.

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-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
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 be -- 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 dot 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’s a very simple and absolutely unreliable version of a filter. This will replace every colon in a title with a period.

```lua
local stringify = pandoc.utils.stringify
function Meta(m)
  if m.references ~= nil then
    for _, el in ipairs (m.references) do
      print(stringify(el.title))
      el.title = 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 <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> Im Auftrag von John Carter Wood
Gesendet: Freitag, 1. Juli 2022 17:52
An: pandoc-discuss <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
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 saving 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 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 bibtex/biblatex as they seemed to offer more flexibility (I was running into issue 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 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, then 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’s 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/BibTeX.hs)

2. I think pandoc’s citeproc will just treat every unknown variable as a string variable (see https://github.com/jgm/citeproc/blob/3f94424db469c804cf2dac2d22dc7a18b614f43e/src/Citeproc/Types.hs#L1054 and https://github.com/jgm/citeproc/blob/3f94424db469c804cf2dac2d22dc7a18b614f43e/src/Citeproc/Types.hs#L901), so you should be able to use «subtitle» in styles. (This will give you warnings when using the style with Zotero and it won’t work reliably across implementations, but anyway ...)

3. if you’re using Zotero, you can leverage Zotero BBT’s postscript feature to manipulate the JSON after exporting.
E.g., this one :
if (Translator.BetterCSL && item.title) {
  reference.title = 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 <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> Im Auftrag von John Carter Wood
Gesendet: Freitag, 1. Juli 2022 16:39
An: pandoc-discuss <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Betreff: Changing colons to full-stops in titles

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).

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/period 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 they 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-citeproc-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-stops via using a filter? If so is there such a filter already around? Can this 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 Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an 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<https://groups.google.com/d/msgid/pandoc-discuss/78df697a-50f5-46d0-b0b8-29a2cbc9509an%40googlegroups.com?utm_medium=email&utm_source=footer>.
--
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-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<https://groups.google.com/d/msgid/pandoc-discuss/a2d540a6-a435-4285-aed5-018007d155cfn%40googlegroups.com?utm_medium=email&utm_source=footer>.
--
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-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<https://groups.google.com/d/msgid/pandoc-discuss/f0f222ef-e60e-4397-83ac-bec1a6ac2d08n%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/5c2a1a00-28b9-4846-9541-92baaf0d5200n%40googlegroups.com<https://groups.google.com/d/msgid/pandoc-discuss/5c2a1a00-28b9-4846-9541-92baaf0d5200n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
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/b6e74fa5d07a4dfead93d59f0c22e654%40unibe.ch.

[-- Attachment #2: Screenshot from 2022-07-05 12-00-17.png --]
[-- Type: image/png, Size: 10131 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: Changing colons to full-stops in titles
       [not found]                                   ` <87h73vj1m1.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
@ 2022-07-05 11:45                                     ` John Carter Wood
       [not found]                                       ` <1ebf2a90-159e-4445-bf3a-b068526877cbn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 27+ messages in thread
From: John Carter Wood @ 2022-07-05 11:45 UTC (permalink / raw)
  To: pandoc-discuss


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

Changing the order with the original filter didn't have an effect. 

Trying the revised filter (which I renamed, as it is very different from 
the first one) resulted in the following error message: 


[image: Screenshot from 2022-07-05 13-42-57.png]
Albert Krewinkel schrieb am Dienstag, 5. Juli 2022 um 12:27:43 UTC+2:

>
> John Carter Wood <woo...-ZOsAvrTRSvuEhhMi0yms2Q@public.gmane.org> writes:
>
> > I have finally had a chance to try out Denis's lua filter but I don't
> > seem to be able to get it to work.
> > 1. I saved the filter in my .pandoc/filters folder (as
> > colon-to-dot.lua, attached)
> > 2. I used the test .md file Denis provided (as dot-test.md, attached)
> > 3. I used the pandoc command: pandoc dot-test.md --citeproc
> > --lua-filter colon-to-dot.lua -o dot-test.docx
> > But what comes out looks like this: the colon is unchanged.
> > Screenshot from 2022-07-05 12-00-17.png
> > What am I doing wrong?
>
> I didn't test them, but these changes could help:
>
> 1. Change the order of `--citeproc` and `--lua-filter=...` on the
> command line. The order in which these are given is also the order
> in which they are applied. We want the Lua filter to be applied
> first.
>
> 2. Make sure that the `references` field is populated by filtering the
> Pandoc element and adding
> `doc.meta.references = pandoc.utils.references(doc)`
>
> Here's the updated filter:
>
> ``` lua
> function Pandoc (doc)
> local meta = doc.meta
> meta.references = pandoc.utils.references(doc)
> meta.bibliography = nil -- prevent citeproc from parsing this again
>
> for _, ref in ipairs (meta.references or {}) do
> ref.title = ref.title:walk {
> Str = function (str)
> return str:gsub(':$', ',')
> end
> }
> end
>
> return pandoc.Pandoc(doc.blocks, meta)
> end
> ```
>
> HTH
>
> -- 
> Albert Krewinkel
> GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124
>

-- 
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/1ebf2a90-159e-4445-bf3a-b068526877cbn%40googlegroups.com.

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

[-- Attachment #2: Screenshot from 2022-07-05 13-42-57.png --]
[-- Type: image/png, Size: 30019 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: Changing colons to full-stops in titles
       [not found]                                       ` <1ebf2a90-159e-4445-bf3a-b068526877cbn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2022-07-05 11:49                                         ` Albert Krewinkel
       [not found]                                           ` <87czejixon.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
  2022-07-05 12:05                                         ` Sukil Etxenike arizaleta
  2022-07-05 15:50                                         ` AW: " denis.maier-NSENcxR/0n0
  2 siblings, 1 reply; 27+ messages in thread
From: Albert Krewinkel @ 2022-07-05 11:49 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw


John Carter Wood <woodjo-ZOsAvrTRSvuEhhMi0yms2Q@public.gmane.org> writes:

>    Changing the order with the original filter didn't have an effect.
>    Trying the revised filter (which I renamed, as it is very different
>    from the first one) resulted in the following error message:
>    Screenshot from 2022-07-05 13-42-57.png

My bad: please try to replace line 8 with

    return pandoc.Str(str.text:gsub(':$', ','))



-- 
Albert Krewinkel
GPG: 8eed e3e2 e8c5 6f18 81fe  e836 388d c0b2 1f63 1124


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: Changing colons to full-stops in titles
       [not found]                                           ` <87czejixon.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
@ 2022-07-05 12:02                                             ` John Carter Wood
  0 siblings, 0 replies; 27+ messages in thread
From: John Carter Wood @ 2022-07-05 12:02 UTC (permalink / raw)
  To: pandoc-discuss


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

OK, that worked! (In combination with putting the dot-filter before 
--citeproc.) 

Just to be clear: I normally don't have my references in the yaml block 
itself, but define a json file in the yaml that contains them. This should 
work in that context as well, yes? I will try to test it again soon with my 
usual set-up to make sure it also works that way. 

Thank you!


Albert Krewinkel schrieb am Dienstag, 5. Juli 2022 um 13:52:31 UTC+2:

>
> John Carter Wood <woo...-ZOsAvrTRSvuEhhMi0yms2Q@public.gmane.org> writes:
>
> > Changing the order with the original filter didn't have an effect.
> > Trying the revised filter (which I renamed, as it is very different
> > from the first one) resulted in the following error message:
> > Screenshot from 2022-07-05 13-42-57.png
>
> My bad: please try to replace line 8 with
>
> return pandoc.Str(str.text:gsub(':$', ','))
>
>
>
> -- 
> Albert Krewinkel
> GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124
>

-- 
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/c804d00e-aed3-49b8-9eb4-19ed362828een%40googlegroups.com.

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

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: Changing colons to full-stops in titles
       [not found]                                       ` <1ebf2a90-159e-4445-bf3a-b068526877cbn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  2022-07-05 11:49                                         ` Albert Krewinkel
@ 2022-07-05 12:05                                         ` Sukil Etxenike arizaleta
  2022-07-05 15:50                                         ` AW: " denis.maier-NSENcxR/0n0
  2 siblings, 0 replies; 27+ messages in thread
From: Sukil Etxenike arizaleta @ 2022-07-05 12:05 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw


El 05/07/2022 a las 13:45, John Carter Wood escribió:
> Changing the order with the original filter didn't have an effect.
>
Anyone care explaining why it didn't work? I'm really curious now.

Thanks,

Sukil


-- 
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/ba875da6-6bef-432f-9661-c7421008cb7c%40gmail.com.


^ permalink raw reply	[flat|nested] 27+ messages in thread

* AW: Changing colons to full-stops in titles
       [not found]                                       ` <1ebf2a90-159e-4445-bf3a-b068526877cbn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  2022-07-05 11:49                                         ` Albert Krewinkel
  2022-07-05 12:05                                         ` Sukil Etxenike arizaleta
@ 2022-07-05 15:50                                         ` denis.maier-NSENcxR/0n0
       [not found]                                           ` <2bb67f22fc3044088f798c777f3684d2-NSENcxR/0n0@public.gmane.org>
  2 siblings, 1 reply; 27+ messages in thread
From: denis.maier-NSENcxR/0n0 @ 2022-07-05 15:50 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw


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

I really don’t know what is going off the rails here, but this is my output:

C:\Users\denis\Desktop\pandoc-subtitle>pandoc text.md --citeproc
<p>test <span class="citation" data-cites="doe">(Doe 2022)</span></p>
<div id="refs" class="references csl-bib-body hanging-indent"
role="doc-bibliography">
<div id="ref-doe" class="csl-entry" role="doc-biblioentry">
Doe, Jane. 2022. <em>A Book: With a Subtitle and a Reference to Gen 1:1,
but That Is Not a Problem</em>. Whatever press.
</div>
</div>

C:\Users\denis\Desktop\pandoc-subtitle>pandoc text.md -L title.lua --citeproc
<p>test <span class="citation" data-cites="doe">(Doe 2022)</span></p>
<div id="refs" class="references csl-bib-body hanging-indent"
role="doc-bibliography">
<div id="ref-doe" class="csl-entry" role="doc-biblioentry">
Doe, Jane. 2022. <em>A Book. With a Subtitle and a Reference to Gen 1:1,
but That Is Not a Problem</em>. Whatever press.
</div>
</div>

Von: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> Im Auftrag von John Carter Wood
Gesendet: Dienstag, 5. Juli 2022 13:45
An: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Betreff: Re: Changing colons to full-stops in titles

Changing the order with the original filter didn't have an effect.

Trying the revised filter (which I renamed, as it is very different from the first one) resulted in the following error message:


[cid:image001.png-/v79opaF+3RFSh627tqNLzRmByFHzeGd@public.gmane.org]
Albert Krewinkel schrieb am Dienstag, 5. Juli 2022 um 12:27:43 UTC+2:

John Carter Wood <woo...-ZOsAvrTRSvuEhhMi0yms2Q@public.gmane.org> writes:

> I have finally had a chance to try out Denis's lua filter but I don't
> seem to be able to get it to work.
> 1. I saved the filter in my .pandoc/filters folder (as
> colon-to-dot.lua, attached)
> 2. I used the test .md file Denis provided (as dot-test.md, attached)
> 3. I used the pandoc command: pandoc dot-test.md --citeproc
> --lua-filter colon-to-dot.lua -o dot-test.docx
> But what comes out looks like this: the colon is unchanged.
> Screenshot from 2022-07-05 12-00-17.png
> What am I doing wrong?

I didn't test them, but these changes could help:

1. Change the order of `--citeproc` and `--lua-filter=...` on the
command line. The order in which these are given is also the order
in which they are applied. We want the Lua filter to be applied
first.

2. Make sure that the `references` field is populated by filtering the
Pandoc element and adding
`doc.meta.references = pandoc.utils.references(doc)`

Here's the updated filter:

``` lua
function Pandoc (doc)
local meta = doc.meta
meta.references = pandoc.utils.references(doc)
meta.bibliography = nil -- prevent citeproc from parsing this again

for _, ref in ipairs (meta.references or {}) do
ref.title = ref.title:walk {
Str = function (str)
return str:gsub(':$', ',')
end
}
end

return pandoc.Pandoc(doc.blocks, meta)
end
```

HTH

--
Albert Krewinkel
GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124
--
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/1ebf2a90-159e-4445-bf3a-b068526877cbn%40googlegroups.com<https://groups.google.com/d/msgid/pandoc-discuss/1ebf2a90-159e-4445-bf3a-b068526877cbn%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
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/2bb67f22fc3044088f798c777f3684d2%40unibe.ch.

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

[-- Attachment #2: image001.png --]
[-- Type: image/png, Size: 30019 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* AW: Changing colons to full-stops in titles
       [not found]                                           ` <2bb67f22fc3044088f798c777f3684d2-NSENcxR/0n0@public.gmane.org>
@ 2022-07-07 19:05                                             ` denis.maier-NSENcxR/0n0
  0 siblings, 0 replies; 27+ messages in thread
From: denis.maier-NSENcxR/0n0 @ 2022-07-07 19:05 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw


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

No hints? Nobody?

Von: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> Im Auftrag von denis.maier-NSENcxR/0n0@public.gmane.org
Gesendet: Dienstag, 5. Juli 2022 17:51
An: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Betreff: AW: Changing colons to full-stops in titles

I really don’t know what is going off the rails here, but this is my output:

C:\Users\denis\Desktop\pandoc-subtitle>pandoc text.md --citeproc
<p>test <span class="citation" data-cites="doe">(Doe 2022)</span></p>
<div id="refs" class="references csl-bib-body hanging-indent"
role="doc-bibliography">
<div id="ref-doe" class="csl-entry" role="doc-biblioentry">
Doe, Jane. 2022. <em>A Book: With a Subtitle and a Reference to Gen 1:1,
but That Is Not a Problem</em>. Whatever press.
</div>
</div>

C:\Users\denis\Desktop\pandoc-subtitle>pandoc text.md -L title.lua --citeproc
<p>test <span class="citation" data-cites="doe">(Doe 2022)</span></p>
<div id="refs" class="references csl-bib-body hanging-indent"
role="doc-bibliography">
<div id="ref-doe" class="csl-entry" role="doc-biblioentry">
Doe, Jane. 2022. <em>A Book. With a Subtitle and a Reference to Gen 1:1,
but That Is Not a Problem</em>. Whatever press.
</div>
</div>

Von: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<mailto:pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<mailto:pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>> Im Auftrag von John Carter Wood
Gesendet: Dienstag, 5. Juli 2022 13:45
An: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<mailto:pandoc-discuss@googlegroups.com>>
Betreff: Re: Changing colons to full-stops in titles

Changing the order with the original filter didn't have an effect.

Trying the revised filter (which I renamed, as it is very different from the first one) resulted in the following error message:


[cid:image001.png-hLv9h/vDf2aijPtaXrPhQzRmByFHzeGd@public.gmane.org]
Albert Krewinkel schrieb am Dienstag, 5. Juli 2022 um 12:27:43 UTC+2:

John Carter Wood <woo...-ZOsAvrTRSvuEhhMi0yms2Q@public.gmane.org<mailto:woo...-ZOsAvrTRSvuEhhMi0yms2Q@public.gmane.org>> writes:

> I have finally had a chance to try out Denis's lua filter but I don't
> seem to be able to get it to work.
> 1. I saved the filter in my .pandoc/filters folder (as
> colon-to-dot.lua, attached)
> 2. I used the test .md file Denis provided (as dot-test.md, attached)
> 3. I used the pandoc command: pandoc dot-test.md --citeproc
> --lua-filter colon-to-dot.lua -o dot-test.docx
> But what comes out looks like this: the colon is unchanged.
> Screenshot from 2022-07-05 12-00-17.png
> What am I doing wrong?

I didn't test them, but these changes could help:

1. Change the order of `--citeproc` and `--lua-filter=...` on the
command line. The order in which these are given is also the order
in which they are applied. We want the Lua filter to be applied
first.

2. Make sure that the `references` field is populated by filtering the
Pandoc element and adding
`doc.meta.references = pandoc.utils.references(doc)`

Here's the updated filter:

``` lua
function Pandoc (doc)
local meta = doc.meta
meta.references = pandoc.utils.references(doc)
meta.bibliography = nil -- prevent citeproc from parsing this again

for _, ref in ipairs (meta.references or {}) do
ref.title = ref.title:walk {
Str = function (str)
return str:gsub(':$', ',')
end
}
end

return pandoc.Pandoc(doc.blocks, meta)
end
```

HTH

--
Albert Krewinkel
GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124
--
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/1ebf2a90-159e-4445-bf3a-b068526877cbn%40googlegroups.com<https://groups.google.com/d/msgid/pandoc-discuss/1ebf2a90-159e-4445-bf3a-b068526877cbn%40googlegroups.com?utm_medium=email&utm_source=footer>.
--
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/2bb67f22fc3044088f798c777f3684d2%40unibe.ch<https://groups.google.com/d/msgid/pandoc-discuss/2bb67f22fc3044088f798c777f3684d2%40unibe.ch?utm_medium=email&utm_source=footer>.

-- 
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/c1ebb341fddc4cd3b954c34e3fe16fca%40unibe.ch.

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

[-- Attachment #2: image001.png --]
[-- Type: image/png, Size: 30019 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2022-07-07 19:05 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <AQHYjVhIsMIE8s9IhE2lBYWP9lHO8a1pnTTw///rpoCAACWJYP//4zWAgAAjbfA=>
     [not found] ` <AQHYjVhIsMIE8s9IhE2lBYWP9lHO8a1pnTTw///rpoCAACWJYA==>
     [not found]   ` <AQHYjVhIsMIE8s9IhE2lBYWP9lHO8a1pnTTw>
2022-07-01 14:38     ` Changing colons to full-stops in titles John Carter Wood
     [not found]       ` <78df697a-50f5-46d0-b0b8-29a2cbc9509an-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-07-01 15:30         ` John MacFarlane
     [not found]           ` <m2sfnkvoih.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2022-07-01 15:41             ` AW: " denis.maier-NSENcxR/0n0
2022-07-01 15:34         ` denis.maier-NSENcxR/0n0
     [not found]           ` <f440b082946148b884b45ed1a3421de4-NSENcxR/0n0@public.gmane.org>
2022-07-01 15:52             ` John Carter Wood
     [not found]               ` <a2d540a6-a435-4285-aed5-018007d155cfn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-07-01 16:16                 ` AW: " denis.maier-NSENcxR/0n0
     [not found]                   ` <bc85a4891eec431f846ee69f9fcbe167-NSENcxR/0n0@public.gmane.org>
2022-07-01 16:23                     ` John Carter Wood
     [not found]                       ` <f0f222ef-e60e-4397-83ac-bec1a6ac2d08n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-07-01 16:40                         ` AW: " denis.maier-NSENcxR/0n0
     [not found]                           ` <2a8d940b3675472fb4b50ead406f6fc7-NSENcxR/0n0@public.gmane.org>
2022-07-01 16:43                             ` John Carter Wood
     [not found]                               ` <b3deb0de-8ba0-4159-b9f3-1ecfbe68d457n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-07-02 20:02                                 ` BPJ
     [not found]                                   ` <CADAJKhAU66TxJKMZdDM-KVabJpmKUVo5xyuAAN03F2b89jv9Ow-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-07-03  5:41                                     ` Paulo Ney de Souza
     [not found]                                       ` <CAFVhNZMyj_GZ=Ao_1qR2rwnAAYAaQ=Maf880cGLRv7yD_ianpQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-07-03 12:15                                         ` BPJ
     [not found]                                           ` <CADAJKhBjTdgbY-xDouhDGfnE+J+V5c3v0FUA2Hn00z59==WeLw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-07-03 16:53                                             ` Paulo Ney de Souza
     [not found]                                               ` <CAFVhNZNNsfQs_Lt8agoaseyrNfdhrVOC9GTusMEdfecJFCBnug-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-07-03 19:43                                                 ` BPJ
     [not found]                                                   ` <CADAJKhCjht=mJqUgEbyHQWcp+P5gKjYUoEfe4VQAOa6SS1b5Ag-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-07-04  9:09                                                     ` BPJ
2022-07-01 16:54                             ` AW: " Sukil Etxenike arizaleta
     [not found]                               ` <6621a84d-37f3-6741-bb0a-d4bfd6dac4bf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2022-07-01 17:28                                 ` Sukil Etxenike arizaleta
2022-07-05 10:02                             ` John Carter Wood
     [not found]                               ` <5c2a1a00-28b9-4846-9541-92baaf0d5200n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-07-05 10:16                                 ` Albert Krewinkel
     [not found]                                   ` <87h73vj1m1.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
2022-07-05 11:45                                     ` John Carter Wood
     [not found]                                       ` <1ebf2a90-159e-4445-bf3a-b068526877cbn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-07-05 11:49                                         ` Albert Krewinkel
     [not found]                                           ` <87czejixon.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
2022-07-05 12:02                                             ` John Carter Wood
2022-07-05 12:05                                         ` Sukil Etxenike arizaleta
2022-07-05 15:50                                         ` AW: " denis.maier-NSENcxR/0n0
     [not found]                                           ` <2bb67f22fc3044088f798c777f3684d2-NSENcxR/0n0@public.gmane.org>
2022-07-07 19:05                                             ` denis.maier-NSENcxR/0n0
2022-07-05 10:38                                 ` denis.maier-NSENcxR/0n0
2022-07-02 16:28         ` BPJ

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).