Skip to content

Commit

Permalink
Makefile (#72)
Browse files Browse the repository at this point in the history
* Use ref position rather than (author, date)

* Makefile

* firebase.json

* Makefile deployment fixes

* Makefile clean rule: remove booklet pdf
  • Loading branch information
lucasgautheron authored Nov 5, 2016
1 parent e0f1ae5 commit d620730
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 43 deletions.
48 changes: 48 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#export GH_USER="lucasgautheron"
#export GITHUB_TOKEN=""

.PHONY: all clean simulations website booklet deploy

all:
php compile.php -V -B -S

clean:
find tmp/ ! -name '.gitignore' -type f -exec rm -f {} +
find . -name "*.html" -type f -delete
find . -type d -empty -delete
rm booklet/booklet.pdf

simulations:
php compile.php -V -B

website:
php compile.php -V

booklet:
php compile.php -V -B

deploy:
git archive --format=tar master -o deployment/master.tar
rm -rf deployment/public
mkdir deployment/public
tar xvf deployment/master.tar -C deployment/public
rm -rf deployment/master.tar
cd deployment/public && \
make all && \
rm -rf data && \
rm -rf tmp

cd deployment && \
firebase --project cosmology-c47d4 deploy && \
tar -jcvf public.tar.bz2 public/

if [ ! -f deployment/linux-amd64-github-release.tar.bz2 ]; then \
wget https://github.com/aktau/github-release/releases/download/v0.6.2/linux-amd64-github-release.tar.bz2 -P deployment/; \
fi

tar jxvf deployment/linux-amd64-github-release.tar.bz2 -C deployment

-exec ./deployment/bin/linux/amd64/github-release delete --user lucasgautheron --repo CosmologyWebsite --tag `date +%Y-%m-%d`
exec ./deployment/bin/linux/amd64/github-release release --user lucasgautheron --repo CosmologyWebsite --tag `date +%Y-%m-%d` --name "Deployment $${RELEASE_VERSION}" --description ""
exec ./deployment/bin/linux/amd64/github-release upload --user lucasgautheron --repo CosmologyWebsite --tag `date +%Y-%m-%d` --name "public.tar.bz2" --file deployment/public.tar.bz2

11 changes: 11 additions & 0 deletions deployment/firebase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
]

}
}
62 changes: 19 additions & 43 deletions layout.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -68,57 +68,33 @@
</p>
</xsl:template>

<xsl:function name="doc:get-references">
<xsl:param name="context" />
<references>
<xsl:for-each-group select="$context//ref" group-by="concat(./@doi, '|', ./@arxiv, '|', ./@isbn)">
<xsl:copy-of select="." />
</xsl:for-each-group>
</references>
</xsl:function>

<xsl:template match="ref[@doi]">
<xsl:variable name="maxauthors" select="2" />
<xsl:variable name="references" select="doc:get-references(/root)" />
<xsl:variable name="doi" select="./@doi" />
<xsl:variable name="safedoi" select="replace(replace(replace(./@doi, '/', '_'), '\(', '_'), '\)', '_')" />
<xsl:variable name="ref" select="document(concat('./tmp/ref_', $safedoi, '.xml'))" />

<a href="#ref-{$safedoi}" class="reference">
(<xsl:for-each select="$ref//contributors/person_name[@contributor_role='author']">
<xsl:if test="not(position() > $maxauthors)">
<xsl:value-of select="./given_name" />&#160;<xsl:value-of select="./surname" />
<xsl:if test="position() != last() and not(position() >= $maxauthors) ">, </xsl:if>
</xsl:if>
</xsl:for-each>
<xsl:if test="count($ref//contributors/person_name[@contributor_role='author']) > $maxauthors">
et al.
</xsl:if>
&#160;<xsl:value-of select="$ref/doi_records/doi_record/crossref/journal/journal_article/publication_date[1]/year" />)
</a>
[<a href="#ref-{$safedoi}" class="reference"><xsl:value-of select="count($references//ref[@doi=$doi]/preceding-sibling::*)+1" /></a>]
</xsl:template>

<xsl:template match="ref[@arxiv]">
<xsl:variable name="maxauthors" select="2" />
<xsl:variable name="references" select="doc:get-references(/root)" />
<xsl:variable name="arxiv" select="./@arxiv" />
<xsl:variable name="safearxiv" select="replace(replace(replace(./@arxiv, '/', '_'), '\(', '_'), '\)', '_')" />
<xsl:variable name="ref" select="(document(concat('./tmp/ref_', $safearxiv, '.xml'))//atom:entry)[1]" />
<a href="#ref-{$safearxiv}" class="reference">
(<xsl:for-each select="$ref//atom:author">
<xsl:if test="not(position() > $maxauthors)">
<xsl:value-of select="./atom:name" />
<xsl:if test="position() != last() and not(position() >= $maxauthors) ">, </xsl:if>
</xsl:if>
</xsl:for-each>
<xsl:if test="count($ref//atom:author) > $maxauthors">
et al.
</xsl:if>
&#160;<xsl:value-of select="substring(($ref//atom:published)[1], 1, 4)" />)
</a>
[<a href="#ref-{$safearxiv}" class="reference"><xsl:value-of select="count($references//ref[@arxiv=$arxiv]/preceding-sibling::*)+1" /></a>]
</xsl:template>

<xsl:template match="ref[@isbn]">
<xsl:variable name="maxauthors" select="2" />
<xsl:variable name="ref" select="document(concat('./tmp/ref_', ./@isbn, '.xml'))//fn:map[@key='volumeInfo'][1]" />

<a href="#ref-{./@isbn}" class="reference">
(<xsl:for-each select="$ref//fn:array[@key='authors']/fn:string[position() &lt;= $maxauthors]">
<xsl:value-of select="." />
<xsl:if test="position() != last() and not(position() >= $maxauthors) ">, </xsl:if>
</xsl:for-each>
<xsl:if test="count($ref//fn:array[@key='authors']/fn:string) > $maxauthors">
et al.
</xsl:if>
&#160;<xsl:value-of select="substring(($ref//fn:string[@key='publishedDate'])[1], 1, 4)" />)
</a>
<xsl:variable name="references" select="doc:get-references(/root)" />
<xsl:variable name="isbn" select="./@isbn" />
[<a href="#ref-{./@isbn}" class="reference"><xsl:value-of select="count($references//ref[@isbn=$isbn]/preceding-sibling::*)+1" /></a>]
</xsl:template>

<xsl:template name="ref-description">
Expand Down

0 comments on commit d620730

Please sign in to comment.