citation-style-language / styles

Official repository for Citation Style Language (CSL) citation styles.
https://citationstyles.org/
3.34k stars 3.79k forks source link

Markdown style #1749

Closed FrViPofm closed 9 years ago

FrViPofm commented 9 years ago

Hi, not a style-request but a style proposal for people writing in Markdown. The style produce something like :

[^Morin1992]: Morin Edgar, ***La Méthode. Tome 3, La connaissance de la connaissance***, Paris, Seuil, coll. « Points Essais », n˚ 236, 1992.

that can be pasted in the Markdown code producing :

[^Morin1992]: Morin Edgar, _La Méthode. Tome 3, La connaissance de la connaissance_, Paris, Seuil, coll. « Points Essais », n˚ 236, 1992.

For the Markdown flavours with foot note, the footnote caller is the beginning : [^Morin1992]

I'm not very skilful in managing git, so I paste the code below :

<?xml version="1.0" encoding="utf-8"?>
<style xmlns="http://purl.org/net/xbiblio/csl" class="note" default-locale="fr-FR" version="1.0" page-range-format="expanded">
  <info>
    <title>Markdown (French)</title>
    <id>http://www.zotero.org/styles/Markdown</id>
    <link href="http://www.zotero.org/styles/triangle-extanded" rel="self"/>
    <author>
      <name>FrViPofm</name>
    </author>
    <author>
      <name>FrViPofm</name>
      <uri>http://www.frvipofm.net/</uri>
    </author>
    <category citation-format="note"/>
    <category field="social_science"/>
    <summary>A style to put markdown coded export in the clipboard, and paste it in a Markdown text as a footnote.</summary>
    <updated>2015-05-26T20:52:54</updated>
    <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>
  <locale xml:lang="fr">
    <terms>
      <term name="editor" form="short">
        <single>(dir.)</single>
        <multiple>(dir.)</multiple>
      </term>
      <term name="ordinal-01">ère</term>
      <term name="ordinal-02">e</term>
      <term name="ordinal-03">e</term>
      <term name="ordinal-04">e</term>
      <term name="cited">op.&#160;cit.</term>
      <term name="page" form="short">
        <single>p.</single>
        <multiple>pp.</multiple>
      </term>
      <term name="editor" form="verb-short">dir. par&#160; </term>
      <term name="editor" form="verb">dirigé par&#160; </term>
      <term name="translator" form="verb-short">trad. par&#160;</term>
      <term name="interviewer" form="verb">entretien réalisé par&#160;</term>
      <term name="in">in&#160;:</term>
      <term name="edition">édition</term>
      <term name="accessed">consulté le&#160;</term>
      <term name="at">disponible sur&#160;: </term>
      <term name="et-al">et al.</term>
    </terms>
  </locale>
  <!-- INFORMATIONS -->
  <!-- UTILISATION D'espaces insécables &#160; POUR EVITER DE MALENCONTREUX RETOURS A LA LIGNE -->
  <!-- CODAGE &lt; POUR SIGNE INFÉRIEUR ET &gt; POUR SIGNE SUPÉRIEUR  -->
  <!-- Fonction du type de référence : cf. http://citationstyles.org/downloads/specification-csl10-20100530.html#appendix-ii-types -->
  <!-- /INFORMATIONS -->
  <!--_-_-_-_-_-SECTION DEFINITION DES MACROS-_-_-_-_-_-_-->
  <macro name="author">
    <choose>
      <if variable="author">
        <names variable="author">
          <name form="long" and="text" delimiter-precedes-last="never" sort-separator=" " font-style="normal">
            <name-part name="family" font-variant="small-caps"/>
          </name>
        </names>
      </if>
      <else-if variable="editor">
        <names variable="editor">
          <name form="long" and="text" delimiter-precedes-last="never" sort-separator=" " font-style="normal">
            <name-part name="family" font-variant="small-caps"/>
          </name>
          <label form="short" prefix="&#160;"/>
        </names>
      </else-if>
    </choose>
  </macro>
  <macro name="note-anchor">
    <group prefix="[^" suffix="]: ">
      <choose>
        <if variable="author">
          <names variable="author">
            <name form="short" and="text" delimiter=", "/>
            <substitute>
              <names variable="editor"/>
              <names variable="translator"/>
              <text macro="title"/>
            </substitute>
          </names>
          <date variable="issued">
            <date-part name="year"/>
          </date>
        </if>
        <else-if variable="editor">
          <names variable="editor">
            <name name-as-sort-order="all" form="long" and="text" delimiter-precedes-last="never" sort-separator=" " font-style="normal">
              <name-part name="family"/>
            </name>
            <label form="short" prefix="&#160;"/>
          </names>
        </else-if>
      </choose>
    </group>
  </macro>
  <macro name="author-bib">
    <choose>
      <if variable="author">
        <names variable="author">
          <name name-as-sort-order="all" form="long" and="text" delimiter-precedes-last="never" sort-separator=" " font-style="normal">
            <name-part name="family" font-variant="small-caps"/>
          </name>
        </names>
      </if>
      <else-if variable="editor">
        <names variable="editor">
          <name name-as-sort-order="all" form="long" and="text" delimiter-precedes-last="never" sort-separator=" " font-style="normal">
            <name-part name="family" font-variant="small-caps"/>
          </name>
          <label form="short" prefix="&#160;"/>
        </names>
      </else-if>
    </choose>
  </macro>
  <macro name="editor">
    <names variable="editor">
      <name form="long" and="text" delimiter-precedes-last="never" sort-separator=" " font-style="normal">
        <name-part name="family" font-variant="small-caps"/>
      </name>
      <label form="short" prefix="&#160;"/>
    </names>
  </macro>
  <macro name="translator">
    <names variable="translator">
      <name form="long" and="text" delimiter-precedes-last="never" sort-separator=" " font-style="normal" prefix=" traduit par ">
        <name-part name="family" font-variant="small-caps"/>
      </name>
    </names>
  </macro>
  <macro name="title">
    <choose>
      <if type="figure graphic" match="any">
        <text variable="title" text-case="capitalize-first" font-style="italic" suffix="&#160;[Image]"/>
      </if>
      <else-if type="motion_picture" match="any">
        <text variable="title" text-case="capitalize-first" font-style="italic" prefix="**" suffix="**&#160;[film]"/>
      </else-if>
      <else-if type="report" match="any">
        <text variable="title" text-case="capitalize-first" font-style="italic" suffix="&#160;[Rapport]"/>
      </else-if>
      <else-if type="bill book legal_case song" match="any">
        <text variable="title" text-case="capitalize-first" prefix="***" suffix="***"/>
      </else-if>
      <else-if type="article-journal article-newspaper article-magazine" match="any">
        <group delimiter=", ">
          <text variable="title" text-case="capitalize-first" prefix="«&#160;" suffix="&#160;»" font-style="normal"/>
          <text variable="container-title" font-style="italic"/>
        </group>
      </else-if>
      <else-if type="thesis" match="any">
        <group>
          <text variable="title" text-case="capitalize-first" font-style="italic" suffix=","/>
          <!-- pour le jour où il y aura un champ 'directeur' dans la fiche thèse de zotero...-->
          <!--
                                        <text term="editor" form="verb" prefix="&#160;"/>
                                        <text variable="editor" suffix=",&#160;"/>   
                                        <text variable="genre"/> 
                                        -->
        </group>
      </else-if>
      <else-if type="manuscript" match="any">
        <group delimiter=",">
          <text variable="title" text-case="capitalize-first" prefix="«&#160;" suffix="&#160;»" font-style="normal"/>
          <text variable="genre" prefix=" "/>
        </group>
      </else-if>
      <else-if type="chapter entry-dictionary entry-encyclopedia" match="any">
        <group>
          <text variable="title" text-case="capitalize-first" prefix="«&#160;" suffix="&#160;»,"/>
          <text value="in" font-style="italic" suffix=" " prefix=" "/>
          <text macro="editor" suffix=", "/>
          <text variable="container-title" text-case="capitalize-first" font-style="italic"/>
        </group>
      </else-if>
      <else>
        <text variable="title" prefix="«&#160;" suffix="&#160;»"/>
      </else>
    </choose>
  </macro>
  <macro name="pub-place">
    <choose>
      <if type="bill book chapter entry-dictionary entry-encyclopedia thesis graphic legal_case manuscript motion_picture paper-conference report song" match="any">
        <text variable="publisher-place"/>
      </if>
    </choose>
  </macro>
  <macro name="publisher">
    <choose>
      <if type="bill book chapter entry-dictionary entry-encyclopedia graphic legal_case motion_picture paper-conference report song thesis" match="any">
        <text variable="publisher"/>
      </if>
    </choose>
  </macro>
  <macro name="yearpage-ndbp">
    <choose>
      <if type="bill book graphic legal_case motion_picture paper-conference manuscript report song thesis" match="any">
        <group delimiter=", " font-style="normal">
          <date variable="issued">
            <date-part name="year"/>
          </date>
          <group>
            <text term="volume" form="short" suffix="."/>
            <text variable="number-of-volumes" prefix=". " suffix="/"/>
            <text variable="volume"/>
          </group>
        </group>
      </if>
      <else-if type="entry-dictionary entry-encyclopedia" match="any">
        <group delimiter=" " font-style="normal">
          <date variable="issued">
            <date-part name="year"/>
          </date>
          <group>
            <text term="volume" form="short" suffix="."/>
            <text variable="number-of-volumes" prefix=". " suffix="/"/>
            <text variable="volume" suffix=","/>
          </group>
        </group>
      </else-if>
      <else-if type="article-newspaper article-magazine" match="any">
        <group delimiter=" " font-style="normal">
          <label variable="page" form="short"/>
          <text variable="page"/>
        </group>
        <group delimiter=" " font-style="normal">
          <choose>
            <if variable="locator" match="any">
              <text variable="locator" prefix="p.&#160;"/>
            </if>
            <else-if variable="locator" match="none">
              <label variable="page" form="short"/>
            </else-if>
          </choose>
        </group>
      </else-if>
      <else-if type="webpage" match="any">
        <group delimiter=", " font-style="normal">
          <date variable="issued" form="text">
            <date-part name="day"/>
            <date-part name="month" text-case="lowercase"/>
            <date-part name="year"/>
          </date>
          <text variable="container-title"/>
        </group>
      </else-if>
      <else-if type="article-journal chapter" match="any">
        <group delimiter=" " font-style="normal">
          <label variable="page" form="short"/>
          <text variable="page"/>
        </group>
      </else-if>
    </choose>
  </macro>
  <macro name="yearpage-bib">
    <choose>
      <if type="bill book graphic legal_case motion_picture paper-conference manuscript report song thesis" match="any">
        <group delimiter=", ">
          <group delimiter=", " font-style="normal">
            <date variable="issued">
              <date-part name="year"/>
            </date>
            <group>
              <text term="volume" form="short" suffix="."/>
              <text variable="number-of-volumes" prefix=". " suffix="/"/>
              <text variable="volume"/>
            </group>
            <!-- intégration automatique de premiere edition -->
            <group delimiter=", " prefix=" [" suffix="]">
              <text variable="original-title" prefix="**" suffix="**"/>
              <text variable="original-publisher-place"/>
              <text variable="original-publisher"/>
              <date variable="original-date" prefix="*" suffix="*">
                <date-part name="year"/>
              </date>
            </group>
            <text variable="number-of-pages" suffix="&#160;p."/>
            <text variable="page" suffix="&#160;p."/>
            <!-- pour les rapports-->
          </group>
          <group>
            <label variable="locator" form="short"/>
            <text variable="locator"/>
          </group>
        </group>
      </if>
      <else-if type="chapter entry-dictionary entry-encyclopedia" match="any">
        <group delimiter=", " font-style="normal">
          <date variable="issued">
            <date-part name="year"/>
          </date>
          <group>
            <text term="volume" form="short" suffix="."/>
            <text variable="number-of-volumes" prefix=". " suffix="/"/>
            <text variable="volume"/>
          </group>
          <group>
            <label variable="page" form="short"/>
            <text variable="page" prefix="&#160;"/>
          </group>
        </group>
      </else-if>
      <else-if type="article-journal chapter" match="any">
        <group delimiter=" " font-style="normal">
          <label variable="page" form="short"/>
          <text variable="page"/>
        </group>
      </else-if>
      <else-if type="article-newspaper article-magazine" match="any">
        <group delimiter=" " font-style="normal">
          <label variable="page" form="short"/>
          <text variable="page"/>
        </group>
      </else-if>
      <else-if type="webpage" match="any">
        <group delimiter=", " font-style="normal">
          <date variable="issued" form="text">
            <date-part name="day"/>
            <date-part name="month" text-case="lowercase"/>
            <date-part name="year"/>
          </date>
          <text variable="container-title"/>
        </group>
      </else-if>
    </choose>
  </macro>
  <macro name="edition">
    <choose>
      <if type="bill book graphic legal_case motion_picture report song chapter paper-conference" match="any">
        <choose>
          <if is-numeric="edition">
            <group delimiter=" ">
              <number variable="edition" form="ordinal"/>
              <text term="edition" form="short"/>
            </group>
          </if>
          <else>
            <text variable="edition" text-case="capitalize-first" suffix="."/>
          </else>
        </choose>
      </if>
      <else-if type="article-journal article-magazine article-newspaper" match="any">
        <group font-style="normal">
          <choose>
            <if variable="issued">
              <date variable="issued">
                <date-part name="day" suffix=" "/>
                <date-part name="month" suffix=" "/>
                <date-part name="year"/>
              </date>
              <text macro="volume" prefix=", "/>
            </if>
            <else>
              <text macro="volume" text-case="capitalize-first"/>
            </else>
          </choose>
        </group>
      </else-if>
    </choose>
    <text macro="issue" prefix=", "/>
  </macro>
  <macro name="volume">
    <choose>
      <if is-numeric="volume">
        <text term="volume" form="short" suffix=".&#160;"/>
        <text variable="volume"/>
      </if>
      <else>
        <text variable="volume"/>
      </else>
    </choose>
  </macro>
  <macro name="issue">
    <choose>
      <if is-numeric="issue">
        <text term="issue" form="short" suffix="&#160;"/>
        <text variable="issue"/>
      </if>
      <else>
        <text variable="issue"/>
      </else>
    </choose>
  </macro>
  <macro name="collection">
    <choose>
      <if is-numeric="collection-number">
        <text variable="collection-title" prefix=" coll.&#160;«&#160;" suffix="&#160;»"/>
        <text variable="collection-number" prefix=", n˚&#160;"/>
      </if>
      <else>
        <text variable="collection-title" prefix=" coll.&#160;«&#160;" suffix="&#160;»"/>
      </else>
    </choose>
  </macro>
  <!-- (Ajout d'une url pour les références...)-->
  <!-- I/ ...des notes de bas de pages-->
  <macro name="internet-ndbp">
    <choose>
      <if type="article-newspaper webpage post-weblog" match="any">
        <!-- l'URL N'apparait que pour les documents ci-dessus-->
        <choose>
          <if variable="URL" match="any">
            <group>
              <text value="URL complète en bibliographie" prefix="&#160;(" suffix=",&#160;" text-case="capitalize-first"/>
              <text term="accessed"/>
              <date variable="accessed" form="text" suffix=")">
                <date-part name="day"/>
                <date-part name="month" text-case="lowercase"/>
                <date-part name="year"/>
              </date>
            </group>
          </if>
          <else-if variable="DOI" match="any">
            <group>
              <text value="URL complète en bibliographie" prefix="&#160;(" suffix=",&#160;" text-case="capitalize-first"/>
              <text term="accessed"/>
              <date variable="accessed" form="text" suffix=")">
                <date-part name="day"/>
                <date-part name="month" text-case="lowercase"/>
                <date-part name="year"/>
              </date>
            </group>
          </else-if>
        </choose>
      </if>
      <else-if type="article-journal article-magazine book chapter thesis" match="any">
        <choose>
          <if variable="URL" match="any">
            <text value="."/>
          </if>
          <else>
            <text value="."/>
          </else>
        </choose>
      </else-if>
    </choose>
  </macro>
  <!-- II/ ...de la bibliographie-->
  <macro name="internet-bib">
    <choose>
      <if variable="URL" match="any">
        <group>
          <text variable="URL" text-decoration="underline" prefix="&#160;[&#160;"/>
          <text value="&#160;]" suffix=",&#160;" text-case="capitalize-first"/>
          <text term="accessed" suffix=":&#160;"/>
          <date variable="accessed" prefix="&#160;" form="text" suffix=".">
            <date-part name="day"/>
            <date-part name="month" text-case="lowercase"/>
            <date-part name="year"/>
          </date>
        </group>
      </if>
      <else-if variable="DOI" match="any">
        <group>
          <text value="http://dx.doi.org/" text-decoration="underline" prefix="&#160;[&#160;"/>
          <text variable="DOI" text-decoration="underline"/>
          <text value="&#160;]" suffix=",&#160;" text-case="capitalize-first"/>
          <text term="accessed" suffix="&#160;:&#160;"/>
          <date variable="accessed" form="text" suffix=".">
            <date-part name="day"/>
            <date-part name="month" text-case="lowercase"/>
            <date-part name="year"/>
          </date>
        </group>
      </else-if>
    </choose>
  </macro>
  <!--_-_-_-_-_-SECTION DEFINITION DES Notes de bas de pages (citation)-_-_-_-_-_-_-->
  <citation>
    <layout suffix="." delimiter="&#160;">
      <choose>
        <if position="ibid-with-locator">
          <group delimiter=",&#160;">
            <text term="ibid" text-case="capitalize-first" font-style="italic" suffix="."/>
            <text variable="locator" prefix="p.&#160;"/>
          </group>
        </if>
        <else-if position="ibid">
          <text term="ibid" text-case="capitalize-first" font-style="italic"/>
        </else-if>
        <else-if position="subsequent">
          <group delimiter=", ">
            <text macro="author"/>
            <choose>
              <if type="bill book graphic legal_case motion_picture report song thesis" match="any">
                <text variable="title" form="short" font-style="italic"/>
              </if>
              <else>
                <text variable="title" text-case="capitalize-first" form="short" prefix="«&#160;" suffix="&#160;»" font-style="normal"/>
              </else>
            </choose>
            <text term="cited" font-style="italic" suffix="."/>
            <text variable="locator" prefix="p.&#160;"/>
          </group>
        </else-if>
        <else>
          <group delimiter=",&#160;">
            <text macro="author"/>
            <text macro="title"/>
            <text macro="translator"/>
            <text macro="edition"/>
            <text macro="pub-place"/>
            <text macro="publisher"/>
            <text macro="collection"/>
          </group>
          <!-- Groupe à part pour éviter les problèmes de ponctuation ("delimiter")-->
          <group>
            <text macro="yearpage-ndbp" prefix=",&#160;"/>
            <!-- intégration automatique de la localisation (pages indiqués)-->
            <text variable="locator" prefix=",&#160;p.&#160;"/>
            <!-- intégration de la macro-test pour les adresses internet-->
            <text macro="internet-ndbp"/>
          </group>
        </else>
      </choose>
    </layout>
  </citation>
  <!--_-_-_-_-_-SECTION DEFINITION DES références bibliographiques (bibliography)-_-_-_-_-_-_-->
  <bibliography hanging-indent="true" >
    <sort>
      <key macro="author" names-min="3" names-use-first="3"/>
      <key variable="issued" sort="descending"/>
    </sort>
    <layout suffix=".">
      <text macro="note-anchor"/>
      <group delimiter=", ">
        <text macro="author-bib"/>
        <text macro="title"/>
        <text macro="translator"/>
        <text macro="edition"/>
        <text macro="pub-place"/>
        <text macro="publisher"/>
        <text macro="collection"/>
        <text macro="yearpage-bib"/>
        <!-- intégration automatique de la localisation (pages indiqués)-->
        <text variable="locator" prefix="p.&#160;"/>
        <!-- intégration de la macro-test pour les adresses internet-->
        <text macro="internet-bib"/>
      </group>
    </layout>
  </bibliography>
</style>
rmzelle commented 9 years ago

Thanks. (note that in general, you can also create a "gist" at https://gist.github.com/, which is often easier to share code of entire styles.)

While I understand how this style is useful to you, it's not something we would accept into our repository, for two main reasons. First, this style is a bit of a hack (although a helpful one), since it shouldn't be the role of the citation style to define the "footnote caller" anchor. In addition, the actual style format is arbitrary, and theoretically we could come up with a markdown version of every existing CSL style. If we accept this one, people might demand version with different style formats, and we really don't want a whole bunch of these styles.

So I'll close this issue. People will still be able to find this closed issue via search, and you're of course welcome to distribute this style yourself (and e.g. blog about it) if you think it can be of use to others. But it doesn't belong in the central repository.