Skip to content

Commit

Permalink
Ne dépend plus d'assets hébergés ailleurs (#3856)
Browse files Browse the repository at this point in the history
  • Loading branch information
vhf authored and GerardPaligot committed Oct 16, 2016
1 parent 2c9461c commit 9985d3a
Show file tree
Hide file tree
Showing 18 changed files with 333 additions and 12 deletions.
2 changes: 1 addition & 1 deletion doc/source/install/configs/settings_prod.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
PANDOC_PDF_PARAM = ("--latex-engine=xelatex "
"--template={} -s -S -N "
"--toc -V documentclass=scrbook -V lang=francais "
"-V mainfont=Merriweather -V monofont=\"Andale Mono\" "
"-V mainfont=Merriweather -V monofont=\"SourceCodePro-Regular\" "
"-V fontsize=12pt -V geometry:margin=1in ".format('/opt/zds/zds-site/assets/tex/template.tex'))

# Sentry (+ raven, the Python Client)
Expand Down
94 changes: 94 additions & 0 deletions export-assets/fonts/Merriweather/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
Copyright (c) 2010-2013, Sorkin Type Co (www.sorkintype.com) with Reserved Font Name 'Merriweather'

Merriweather is a trademark of Sorkin Type Co.
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL


-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.

DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).

"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.

"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.

5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.

TERMINATION
This license becomes null and void if any of the above conditions are
not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
93 changes: 93 additions & 0 deletions export-assets/fonts/SourceCodePro/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries.

This Font Software is licensed under the SIL Open Font License, Version 1.1.

This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL


-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.

DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).

"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.

"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.

5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.

TERMINATION
This license becomes null and void if any of the above conditions are
not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file not shown.
59 changes: 59 additions & 0 deletions export-assets/pandoc/default.epub
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"$if(lang)$ xml:lang="$lang$"$endif$>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="generator" content="pandoc" />
<title>$pagetitle$</title>
$if(highlighting-css)$
<style type="text/css">
$highlighting-css$
</style>
$endif$
$for(css)$
<link rel="stylesheet" type="text/css" href="$css$" />
$endfor$
$for(header-includes)$
$header-includes$
$endfor$
</head>
<body$if(coverpage)$ id="cover"$endif$>
$if(titlepage)$
$for(title)$
$if(title.text)$
<h1 class="$title.type$">$title.text$</h1>
$else$
<h1 class="title">$title$</h1>
$endif$
$endfor$
$if(subtitle)$
<h1 class="subtitle">$subtitle$</h1>
$endif$
$for(author)$
<h2 class="author">$author$</h2>
$endfor$
$for(creator)$
<h2 class="$creator.role$">$creator.text$</h2>
$endfor$
$if(publisher)$
<p class="publisher">$publisher$</p>
$endif$
$if(date)$
<p class="date">$date$</p>
$endif$
$if(rights)$
<div class="rights">$rights$</div>
$endif$
$else$
$for(include-before)$
$include-before$
$endfor$
$body$
$for(include-after)$
$include-after$
$endfor$
$endif$
</body>
</html>

64 changes: 64 additions & 0 deletions export-assets/pandoc/default.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"$if(lang)$ lang="$lang$" xml:lang="$lang$"$endif$$if(dir)$ dir="$dir$"$endif$>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="generator" content="pandoc" />
$for(author-meta)$
<meta name="author" content="$author-meta$" />
$endfor$
$if(date-meta)$
<meta name="date" content="$date-meta$" />
$endif$
$if(keywords)$
<meta name="keywords" content="$for(keywords)$$keywords$$sep$, $endfor$" />
$endif$
<title>$if(title-prefix)$$title-prefix$ – $endif$$pagetitle$</title>
<style type="text/css">code{white-space: pre;}</style>
$if(quotes)$
<style type="text/css">q { quotes: "“" "”" "‘" "’"; }</style>
$endif$
$if(highlighting-css)$
<style type="text/css">
$highlighting-css$
</style>
$endif$
$for(css)$
<link rel="stylesheet" href="$css$" type="text/css" />
$endfor$
$if(math)$
$math$
$endif$
$for(header-includes)$
$header-includes$
$endfor$
</head>
<body>
$for(include-before)$
$include-before$
$endfor$
$if(title)$
<div id="$idprefix$header">
<h1 class="title">$title$</h1>
$if(subtitle)$
<h1 class="subtitle">$subtitle$</h1>
$endif$
$for(author)$
<h2 class="author">$author$</h2>
$endfor$
$if(date)$
<h3 class="date">$date$</h3>
$endif$
</div>
$endif$
$if(toc)$
<div id="$idprefix$TOC">
$toc$
</div>
$endif$
$body$
$for(include-after)$
$include-after$
$endfor$
</body>
</html>
Binary file added export-assets/pandoc/pandoc.zip
Binary file not shown.
16 changes: 6 additions & 10 deletions scripts/install_resources.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
#!/bin/bash
export RESOURCES_URL="http://www.googledrive.com/host/0BzabS14KitJgfmV2ekdWSktmVEpieU93TG11RFNkWlZqS0JwZk93ZGhMR1lCWVg5NzFVc00"

if [[ -f "$HOME/.fonts/truetype/Andale-Mono.ttf" ]]; then
if [[ -f "$HOME/.fonts/truetype/SourceCodePro/SourceCodePro-Regular.ttf" ]]; then
echo "Using cached fonts"
else
# force cache upload after successful build
touch $HOME/.cache_updated
echo "Installing fonts"
rm -rf $HOME/.fonts
mkdir -p $HOME/.fonts/truetype
wget -P $HOME/.fonts/truetype $RESOURCES_URL/Andale-Mono.ttf
wget -P $HOME/.fonts/truetype $RESOURCES_URL/Merriweather.zip
unzip -u $HOME/.fonts/truetype/Merriweather.zip -d $HOME/.fonts/truetype/Merriweather/
chmod a+r $HOME/.fonts/truetype/Merriweather/*.ttf
chmod a+r $HOME/.fonts/truetype/Andale-Mono.ttf
cp -r export-assets/fonts/* $HOME/.fonts/truetype
chmod a+r -R $HOME/.fonts/truetype/*
echo "Installation complete !"
fi
# always refresh font cache because $HOME/.fonts has been added either here or via the cache
Expand All @@ -28,9 +24,9 @@ else
rm -rf $HOME/.cabal $HOME/.pandoc
mkdir -p $HOME/.cabal/bin
mkdir -p $HOME/.pandoc
wget -P $HOME/.cabal/bin $RESOURCES_URL/pandoc
wget -P $HOME/.pandoc/templates $RESOURCES_URL/default.epub
wget -P $HOME/.pandoc/templates $RESOURCES_URL/default.html
unzip -u export-assets/pandoc/pandoc.zip -d $HOME/.cabal/bin
mkdir -p $HOME/.pandoc/templates
cp export-assets/pandoc/default.* $HOME/.pandoc/templates
ln -sf $HOME/.cabal/bin/pandoc $HOME/bin/
echo "Installation complete !"
fi
Expand Down
15 changes: 15 additions & 0 deletions update.md
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,21 @@ Relancer nginx : `sudo service nginx restart``
Vérifier que zds fonctionne comme il faut en HTTP et HTTPS.
Polices pour les exports de contenus
------------------------------------
Utilisateur `zds`:
1. `cp -r export-assets/fonts/* ~/.fonts/truetype`
1. `fc-cache -f -v > update-fonts-cache.log`
1. Vérifier dans les logs que les nouvelles polices ont été chargées.
1. Mettre à jour `settings_prod.py` :
```diff
- "-V mainfont=Merriweather -V monofont=\"Andale Mono\" "
+ "-V mainfont=Merriweather -V monofont=\"SourceCodePro-Regular\" "
```
---
**Notes auxquelles penser lors de l'édition de ce fichier (à laisser en bas) :**
Expand Down
2 changes: 1 addition & 1 deletion zds/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@
PANDOC_PDF_PARAM = ("--latex-engine=xelatex "
"--template={} -s -S -N "
"--toc -V documentclass=scrbook -V lang=francais "
"-V mainfont=Merriweather -V monofont=\"Andale Mono\" "
"-V mainfont=Merriweather -V monofont=\"SourceCodePro-Regular\" "
"-V fontsize=12pt -V geometry:margin=1in ".format(join("..", "..", "..",
"assets", "tex", "template.tex")))
# LOG PATH FOR PANDOC LOGGING
Expand Down

0 comments on commit 9985d3a

Please sign in to comment.