zepinglee / citeproc-lua

A Lua implementation of the Citation Style Language (CSL)
MIT License
62 stars 7 forks source link

The cs:alternative extension seems to be not supported #38

Closed kotobuki closed 6 months ago

kotobuki commented 1 year ago

Hi,

As a researcher and developer in Japan, I'm super happy to see that the cs:layout extension of CSL-M has been supported in citeproc-lua. 🙇 I just confirmed that the feature works fine with a few CSL-M style files!

A missing feature is the cs:alternative extension such as alt-translator. Would you happen to have a plan to support the extension?

Here is an example of a bibliography item that contains alt-translator, alt-issued, alt-publisher-place, and alt-publisher.

[
  {
    "id": "morgan2022philosophy",
    "author": [
      {
        "family": "Morgan",
        "given": "Casey"
      },
      {
        "family": "Patrov",
        "given": "Alexei"
      }
    ],
    "citation-key": "morgan2022philosophy",
    "event-place": "Chicago, IL",
    "issued": {
      "date-parts": [[2022]]
    },
    "language": "en>ja",
    "note": "alt-title: 自由意志の哲学\nalt-translator: 鈴木||真紀\nalt-issued: 2023\nalt-publisher-place: 東京\nalt-publisher: 城南大学出版会",
    "publisher": "Imaginary University Press",
    "publisher-place": "Chicago, IL",
    "title": "The Philosophy of Free Will",
    "type": "book"
  }
]
zepinglee commented 1 year ago

It seems that this feature is marked as deprecated. Is it still required by some Japanese styles?

kotobuki commented 1 year ago

I totally overlooked that the cs:alternative extension is deprecated.

Recently, I created a style that supports this feature. I also have a plan to create a few more CSL-M styles.

https://github.com/kotobuki/chicago-fullnote-bibliography-short-title-subsequent-ja-csl

In the CSL style file, alt-translator, alt-issued, alt-publisher-place, and alt-publisher are supported and generate a citation text with original and translation together as follows.

Morgan, Casey, and Alexei Patrov. The Philosophy of Free Will. Chicago, IL: Global Academic Press, 2022. 〔『自由意志の哲学』訳:鈴木真紀、東京:城南大学出版会、2023。〕

This is useful because we can handle original and translated items as a single bibliography item. However, since this feature has been marked as deprecated, it's a bad idea to propose implementing this.

An alternative idea is to create an item for a translated book and add fields such as original-title, original-publisher-place, original-publisher, and original-date. I'll try this idea. Thank you very much for pointing out the information.

kotobuki commented 1 year ago

I updated the style file to use original-* instead of alt-* and found that it worked fine with citeproc-lua. Initially, I wanted to add information regarding the translated book to the original book. I changed to add information regarding the original book to a translated book.

[
  {
    "id": "morgan2023jiyu",
    "author": [
      { "family": "Morgan", "given": "Casey" },
      { "family": "Patrov", "given": "Alexei" }
    ],
    "citation-key": "morgan2023jiyu",
    "event-place": "東京",
    "issued": { "date-parts": [[2023]] },
    "language": "ja",
    "original-date": { "date-parts": [[2022]] },
    "original-publisher": "Global Academic Press",
    "original-publisher-place": "Chicago, IL",
    "original-title": "The Philosophy of Free Will",
    "publisher": "城南大学出版会",
    "publisher-place": "東京",
    "title": "自由意志の哲学",
    "translator": [{ "family": "鈴木", "given": "真紀" }],
    "type": "book"
  }
]

The results with the style file were as follows:

I was happy to find that the orders of names were handled correctly (i.e., given-family for so-called Latin names and family-give for Japanese names).

Thank you very much for creating such a useful tool. 🙏