Skip to content

Commit

Permalink
#23 - might be fixed. Need to test on wikisource
Browse files Browse the repository at this point in the history
  • Loading branch information
Klortho committed Jul 31, 2014
1 parent edf2237 commit 35d0bc6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 34 deletions.
23 changes: 6 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,31 +57,20 @@ Fork this repository to add new scripts, then submit a 'pull request'.

### Manual

#### Set up environment
```
# Check for xsltproc, will warn if not installed
command -v xsltprocfoo >/dev/null 2>&1 || { echo >&2 "I require foo but it's not installed. Aborting."; exit 1; }
Depends on `xsltproc`. To see if it exists on your system:

# Set up XML catalog file
export XML_CATALOG_FILES=`pwd`/dtd/catalog-test-jats-v1.xml
```
command -v xsltproc
```

#### (Optional) Check the JATS dtd Version

Run this command to display the modified date
#### Set up environment

```
wget http://ftp.ncbi.nlm.nih.gov/pub/jats/archiving/1.0/ > dtd-tmp.html && cat dtd-tmp.html | grep "jats-archiving-dtd-1.0.zip" && rm dtd-tmp.html
# Set up XML catalog file
export XML_CATALOG_FILES=`pwd`/dtd/catalog-test-jats-v1.xml
```

If date modified is after "12-Oct-2012 08:36" then, replace the dtd/ (and submit an issue to [this repository](https://github.com/Klortho/JATS-to-Mediawiki/issues/new) to update it):

```
rm -rf dtd/*
cd dtd
wget ftp://ftp.ncbi.nlm.nih.gov/pub/jats/archiving/1.0/jats-archiving-dtd-1.0.zip
unzip *.zip
```

#### Convert an Article
The following are manual instructions for converting a single article, given its DOI.
Expand Down
30 changes: 13 additions & 17 deletions jats-to-mediawiki.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,17 @@
<!-- extra newline between paragraphs in wiki markup. -->
<xsl:text>&#xA;&#xA;</xsl:text>
<xsl:apply-templates/>

<!-- See issue #23. This should handle figures that are referenced from the text, but that
appear inside <floats-group> at the end of the article. Only process them the first time
they are referenced. -->
<xsl:for-each select='xref[@ref-type="fig"]'>
<xsl:variable name='rid' select='@rid'/>
<xsl:if test='not(preceding::xref[@ref-type="fig" and @rid=$rid]) and
//floats-group/fig[@id=$rid]'>
<xsl:apply-templates select='//fig[@id=$rid]'/>
</xsl:if>
</xsl:for-each>
</xsl:template>


Expand Down Expand Up @@ -548,27 +559,12 @@
<!-- TABLES -->
<!-- ============================================================= -->
<!--
Tables are already in XHTML, and can simply be copied
through.
[CFM] Actually, it looks like tables need to be copied into the output
Tables are already in XHTML, and need to be copied into the output
as escaped markup. See github issue #6.
-->

<xsl:template match="table | tr | th | td">
<xsl:apply-templates select='.' mode='serialize'/>
<!--
<xsl:copy>
<xsl:apply-templates select="@*" mode="table-copy"/>
<xsl:if test="name()='table'">
<xsl:if test="not(@border)">
<xsl:attribute name="border">
<xsl:value-of select="$tableBorder"/>
</xsl:attribute>
</xsl:if>
</xsl:if>
<xsl:apply-templates/>
</xsl:copy>
-->
</xsl:template>

<!-- not supported in WikiMedia; any formatting included here is lost -->
Expand Down Expand Up @@ -1070,7 +1066,7 @@
following-sibling::*[1][self::xref]]'>
<xsl:value-of select='substring(., 1, string-length(.) - 2)'/>
</xsl:template>

<!-- TODO: include table-wrap-foot -->


Expand Down

0 comments on commit 35d0bc6

Please sign in to comment.