How could I output multiple language bibliography style with CSL control?

by evsz   Last Updated August 01, 2020 11:23 AM - source

I created a CSL named "general.csl", which is fit with some Chinese journals' requirements. Here is the MWE:

<?xml version="1.0" encoding="utf-8"?>
<style xmlns="http://purl.org/net/xbiblio/csl" class="note" version="1.0" et-al-min="4" et-al-use-first="1" sort-separator=";" page-range-format="expanded" demote-non-dropping-particle="sort-only" default-locale="zh-CN">
 <info>
   <title>基本通用格式</title>
   <id>http://www.zotero.org/styles/general</id>
   <author>
     <name> edward zhou</name>
   </author>
   <category citation-format="note"/>
   <category field="chinese social science"/>
   <rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>
 </info>
 <macro name="author">
   <names variable="author">
     <name delimiter="、" sort-separator=","/>
   </names>
   <names variable="editor" suffix="主编">
     <name delimiter="、" sort-separator=","/>
   </names>
 </macro>
 <macro name="editor">
   <names variable="editor" suffix="主编">
     <name delimiter="、" sort-separator=","/>
   </names>
 </macro>
 <macro name="container-title">
   <text variable="container-title" prefix="《" suffix="》"/>
 </macro>
 <macro name="container-author">
   <names variable="container-author">
     <name delimiter="、"/>
   </names>
 </macro>
 <macro name="pageField">
   <choose>
     <if type="chapter" match="any">
       <text variable="page" prefix="第" suffix="页。"/>
     </if>
     <else/>
   </choose>
 </macro>
 <macro name="secondAuthor">
   <names variable="translator" suffix="译">
     <name delimiter="、" sort-separator=","/>
   </names>
 </macro>
 <macro name="publisher">
   <choose>
     <if type="article article-journal article-magazine article-newspaper" match="any"/>
     <else>
       <text variable="abstract"/>
     </else>
   </choose>
 </macro>
 <macro name="place: publisher">
   <text variable="publisher-place" suffix=":"/>
   <text variable="publisher" suffix=","/>
 </macro>
 <macro name="en-layout">
   <names variable="author" suffix=", ">
     <name and="text" et-al-min="4" et-al-use-first="1" sort-separator=""/>
   </names>
   <choose>
     <if type="book" match="any">
       <names variable="translator" prefix="trans. " suffix=", ">
         <name and="text" et-al-min="4" et-al-use-first="1" sort-separator=""/>
       </names>
       <text variable="title" font-style="italic" suffix=", "/>
       <text variable="publisher-place" suffix=": "/>
       <text variable="publisher" suffix=", "/>
       <date date-parts="year" form="numeric" variable="issued"/>
     </if>
     <else-if type="chapter" match="any">
       <text variable="title" prefix="“" suffix=",” "/>
       <names variable="editor" prefix="in " suffix=", eds., ">
         <name and="text" et-al-min="4" et-al-use-first="1" sort-separator=""/>
       </names>
       <names variable="translator" prefix="trans." suffix=", ">
         <name and="text" et-al-min="4" et-al-use-first="1" sort-separator=""/>
       </names>
       <text variable="container-title" font-style="italic" suffix=", "/>
       <text variable="publisher-place" suffix=": "/>
       <text variable="publisher" suffix=", "/>
       <date date-parts="year" form="numeric" variable="issued" suffix=", "/>
       <text variable="page" prefix="pp. "/>
     </else-if>
     <else-if type="webpage" match="any">
       <text variable="title" prefix="“" suffix=",” "/>
       <text variable="container-title" font-style="italic" suffix=", "/>
       <date form="text" variable="issued" suffix=", "/>
       <text variable="URL" suffix=", "/>
       <date form="numeric" variable="accessed" prefix="访问时间:">
         <date-part name="year" range-delimiter="" prefix="," suffix="年"/>
         <date-part name="month" form="numeric" range-delimiter="" suffix="月"/>
         <date-part name="day" range-delimiter="" suffix="日"/>
       </date>
     </else-if>
     <else-if type="thesis" match="any">
       <text variable="title" font-style="italic" suffix=", "/>
       <text variable="publisher-place" suffix=": "/>
       <text variable="publisher" suffix=", "/>
       <text variable="genre" suffix=" Thesis, "/>
       <date date-parts="year" form="numeric" variable="issued"/>
     </else-if>
     <else>
       <text variable="title" prefix="“" suffix=",” "/>
       <text variable="container-title" font-style="italic" suffix=", "/>
       <text variable="volume" prefix="Vol. " suffix=", "/>
       <text variable="issue" prefix="No. " suffix=", "/>
       <date date-parts="year" form="text" variable="issued" suffix=", "/>
       <text variable="page" prefix="pp. "/>
     </else>
   </choose>
 </macro>
 <citation>
   <layout locale="en English en-GB en-gb en-us en-US eng" suffix=".">
     <text macro="en-layout"/>
   </layout>
   <layout suffix="。">
     <choose>
       <if type="article article-journal article-magazine" match="any">
         <text macro="author"/>
         <text macro="secondAuthor" prefix=","/>
         <text variable="title" prefix=":《" suffix="》,"/>
         <text macro="container-title"/>
         <date date-parts="year" form="text" variable="issued"/>
         <text variable="issue" prefix="第" suffix="期"/>
         <text variable="page" prefix=",第" suffix="页"/>
       </if>
       <else-if type="article-newspaper" match="any">
         <text macro="author"/>
         <text macro="secondAuthor" prefix=","/>
         <text variable="title" prefix=":《" suffix="》,"/>
         <text macro="container-title"/>
         <date form="text" variable="issued"/>
       </else-if>
       <else-if type="chapter" match="any">
         <names variable="author"/>
         <text variable="title" prefix=":《" suffix="》,"/>
         <text macro="editor" prefix="载"/>
         <text variable="container-title" prefix=":《" suffix="》,"/>
         <text macro="secondAuthor" suffix=","/>
         <text variable="publisher-place" suffix=":"/>
         <text variable="publisher"/>
         <date date-parts="year" form="text" variable="issued" prefix="," suffix=""/>
         <text variable="page" prefix=",第" suffix="页"/>
       </else-if>
       <else-if type="webpage" match="any">
         <names variable="author"/>
         <text variable="title" prefix=":《" suffix="》,"/>
         <text variable="container-title" suffix=","/>
         <date form="text" variable="issued" suffix=", "/>
         <text variable="URL" prefix=" " suffix=","/>
         <date form="text" variable="accessed" prefix="访问时间:"/>
       </else-if>
       <else-if type="thesis" match="any">
         <text macro="author"/>
         <text macro="secondAuthor" prefix=","/>
         <text variable="title" prefix=":《" suffix="》,"/>
         <text variable="publisher-place" suffix=":"/>
         <text variable="publisher"/>
         <date date-parts="year" form="text" variable="issued"/>
         <text variable="genre" suffix="学位论文"/>
       </else-if>
       <else>
         <text macro="author" suffix=""/>
         <text variable="title" prefix=":《" suffix="》"/>
         <text macro="secondAuthor" prefix="," />
         <text variable="publisher-place" prefix="," suffix=":"/>
         <text variable="publisher"/>
         <date date-parts="year" form="text" variable="issued" prefix="," suffix=""/>
       </else>
     </choose>
   </layout>
 </citation>
 <bibliography>
   <sort>
     <key variable="author"/>
   </sort>
   <layout locale="en English en-GB en-gb en-us en-US eng" suffix=".">
     <text macro="en-layout"/>
   </layout>
   <layout suffix="。">
     <choose>
       <if type="article article-journal article-magazine" match="any">
         <text macro="author"/>
         <text macro="secondAuthor" prefix=","/>
         <text variable="title" prefix=":《" suffix="》,"/>
         <text macro="container-title"/>
         <date date-parts="year" form="text" variable="issued"/>
         <text variable="issue" prefix="第" suffix="期"/>
         <text variable="page" prefix=",第" suffix="页"/>
       </if>
       <else-if type="article-newspaper" match="any">
         <text macro="author"/>
         <text macro="secondAuthor" prefix=","/>
         <text variable="title" prefix=":《" suffix="》,"/>
         <text macro="container-title"/>
         <date form="text" variable="issued"/>
       </else-if>
       <else-if type="chapter" match="any">
         <names variable="author"/>
         <text variable="title" prefix=":《" suffix="》,"/>
         <text macro="editor" prefix="载"/>
         <text variable="container-title" prefix=":《" suffix="》,"/>
         <text macro="secondAuthor" suffix="," />
         <text variable="publisher-place" suffix=":"/>
         <text variable="publisher"/>
         <date date-parts="year" form="text" variable="issued" prefix="," suffix=""/>
         <text variable="page" prefix=",第" suffix="页"/>
       </else-if>
       <else-if type="webpage" match="any">
         <names variable="author"/>
         <text variable="title" prefix=":《" suffix="》,"/>
         <text variable="container-title" suffix=","/>
         <date form="text" variable="issued" suffix=", "/>
         <text variable="URL" prefix=" " suffix=","/>
         <date form="text" variable="accessed" prefix="访问时间:"/>
       </else-if>
       <else-if type="thesis" match="any">
         <text macro="author"/>
         <text macro="secondAuthor" prefix=","/>
         <text variable="title" prefix=":《" suffix="》,"/>
         <text variable="publisher-place" suffix=":"/>
         <text variable="publisher"/>
         <date date-parts="year" form="text" variable="issued"/>
         <text variable="genre" suffix="学位论文"/>
       </else-if>
       <else>
         <text macro="author" suffix=""/>
         <text variable="title" prefix=":《" suffix="》"/>
         <text macro="secondAuthor" prefix="," />
         <text variable="publisher-place" prefix="," suffix=":"/>
         <text variable="publisher"/>
         <date date-parts="year" form="text" variable="issued" prefix="," suffix=""/>
       </else>
     </choose>
   </layout>
 </bibliography>
</style>

When using Markdown to Word transition with Pandoc, both English and Chinese bibliographies share the common style. Here is the pandoc MWE, but no use. pandoc -s --bibliography "my.bib" --filter pandoc-citeproc --csl "general.csl" -V default-locale="zh-CN" my.md -o out.docx

enter image description here

What I want is to illustrate the bibliography with two styles in my CSL based on language.

The Output Result I Want



Related Questions




Pandoc citations in the footnote

Updated July 21, 2019 12:23 PM


XeLaTeX: Chinese characters

Updated December 22, 2018 00:23 AM