Commit 94153045 authored by Stephane Crozat's avatar Stephane Crozat
Browse files

init

parents
output
tmp
log
This diff is collapsed.
z2s
version 0.6.20170228.1
AUTHOR
Stéphane Crozat
http://stph.crzt.fr
LICENCE
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-> Doc utilisateur dans le README
-> Paramétrage : fichier de properties, dossier de sortie...
-> liste de ref biblio en section Optim (paramétrable) (en cours)
-> gestion de type (section Optim) + webo/biblio Opale (paramétrable)
-> gérer double edition (YYYY/YYYY) ou autre format (paramètre édition par exemple)
-> gérer "Translated by"
-> trouver un moyen de mutualiser "edition | publisher | pubPlace | note[@type='thesisType']"
-> ajouter autres contributors (editeurs par exemple)
This diff is collapsed.
File added
@echo off
set lib=lib
set ant=zoterotei2scenari.ant
set antparam=-Dprogram.param=%1
set scJarList=%lib%\*
java.exe -classpath "%scJarList%" -Xmx150m org.apache.tools.ant.Main -buildfile %ant% %antparam%
pause
REM start /MIN java.exe -classpath "%scJarList%" -Xmx150m org.apache.tools.ant.Main -buildfile %ant% %antparam%
#!/bin/sh
lib="lib"
ant="zoterotei2scenari.ant"
antparam="-Dprogram.param=$1"
#Recherche de java et controle que se soit une version SUN
vJavaCmd="java"
xCheckJava () {
vInputVarName=\$"$1"
vInputVarVal=`eval "expr \"$vInputVarName\" "`
if [ -z "$vInputVarVal" ];then
eval "$1=false"
return
fi
vSunJavaFound=`$vInputVarVal -version 2>&1 | grep -Eo -m 1 "(HotSpot)|(OpenJDK)"`
if [ "$vSunJavaFound" != "HotSpot" ] && [ "$vSunJavaFound" != "OpenJDK" ] ; then
eval "$1=false"
return
fi
}
xCheckJava vJavaCmd
if [ "$vJavaCmd" = "false" ]; then
vJavaCmd="$JAVA_HOME/bin/java"
xCheckJava vJavaCmd
if [ "$vJavaCmd" = "false" ]; then
echo "ERREUR: JRE de SUN introuvable. Veuillez déclarer la variable d'environnement JAVA_HOME."
exit 1
fi
fi
#Lancer la commande
scJarList="$lib/*"
$vJavaCmd -classpath "$scJarList:" -Xmx150m org.apache.tools.ant.Main -buildfile $ant $antparam
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="2.0">
<!--****************************************************************
Last update : 2015/05/13
Add translate / to -
Add translate – to -
*****************************************************************-->
<xsl:template name="ValueOfAsURI">
<xsl:param name="pInput"></xsl:param>
<xsl:value-of select="
translate(
normalize-space($pInput),
' AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZzÀàÁáÂâÃãÄäÅåÆæÇçÈèÉéÊêËëÌìÍíÎîÏïÐðÑñÒòÓóÔôÕõÖöØøÙùÚúÛûÜüÝýÞþ–/',
'_aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzzaaaaaaaaaaaaaacceeeeeeeeiiiiiiiioonnoooooooooooouuuuuuuuyyzz--'
)"/>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!--
<a href="http://stph.crzt.fr">Stéphane Crozat</a>
<a href="http://www.gnu.org/licenses/gpl-3.0.txt">License GPL3.0</a>
Jun 14, 2015
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0"
xmlns:sc="http://www.utc.fr/ics/scenari/v3/core"
xmlns:op="utc.fr:ics/opale3" xmlns:sp="http://www.utc.fr/ics/scenari/v3/primitive">
<xsl:param name="pOutputPath">/tmp</xsl:param>
<xsl:template match="bib">
<xsl:apply-templates select="ref"/>
<message>Output set to <xsl:value-of select="$pOutputPath"/></message>
</xsl:template>
<xsl:template match="ref">
<xsl:result-document href="file://{$pOutputPath}/{ref-id}.ref" encoding="UTF-8" method="xml" >
<sc:item>
<op:bib>
<op:bibM>
<sp:id><xsl:value-of select="ref-name"/></sp:id>
<sp:type>bib</sp:type>
<sp:desc>
<op:bibTxt>
<sc:para xml:space="preserve"><xsl:apply-templates select="*"/></sc:para>
</op:bibTxt>
</sp:desc>
</op:bibM>
</op:bib>
</sc:item>
</xsl:result-document>
</xsl:template>
<xsl:template match="structured-data | ref-id | ref-name"/>
<xsl:template match="authors">
<xsl:if test="text()!=''">
<sc:textLeaf role="auth">
<xsl:value-of select="."/>
</sc:textLeaf>
<xsl:text>. </xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="title">
<xsl:if test="text()!=''">
<sc:textLeaf role="title">
<xsl:value-of select="."/>
</sc:textLeaf>
<xsl:text>. </xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="edition">
<xsl:if test="text()!=''">
<sc:textLeaf role="ed">
<xsl:value-of select="."/>
</sc:textLeaf>
<xsl:text>. </xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="year">
<xsl:if test="text()!=''">
<sc:textLeaf role="date">
<xsl:value-of select="."/>
</sc:textLeaf>
<xsl:text>. </xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="url">
<xsl:if test="text()!=''">
<sc:uLink role="url" url="{.}">
<xsl:value-of select="."/>
</sc:uLink>
<xsl:text>. </xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="*">
<xsl:if test="text()!=''">
<xsl:value-of select="."/>
<xsl:text>. </xsl:text>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!--
<a href="http://stph.crzt.fr">Stéphane Crozat</a>
<a href="http://www.gnu.org/licenses/gpl-3.0.txt">License GPL3.0</a>
Aug 31, 2015
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0"
xmlns:sc="http://www.utc.fr/ics/scenari/v3/core"
xmlns:of="scpf.org:office" xmlns:sp="http://www.utc.fr/ics/scenari/v3/primitive">
<xsl:param name="pOutputPath">/tmp</xsl:param>
<xsl:template name="section">
<xsl:param name="title"/>
<xsl:param name="type"/>
<sp:sec>
<of:section>
<of:sectionM>
<sp:title><xsl:value-of select="$title"/></sp:title>
</of:sectionM>
<sp:content>
<of:fragment>
<xsl:apply-templates select="ref[@type=$type]" mode="section">
<xsl:sort select="year" order="descending"/>
</xsl:apply-templates>
</of:fragment>
</sp:content>
</of:section>
</sp:sec>
</xsl:template>
<xsl:template match="bib">
<!-- Section -->
<sc:item xmlns:sc="http://www.utc.fr/ics/scenari/v3/core">
<of:section xmlns:of="scpf.org:office" xmlns:sp="http://www.utc.fr/ics/scenari/v3/primitive">
<of:sectionM>
<sp:title>Bibliographie</sp:title>
</of:sectionM>
<!-- book -->
<xsl:call-template name="section">
<xsl:with-param name="title">Livres</xsl:with-param>
<xsl:with-param name="type">book</xsl:with-param>
</xsl:call-template>
<!-- bookSection -->
<xsl:call-template name="section">
<xsl:with-param name="title">Chapitres de livre</xsl:with-param>
<xsl:with-param name="type">bookSection</xsl:with-param>
</xsl:call-template>
<!-- journalArticle -->
<xsl:call-template name="section">
<xsl:with-param name="title">Articles de revues</xsl:with-param>
<xsl:with-param name="type">journalArticle</xsl:with-param>
</xsl:call-template>
<!-- conferencePaper -->
<xsl:call-template name="section">
<xsl:with-param name="title">Articles de conférence</xsl:with-param>
<xsl:with-param name="type">conferencePaper</xsl:with-param>
</xsl:call-template>
<!-- presentation -->
<xsl:call-template name="section">
<xsl:with-param name="title">Communications orales</xsl:with-param>
<xsl:with-param name="type">presentation</xsl:with-param>
</xsl:call-template>
<!-- presentation -->
<xsl:call-template name="section">
<xsl:with-param name="title">Mémoires</xsl:with-param>
<xsl:with-param name="type">thesis</xsl:with-param>
</xsl:call-template>
<!-- Autres -->
<sp:sec>
<of:section>
<of:sectionM>
<sp:title>Autres publications et communications</sp:title>
</of:sectionM>
<sp:content>
<of:fragment>
<xsl:apply-templates select="ref[not(@type)]
| ref[@type!='book'
and @type!='bookSection'
and @type!='journalArticle'
and @type!='conferencePaper'
and @type!='presentation'
]"
mode="section"></xsl:apply-templates>
</of:fragment>
</sp:content>
</of:section>
</sp:sec>
</of:section>
</sc:item>
<!-- Fragment -->
<xsl:apply-templates select="ref"/>
</xsl:template>
<xsl:template match="ref" mode="section">
<sp:frag sc:refUri="co/{ref-id}.fragment"/>
</xsl:template>
<xsl:template match="ref">
<xsl:result-document href="file://{$pOutputPath}/{ref-id}.fragment" encoding="UTF-8" method="xml" >
<sc:item xmlns:sc="http://www.utc.fr/ics/scenari/v3/core">
<of:fragment xmlns:of="scpf.org:office" xmlns:sp="http://www.utc.fr/ics/scenari/v3/primitive">
<sp:info>
<of:block>
<of:blockM/>
<sp:co>
<of:flow>
<sp:txt>
<of:txt>
<sc:para xml:space="preserve"><xsl:apply-templates select="*"/></sc:para>
</of:txt>
</sp:txt>
</of:flow>
</sp:co>
</of:block>
</sp:info>
</of:fragment>
</sc:item>
</xsl:result-document>
</xsl:template>
<xsl:template match="structured-data | ref-id | ref-name"/>
<xsl:template match="title">
<xsl:if test="text()!=''">
<sc:inlineStyle role="emphasis">
<xsl:value-of select="."/>
</sc:inlineStyle>
<xsl:text>. </xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="url">
<xsl:if test="text()!=''">
<sc:phrase role="url">
<of:urlM xmlns:of="scpf.org:office">
<sp:url xmlns:sp="http://www.utc.fr/ics/scenari/v3/primitive"><xsl:value-of select="."/></sp:url>
</of:urlM>
<xsl:value-of select="."/>
</sc:phrase>
<xsl:text>. </xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="*">
<xsl:if test="text()!=''">
<xsl:value-of select="."/>
<xsl:text>. </xsl:text>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!--
<a href="http://stph.crzt.fr">Stéphane Crozat</a>
<a href="http://www.gnu.org/licenses/gpl-3.0.txt">License GPL3.0</a>
Sep 03, 2015
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0"
xmlns:sc="http://www.utc.fr/ics/scenari/v3/core"
xmlns:of="scpf.org:office" xmlns:sp="http://www.utc.fr/ics/scenari/v3/primitive">
<xsl:param name="pOutputPath">/tmp</xsl:param>
<xsl:template match="bib">
<xsl:apply-templates select="ref"/>
<message>Output set to <xsl:value-of select="$pOutputPath"/></message>
</xsl:template>
<xsl:template match="ref">
<xsl:result-document href="file://{$pOutputPath}/{ref-id}.refs" encoding="UTF-8" method="xml" >
<sc:item>
<of:def>
<of:defM>
<sp:term><xsl:value-of select="ref-name"/></sp:term>
</of:defM>
<sp:def>
<of:sTxt>
<sc:para xml:space="preserve"><xsl:apply-templates select="*"/></sc:para>
</of:sTxt>
</sp:def>
</of:def>
</sc:item>
</xsl:result-document>
</xsl:template>
<xsl:template match="structured-data | ref-id | ref-name"/>
<xsl:template match="title">
<xsl:if test="text()!=''">
<sc:phrase role="special">
<xsl:value-of select="."/>
</sc:phrase>
<xsl:text>. </xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="url">
<xsl:if test="text()!=''">
<sc:phrase role="url">
<of:urlM>
<sp:url><xsl:value-of select="."/></sp:url>
<sp:title><xsl:value-of select="../title"/></sp:title>
</of:urlM>
<xsl:value-of select="."/>
</sc:phrase>
<xsl:text>.</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="*">
<xsl:if test="text()!=''">
<xsl:value-of select="."/>
<xsl:text>. </xsl:text>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!--
<a href="http://stph.crzt.fr">Stéphane Crozat</a>
<a href="http://www.gnu.org/licenses/gpl-3.0.txt">License GPL3.0</a>
Jun 14, 2015
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0"
xpath-default-namespace="http://www.tei-c.org/ns/1.0">
<xsl:output
indent="yes"
encoding="UTF-8"
method="xml"/>
<!--****************************************************************
Return a standard bibliographic référence with the authors' names and
the year of the publication. If there are two authors, they are both
included, if there are more "et al." is added to the first name.
Ex :
Crozat, 2015
Crozat and Bachimont, 2015
Crozat et al., 2015
*****************************************************************-->
<xsl:template name="GenerateRefName">
<!-- Retreives the list of the authors, without editors and contributors if possible -->
<xsl:variable name="vAuthors">
<xsl:call-template name="GenerateAuthorsList">
<xsl:with-param name="pMode">authors-only</xsl:with-param>
<xsl:with-param name="pNameMode">surname-only</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<!-- Test how many authors there is -->
<xsl:variable name="vFirstAuthor" select="tokenize($vAuthors,', ')[1]"/>
<xsl:variable name="vSecondAuthor" select="tokenize($vAuthors,', ')[2]"/>
<xsl:variable name="vThirdAuthor" select="tokenize($vAuthors,', ')[3]"/>
<xsl:choose>
<!-- If no author identified, "Anonym." is returned-->
<xsl:when test="not($vFirstAuthor)">
Anonym.
</xsl:when>
<!-- If one author, is name is returned-->
<xsl:when test="not($vSecondAuthor)">
<xsl:value-of select="$vFirstAuthor"/>
</xsl:when>
<!-- If two authors, their names are returned separated with coma -->
<xsl:when test="not($vThirdAuthor)">
<xsl:value-of select="$vFirstAuthor"/>
<xsl:text> and </xsl:text>
<xsl:value-of select="$vSecondAuthor"/>
</xsl:when>
<!-- If more than two authors, first name is returned with "et al."-->
<xsl:when test="$vThirdAuthor">
<xsl:value-of select="$vFirstAuthor"/>
<xsl:text> et al.</xsl:text>
</xsl:when>
</xsl:choose>
<!-- Add coma -->
<xsl:text>, </xsl:text>
<!-- Add publication year-->
<xsl:call-template name="GenerateYear"/>
</xsl:template>
<!--****************************************************************
Return a standard bibliographic id with the first author name, the year
of the publication and the words of the title separated with underscores.
Accents, upper case and ponctuations are removed end URI encoding is performed.
Total length is limited to 100 characters.
Ex :
Crozat-2012-Elements_pour_une_theorie_operationnelle
*****************************************************************-->
<xsl:template name="GenerateRefId">
<xsl:variable name="vId">
<xsl:call-template name="GenerateRefIdNotEncoded"/>
</xsl:variable>
<xsl:variable name="vIdAsUri">
<xsl:call-template name="ValueOfAsURI">
<xsl:with-param name="pInput" select="$vId"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="substring($vIdAsUri,1,100)"></xsl:value-of>
</xsl:template>
<!-- Use externalized XSL ValueOfAsUri.xsl -->
<xsl:include href="ValueOfAsUri.xsl"/>
<xsl:template name="GenerateRefIdNotEncoded">
<!-- Number of words of the title to keep (desactivate with high value)-->
<xsl:variable name="vWords" select="100"/>
<!-- Retreives the list of the authors, without editors and contributors if possible -->
<xsl:variable name="vAuthors">
<xsl:call-template name="GenerateAuthorsList">
<xsl:with-param name="pMode" select="authors-only"/>
<xsl:with-param name="pNameMode">surname-only</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<!-- Keep only first author name -->
<xsl:value-of select="tokenize($vAuthors,', ')[1]"/>
<!-- Add dash, year, dash -->
<xsl:text>-</xsl:text>
<xsl:call-template name="GenerateYear"/>
<xsl:text>-</xsl:text>
<!-- Add first words of the title -->
<xsl:for-each select="
tokenize(
normalize-space(.//title[parent::analytic or not(../preceding-sibling::*/title)][1]),
'(\s)|(,)|(\.)|(:)|(;)|(\?)|(!)|('')|’|(&quot;)|(&amp;)|(\()|(\))|(\[)|(\])|(«)|(»)|(%)|(-)')
[position()&lt;$vWords]">
<xsl:value-of select="."/>
<xsl:if test="not(position()=$vWords or position()=last())">
<xsl:text> </xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:template>
<!--****************************************************************
Return the year of the publication
Assuming YYYY, YYYY-MM or YYYY-MM-DD input format
If no date found, return n.d. (not dated)
*****************************************************************-->
<xsl:template name="GenerateYear">
<xsl:choose>
<!-- Prefering the date informed in monogr/imprint -->
<xsl:when test="./monogr/imprint/date">
<xsl:value-of select="substring(./monogr/imprint/date,1,4)"/>
</xsl:when>
<!-- Else any other date -->
<xsl:when test=".//date">
<xsl:value-of select="substring(.//date[1],1,4)"/>
</xsl:when>
<!-- Else the year extracted from Web pade access date -->
<xsl:when test=".//note[@type='accessed']">
<xsl:value-of select="substring(.//note[@type='accessed'],1,4)"/>
</xsl:when>
<!-- Else return n.d. (not dated) -->
<xsl:otherwise>
<xsl:text>n.d.</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="GetName">
<!-- if pMode set to surname-only, only surnames are returned -->
<xsl:param name="pMode">surname-only</xsl:param>
<xsl:choose>
<!-- Return "Surname Forename" in that order separated with one space. -->
<xsl:when test="surname">
<xsl:value-of select="normalize-space(surname)"/>
<xsl:if test="forename and $pMode!='surname-only'">
<xsl:text> </xsl:text>
<xsl:value-of select="normalize-space(forename)"/>
</xsl:if>
</xsl:when>
<!-- if no surname, try to find a name attribute -->
<xsl:otherwise>
<xsl:value-of select="normalize-space(name)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--****************************************************************
Return the list of Authors separated with coma.
Add the editors to the list, except if param pMode is set to "authors-only"
Do not add the contributors to the list, except if param pMode is set to "all"
*****************************************************************-->
<xsl:template name="GenerateAuthorsList">
<!-- authors-only, with-editors, all mode -->
<xsl:param name="pMode">authors-only</xsl:param>
<!-- cf GetName -->
<xsl:param name="pNameMode">surname-forename</xsl:param>
<!-- Authors -->
<xsl:for-each select=".//author">
<xsl:call-template name="GetName">
<xsl:with-param name="pMode" select="$pNameMode"/>
</xsl:call-template>
<xsl:if test="not(position()=last())">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:for-each>
<!-- Editor are added if pMode set or no author found -->
<xsl:if test="$pMode='with-editors' or not(.//author)">
<xsl:if test=".//editor and .//author">
<xsl:text>, </xsl:text>
</xsl:if>