public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* citeproc hack for multilingual citations?
@ 2023-12-12  1:48 Thomas Newhall
       [not found] ` <8fd3ff8c-44e7-4abe-9c65-38fb5debbb3dn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Newhall @ 2023-12-12  1:48 UTC (permalink / raw)
  To: pandoc-discuss


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

Hello everyone,

I'm trying to use pandoc's citeproc to render multilingual citations, saved 
in zotero, and automatically exported to CSL JSON. I wrote about this issue 
on the Zotero forum 
<https://forums.zotero.org/discussion/110097/using-the-note-field-for-rendering-mutilingual-text-with-csl#latest> earlier 
today, but was told this was "more of a Pandoc issue". I see there are also 
similar threads on this forum here 
<https://groups.google.com/g/pandoc-discuss/c/mjmQqT3xJd0/m/RVkHA6a4AgAJ>, 
here 
<https://groups.google.com/g/pandoc-discuss/c/iYW55X9PDWA/m/lGwXhHslAgAJ>, 
and here 
<https://groups.google.com/g/pandoc-discuss/c/BaD8D5y7Nb8/m/SHjZk2rKAAAJ>, 
but I couldn't determine whether the solutions provided would work for me.

I know there are some limitations to citeproc (that may be getting 
addressed with the citeproc-rs <https://github.com/zotero/citeproc-rs> 
project), but I am trying to figure out the best workaround that still 
maintains a markdown-based workflow. I think I almost have it as I need 
them, but there's a few issues still:

Right now, my html output renders like this:

Inline citation: (Ōtani 2016)

Bibliography:
Ōtani, Yūka 大谷由香. 2016. “(Ronbun) Nissōsō Shunjō wo hattan toshita nissōkan 
‘Enshū kaitai’ ronsō[論文]入宋僧俊芿を発端とした日宋間「円宗戒体」論争.” *Nihon Bukkyō sōgō kenkyū 
日本仏教綜合研究* 14: 105–132.

There are two changes I would like to make to this.

First, I would like to be able to *keep the inline citation as is, while 
removing the comma after the name "Ōtani" in the bibliography*. This would 
be possible with Juris-m if I were to simply copy-and-paste citations, but 
I was hoping to be able to have in-text citations linked to the 
bibliography (and, ideally, live citations), which seem like they will be 
difficult to implement if I'm not rendering citations using citeproc.

Second, I would like to *keep the English language transliteration of the 
journal title in italics (i.e. Nihon Bukkyō sōgō kenkyū), while making the 
Japanese text for the journal title (i.e. 日本仏教綜合研究) to be regular 
non-italicized text*. In a latex/pdf output this is no problem; latex 
ignores italicized Chinese characters, but I am wondering if it is possible 
with the HTML output. I thought this would be possible by including the 
Japanese text for the title of the journal as a "note" field, but I 
couldn't get the "note" field to print at all (see following example). 
Alternatively, if there were a way to simply tell css to ignore italics for 
Chinese/Japanese fonts (like latex does), that could work.

Here is the (Better)CSL-JSON for this entry:

```json
{
"id": "otani-2016",
"author": [{ "family": "Ōtani", "given": "Yūka 大谷由香" }],
"citation-key": "otani-2016",
"container-title": "Nihon Bukkyō sōgō kenkyū 日本仏教綜合研究",
"DOI": "10.20588/nbs.14.0_105",
"ISSN": "1348-4850",
"issued": { "date-parts": [["2016"]] },
"language": "jpn",
"note": "cjk-title: 日本仏教綜合研究",
"page": "105–132",
"publisher": "日本仏教綜合研究学会",
"source": "search.library.ucla.edu",
"title": "(Ronbun) Nissōsō Shunjō wo hattan toshita nissōkan 'Enshū kaitai' 
ronsō[論文]入宋僧俊芿を発端とした日宋間「円宗戒体」論争",
"type": "article-journal",
"volume": "14"
}
```

And here is the CSL of the portion that I think will apply to this case:

```
< /macro>
    <macro name="container-title">
        <choose>
            <if type="chapter entry-dictionary entry-encyclopedia 
paper-conference" match="any">
                <text macro="container-prefix" suffix=" "/>
            </if>
        </choose>
        <choose>
            <if type="webpage">
                <text variable="container-title" text-case="title"/>
            </if>
            <else-if type="legal_case" match="none">
                <group delimiter=" ">
                    <text variable="container-title" text-case="title" 
font-style="italic"/>
                    <choose>
                        <if variable="note">
                            <text variable="note"/>
                        </if>
                    </choose>
                </group>
            </else-if>
        </choose>
    </macro>
````

If this is impossible to do with a "hack" (i.e. using the note field for 
the Chinese/japanese title) in CSL or zotero, is is possible to wrote some 
custom (lua or python) filter that either gets rid of the commas or gets 
rid of the italics (or both)?

Thanks in advance,
Tom

-- 
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/8fd3ff8c-44e7-4abe-9c65-38fb5debbb3dn%40googlegroups.com.

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

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

* Re: citeproc hack for multilingual citations?
       [not found] ` <8fd3ff8c-44e7-4abe-9c65-38fb5debbb3dn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2023-12-12  6:43   ` Bastien DUMONT
  0 siblings, 0 replies; 2+ messages in thread
From: Bastien DUMONT @ 2023-12-12  6:43 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

I don't understand why it should be a Pandoc issue. I can't help you for the HTML/CSS part, but I think that you can achieve what you want by modifying your CSL stylesheet only.

For the author, you use a custom variable in the "note" field specifying the author name as a literal string ("Ōtani Yūka") and use this variable (as a regular string variable, not a name) in the stylesheet for the bibliography. You will have to change the sorting rule to take account of this new variable.

When you use a variable in the "note" field, don't use "note", use the name of the variable. In your sample:

<choose>
  <if variable="cjk-title">
    <text variable="cjk-title"/>
  </if>
</choose>

Le Monday 11 December 2023 à 05:48:36PM, Thomas Newhall a écrit :
> Hello everyone,
> 
> I'm trying to use pandoc's citeproc to render multilingual citations, saved in
> zotero, and automatically exported to CSL JSON. I wrote about this issue on
> the [1]Zotero forum earlier today, but was told this was "more of a Pandoc
> issue". I see there are also similar threads on this forum [2]here, [3]here,
> and [4]here, but I couldn't determine whether the solutions provided would work
> for me.
> 
> I know there are some limitations to citeproc (that may be getting addressed
> with the [5]citeproc-rs project), but I am trying to figure out the best
> workaround that still maintains a markdown-based workflow. I think I almost
> have it as I need them, but there's a few issues still:
> 
> Right now, my html output renders like this:
> 
> Inline citation: (Ōtani 2016)
> 
> Bibliography:
> Ōtani, Yūka 大谷由香. 2016. “(Ronbun) Nissōsō Shunjō wo hattan toshita nissōkan
> ‘Enshū kaitai’ ronsō[論文]入宋僧俊芿を発端とした日宋間「円宗戒体」論争.”
> Nihon Bukkyō sōgō kenkyū 日本仏教綜合研究 14: 105–132.
> 
> There are two changes I would like to make to this.
> 
> First, I would like to be able to keep the inline citation as is, while
> removing the comma after the name "Ōtani" in the bibliography. This would be
> possible with Juris-m if I were to simply copy-and-paste citations, but I was
> hoping to be able to have in-text citations linked to the bibliography (and,
> ideally, live citations), which seem like they will be difficult to implement
> if I'm not rendering citations using citeproc.
> 
> Second, I would like to keep the English language transliteration of the
> journal title in italics (i.e. Nihon Bukkyō sōgō kenkyū), while making the
> Japanese text for the journal title (i.e. 日本仏教綜合研究) to be regular
> non-italicized text. In a latex/pdf output this is no problem; latex ignores
> italicized Chinese characters, but I am wondering if it is possible with the
> HTML output. I thought this would be possible by including the Japanese text
> for the title of the journal as a "note" field, but I couldn't get the "note"
> field to print at all (see following example). Alternatively, if there were a
> way to simply tell css to ignore italics for Chinese/Japanese fonts (like latex
> does), that could work.
> 
> Here is the (Better)CSL-JSON for this entry:
> 
> ```json
> {
> "id": "otani-2016",
> "author": [{ "family": "Ōtani", "given": "Yūka 大谷由香" }],
> "citation-key": "otani-2016",
> "container-title": "Nihon Bukkyō sōgō kenkyū 日本仏教綜合研究",
> "DOI": "10.20588/nbs.14.0_105",
> "ISSN": "1348-4850",
> "issued": { "date-parts": [["2016"]] },
> "language": "jpn",
> "note": "cjk-title: 日本仏教綜合研究",
> "page": "105–132",
> "publisher": "日本仏教綜合研究学会",
> "source": "search.library.ucla.edu",
> "title": "(Ronbun) Nissōsō Shunjō wo hattan toshita nissōkan 'Enshū kaitai'
> ronsō[論文]入宋僧俊芿を発端とした日宋間「円宗戒体」論争",
> "type": "article-journal",
> "volume": "14"
> }
> ```
> 
> And here is the CSL of the portion that I think will apply to this case:
> 
> ```
> < /macro>
>     <macro name="container-title">
>         <choose>
>             <if type="chapter entry-dictionary entry-encyclopedia
> paper-conference" match="any">
>                 <text macro="container-prefix" suffix=" "/>
>             </if>
>         </choose>
>         <choose>
>             <if type="webpage">
>                 <text variable="container-title" text-case="title"/>
>             </if>
>             <else-if type="legal_case" match="none">
>                 <group delimiter=" ">
>                     <text variable="container-title" text-case="title"
> font-style="italic"/>
>                     <choose>
>                         <if variable="note">
>                             <text variable="note"/>
>                         </if>
>                     </choose>
>                 </group>
>             </else-if>
>         </choose>
>     </macro>
> ````
> 
> If this is impossible to do with a "hack" (i.e. using the note field for the
> Chinese/japanese title) in CSL or zotero, is is possible to wrote some custom
> (lua or python) filter that either gets rid of the commas or gets rid of the
> italics (or both)?
> 
> Thanks in advance,
> Tom
> 
> --
> 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 [6]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit [7]https://groups.google.com/d/msgid/
> pandoc-discuss/8fd3ff8c-44e7-4abe-9c65-38fb5debbb3dn%40googlegroups.com.
> 
> References:
> 
> [1] https://forums.zotero.org/discussion/110097/using-the-note-field-for-rendering-mutilingual-text-with-csl#latest
> [2] https://groups.google.com/g/pandoc-discuss/c/mjmQqT3xJd0/m/RVkHA6a4AgAJ
> [3] https://groups.google.com/g/pandoc-discuss/c/iYW55X9PDWA/m/lGwXhHslAgAJ
> [4] https://groups.google.com/g/pandoc-discuss/c/BaD8D5y7Nb8/m/SHjZk2rKAAAJ
> [5] https://github.com/zotero/citeproc-rs
> [6] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> [7] https://groups.google.com/d/msgid/pandoc-discuss/8fd3ff8c-44e7-4abe-9c65-38fb5debbb3dn%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/ZXgBDc7RKdBbLAOZ%40localhost.


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

end of thread, other threads:[~2023-12-12  6:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-12  1:48 citeproc hack for multilingual citations? Thomas Newhall
     [not found] ` <8fd3ff8c-44e7-4abe-9c65-38fb5debbb3dn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-12-12  6:43   ` Bastien DUMONT

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