Skip to content

Commit d620730

Browse files
Makefile (#72)
* Use ref position rather than (author, date) * Makefile * firebase.json * Makefile deployment fixes * Makefile clean rule: remove booklet pdf
1 parent e0f1ae5 commit d620730

File tree

3 files changed

+78
-43
lines changed

3 files changed

+78
-43
lines changed

Makefile

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#export GH_USER="lucasgautheron"
2+
#export GITHUB_TOKEN=""
3+
4+
.PHONY: all clean simulations website booklet deploy
5+
6+
all:
7+
php compile.php -V -B -S
8+
9+
clean:
10+
find tmp/ ! -name '.gitignore' -type f -exec rm -f {} +
11+
find . -name "*.html" -type f -delete
12+
find . -type d -empty -delete
13+
rm booklet/booklet.pdf
14+
15+
simulations:
16+
php compile.php -V -B
17+
18+
website:
19+
php compile.php -V
20+
21+
booklet:
22+
php compile.php -V -B
23+
24+
deploy:
25+
git archive --format=tar master -o deployment/master.tar
26+
rm -rf deployment/public
27+
mkdir deployment/public
28+
tar xvf deployment/master.tar -C deployment/public
29+
rm -rf deployment/master.tar
30+
cd deployment/public && \
31+
make all && \
32+
rm -rf data && \
33+
rm -rf tmp
34+
35+
cd deployment && \
36+
firebase --project cosmology-c47d4 deploy && \
37+
tar -jcvf public.tar.bz2 public/
38+
39+
if [ ! -f deployment/linux-amd64-github-release.tar.bz2 ]; then \
40+
wget https://github.com/aktau/github-release/releases/download/v0.6.2/linux-amd64-github-release.tar.bz2 -P deployment/; \
41+
fi
42+
43+
tar jxvf deployment/linux-amd64-github-release.tar.bz2 -C deployment
44+
45+
-exec ./deployment/bin/linux/amd64/github-release delete --user lucasgautheron --repo CosmologyWebsite --tag `date +%Y-%m-%d`
46+
exec ./deployment/bin/linux/amd64/github-release release --user lucasgautheron --repo CosmologyWebsite --tag `date +%Y-%m-%d` --name "Deployment $${RELEASE_VERSION}" --description ""
47+
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
48+

deployment/firebase.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"hosting": {
3+
"public": "public",
4+
"ignore": [
5+
"firebase.json",
6+
"**/.*",
7+
"**/node_modules/**"
8+
]
9+
10+
}
11+
}

layout.xsl

Lines changed: 19 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -68,57 +68,33 @@
6868
</p>
6969
</xsl:template>
7070

71+
<xsl:function name="doc:get-references">
72+
<xsl:param name="context" />
73+
<references>
74+
<xsl:for-each-group select="$context//ref" group-by="concat(./@doi, '|', ./@arxiv, '|', ./@isbn)">
75+
<xsl:copy-of select="." />
76+
</xsl:for-each-group>
77+
</references>
78+
</xsl:function>
79+
7180
<xsl:template match="ref[@doi]">
72-
<xsl:variable name="maxauthors" select="2" />
81+
<xsl:variable name="references" select="doc:get-references(/root)" />
82+
<xsl:variable name="doi" select="./@doi" />
7383
<xsl:variable name="safedoi" select="replace(replace(replace(./@doi, '/', '_'), '\(', '_'), '\)', '_')" />
74-
<xsl:variable name="ref" select="document(concat('./tmp/ref_', $safedoi, '.xml'))" />
75-
76-
<a href="#ref-{$safedoi}" class="reference">
77-
(<xsl:for-each select="$ref//contributors/person_name[@contributor_role='author']">
78-
<xsl:if test="not(position() > $maxauthors)">
79-
<xsl:value-of select="./given_name" />&#160;<xsl:value-of select="./surname" />
80-
<xsl:if test="position() != last() and not(position() >= $maxauthors) ">, </xsl:if>
81-
</xsl:if>
82-
</xsl:for-each>
83-
<xsl:if test="count($ref//contributors/person_name[@contributor_role='author']) > $maxauthors">
84-
et al.
85-
</xsl:if>
86-
&#160;<xsl:value-of select="$ref/doi_records/doi_record/crossref/journal/journal_article/publication_date[1]/year" />)
87-
</a>
84+
[<a href="#ref-{$safedoi}" class="reference"><xsl:value-of select="count($references//ref[@doi=$doi]/preceding-sibling::*)+1" /></a>]
8885
</xsl:template>
89-
86+
9087
<xsl:template match="ref[@arxiv]">
91-
<xsl:variable name="maxauthors" select="2" />
88+
<xsl:variable name="references" select="doc:get-references(/root)" />
89+
<xsl:variable name="arxiv" select="./@arxiv" />
9290
<xsl:variable name="safearxiv" select="replace(replace(replace(./@arxiv, '/', '_'), '\(', '_'), '\)', '_')" />
93-
<xsl:variable name="ref" select="(document(concat('./tmp/ref_', $safearxiv, '.xml'))//atom:entry)[1]" />
94-
<a href="#ref-{$safearxiv}" class="reference">
95-
(<xsl:for-each select="$ref//atom:author">
96-
<xsl:if test="not(position() > $maxauthors)">
97-
<xsl:value-of select="./atom:name" />
98-
<xsl:if test="position() != last() and not(position() >= $maxauthors) ">, </xsl:if>
99-
</xsl:if>
100-
</xsl:for-each>
101-
<xsl:if test="count($ref//atom:author) > $maxauthors">
102-
et al.
103-
</xsl:if>
104-
&#160;<xsl:value-of select="substring(($ref//atom:published)[1], 1, 4)" />)
105-
</a>
91+
[<a href="#ref-{$safearxiv}" class="reference"><xsl:value-of select="count($references//ref[@arxiv=$arxiv]/preceding-sibling::*)+1" /></a>]
10692
</xsl:template>
10793

10894
<xsl:template match="ref[@isbn]">
109-
<xsl:variable name="maxauthors" select="2" />
110-
<xsl:variable name="ref" select="document(concat('./tmp/ref_', ./@isbn, '.xml'))//fn:map[@key='volumeInfo'][1]" />
111-
112-
<a href="#ref-{./@isbn}" class="reference">
113-
(<xsl:for-each select="$ref//fn:array[@key='authors']/fn:string[position() &lt;= $maxauthors]">
114-
<xsl:value-of select="." />
115-
<xsl:if test="position() != last() and not(position() >= $maxauthors) ">, </xsl:if>
116-
</xsl:for-each>
117-
<xsl:if test="count($ref//fn:array[@key='authors']/fn:string) > $maxauthors">
118-
et al.
119-
</xsl:if>
120-
&#160;<xsl:value-of select="substring(($ref//fn:string[@key='publishedDate'])[1], 1, 4)" />)
121-
</a>
95+
<xsl:variable name="references" select="doc:get-references(/root)" />
96+
<xsl:variable name="isbn" select="./@isbn" />
97+
[<a href="#ref-{./@isbn}" class="reference"><xsl:value-of select="count($references//ref[@isbn=$isbn]/preceding-sibling::*)+1" /></a>]
12298
</xsl:template>
12399

124100
<xsl:template name="ref-description">

0 commit comments

Comments
 (0)