From: Radek Czajka
Date: Wed, 26 Feb 2014 15:41:44 +0000 (+0100)
Subject: Merge remote-tracking branch 'quiris/master' into quiris
X-Git-Tag: 1.7~104
X-Git-Url: https://git.mdrn.pl/librarian.git/commitdiff_plain/ad7b5c75f9161ac14f1f26032f4b4d54077b65a4?hp=ebe02c4c8c6e0bb91fe6a31b1648fab17f23d097
Merge remote-tracking branch 'quiris/master' into quiris
---
diff --git a/librarian/epub.py b/librarian/epub.py
index 2da6b31..81dcb6e 100644
--- a/librarian/epub.py
+++ b/librarian/epub.py
@@ -22,6 +22,7 @@ from librarian.cover import DefaultEbookCover
from librarian import functions, get_resource
functions.reg_person_name()
+functions.reg_lang_code_3to2()
def inner_xml(node):
@@ -77,6 +78,7 @@ def replace_characters(node):
def replace_chars(text):
if text is None:
return None
+ #text = re.sub(r"(?<=\s\w)\s+", u"\u00a0", text) #fix for hanging single letter conjunctions â for future use.
return text.replace(u"\ufeff", u"")\
.replace("---", u"\u2014")\
.replace("--", u"\u2013")\
@@ -290,18 +292,41 @@ def chop(main_text):
main_xml_part = part_xml[0] # master
last_node_part = False
+
+ # the below loop are workaround for a problem with epubs in drama ebooks without acts
+ is_scene = False
+ is_act = False
+ for one_part in main_text:
+ name = one_part.tag
+ if name == 'naglowek_scena':
+ is_scene = True
+ elif name == 'naglowek_akt':
+ is_act = True
+
for one_part in main_text:
name = one_part.tag
- if name == 'naglowek_czesc':
- yield part_xml
- last_node_part = True
- main_xml_part[:] = [deepcopy(one_part)]
- elif not last_node_part and name in ("naglowek_rozdzial", "naglowek_akt", "srodtytul"):
- yield part_xml
- main_xml_part[:] = [deepcopy(one_part)]
+ if is_act is False and is_scene is True:
+ if name == 'naglowek_czesc':
+ yield part_xml
+ last_node_part = True
+ main_xml_part[:] = [deepcopy(one_part)]
+ elif not last_node_part and name in ("naglowek_scena"):
+ yield part_xml
+ main_xml_part[:] = [deepcopy(one_part)]
+ else:
+ main_xml_part.append(deepcopy(one_part))
+ last_node_part = False
else:
- main_xml_part.append(deepcopy(one_part))
- last_node_part = False
+ if name == 'naglowek_czesc':
+ yield part_xml
+ last_node_part = True
+ main_xml_part[:] = [deepcopy(one_part)]
+ elif not last_node_part and name in ("naglowek_rozdzial", "naglowek_akt", "srodtytul"):
+ yield part_xml
+ main_xml_part[:] = [deepcopy(one_part)]
+ else:
+ main_xml_part.append(deepcopy(one_part))
+ last_node_part = False
yield part_xml
@@ -310,7 +335,9 @@ def transform_chunk(chunk_xml, chunk_no, annotations, empty=False, _empty_html_s
toc = TOC()
for element in chunk_xml[0]:
- if element.tag in ("naglowek_czesc", "naglowek_rozdzial", "naglowek_akt", "srodtytul"):
+ if element.tag in ("naglowek_czesc"):
+ toc.add(node_name(element), "part%d.html#book-text" % chunk_no)
+ elif element.tag in ("naglowek_rozdzial", "naglowek_akt", "srodtytul"):
toc.add(node_name(element), "part%d.html" % chunk_no)
elif element.tag in ('naglowek_podrozdzial', 'naglowek_scena'):
subnumber = toc.add(node_name(element), "part%d.html" % chunk_no, level=1, is_part=False)
@@ -336,7 +363,7 @@ def transform(wldoc, verbose=False,
sample=n: generate sample e-book (with at least n paragraphs)
cover: a cover.Cover factory or True for default
- flags: less-advertising, without-fonts, working-copy
+ flags: less-advertising, without-fonts, working-copy, with-full-fonts
"""
def transform_file(wldoc, chunk_counter=1, first=True, sample=None):
@@ -540,21 +567,23 @@ def transform(wldoc, verbose=False,
os.chdir(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'font-optimizer'))
for fname in 'DejaVuSerif.ttf', 'DejaVuSerif-Bold.ttf', 'DejaVuSerif-Italic.ttf', 'DejaVuSerif-BoldItalic.ttf':
- optimizer_call = ['perl', 'subset.pl', '--chars', ''.join(chars).encode('utf-8'),
- get_resource('fonts/' + fname), os.path.join(tmpdir, fname)]
- if verbose:
- print "Running font-optimizer"
- subprocess.check_call(optimizer_call)
+ if not flags or not 'with-full-fonts' in flags:
+ optimizer_call = ['perl', 'subset.pl', '--chars', ''.join(chars).encode('utf-8'),
+ get_resource('fonts/' + fname), os.path.join(tmpdir, fname)]
+ if verbose:
+ print "Running font-optimizer"
+ subprocess.check_call(optimizer_call)
+ else:
+ subprocess.check_call(optimizer_call, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ zip.write(os.path.join(tmpdir, fname), os.path.join('OPS', fname))
else:
- subprocess.check_call(optimizer_call, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- zip.write(os.path.join(tmpdir, fname), os.path.join('OPS', fname))
+ zip.write(get_resource('fonts/' + fname), os.path.join('OPS', fname))
manifest.append(etree.fromstring(
- ' ' % (fname, fname)))
+ ' ' % (fname, fname)))
rmtree(tmpdir)
if cwd is not None:
os.chdir(cwd)
-
- zip.writestr('OPS/content.opf', etree.tostring(opf, pretty_print=True))
+ zip.writestr('OPS/content.opf', etree.tostring(opf, pretty_print=True, xml_declaration = True, encoding='UTF-8'))
title = document.book_info.title
attributes = "dtb:uid", "dtb:depth", "dtb:totalPageCount", "dtb:maxPageNumber"
for st in attributes:
@@ -562,7 +591,7 @@ def transform(wldoc, verbose=False,
meta.set('name', st)
meta.set('content', '0')
toc_file[0].append(meta)
- toc_file[0][0].set('content', ''.join((title, 'WolneLektury.pl')))
+ toc_file[0][0].set('content', str(document.book_info.url))
toc_file[0][1].set('content', str(toc.depth()))
set_inner_xml(toc_file[1], ''.join(('', title, '')))
@@ -571,7 +600,7 @@ def transform(wldoc, verbose=False,
toc.add(u"Spis treÅci", "toc.html", index=1)
zip.writestr('OPS/toc.html', toc.html().encode('utf-8'))
toc.write_to_xml(nav_map)
- zip.writestr('OPS/toc.ncx', etree.tostring(toc_file, pretty_print=True))
+ zip.writestr('OPS/toc.ncx', etree.tostring(toc_file, pretty_print=True, xml_declaration = True, encoding='UTF-8'))
zip.close()
return OutputFile.from_filename(output_file.name)
diff --git a/librarian/epub/style.css b/librarian/epub/style.css
index a862dce..c773481 100644
--- a/librarian/epub/style.css
+++ b/librarian/epub/style.css
@@ -107,27 +107,10 @@ p
text-align: left;
}
-.annotation-anchor
-{
- font-style: normal;
- font-weight: normal;
- font-size: 0.875em;
- display: block;
- float: left;
- width: 2.5em;
- clear: both;
-}
-
.annotation
{
- margin: 0;
- margin-top: 1.5em;
-}
-
-.annotation-body
-{
- margin-left: 2.5em;
- font-size: 0.875em;
+ margin-bottom: 0.3em;
+ text-align: left;
}
.block
@@ -136,20 +119,16 @@ p
padding: 1em;
}
+
/* ============= */
/* = Numbering = */
/* ============= */
-.anchor
+.anchor sup
{
- margin: -0.25em -0.5em;
- color: #777;
- font-size: 0.875em;
- width: 2em;
- text-align: center;
- padding: 0.25em 0.5em;
- line-height: 1.5em;
-}
+ line-height: 0;
+ font-size: 0.7em;
+}
/* =================== */
/* = Custom elements = */
@@ -227,10 +206,11 @@ div.didaskalia
{
font-style: italic;
margin-top: 0.5em;
+ margin-bottom: 0.5em;
margin-left: 1.5em;
}
-div.kwestia
+.kwestia
{
margin-top: 0.5em;
}
@@ -238,7 +218,18 @@ div.kwestia
.paragraph
{
text-align: justify;
- margin-top: 1.5em;
+ margin: 0;
+ text-indent: 1.2em;
+}
+
+h1 + .paragraph, h2 + .paragraph
+{
+ text-indent: 0;
+}
+
+h2 + .paragraph:first-letter
+{
+ font-size: 1.6em;
}
.motto
@@ -248,40 +239,38 @@ div.kwestia
margin-top: 1.5em;
}
-.motto_podpis
+.motto_podpis, .motto_podpis .paragraph
{
font-size: 0.875em;
text-align: right;
+ font-style: italic;
}
-div.fragment
+.fragment
{
border-bottom: 0.1em solid #999;
padding-bottom: 1.5em;
}
-div.note
+.note
{
text-align: right;
font-style: italic;
+ margin-top: 1em;
+ margin-bottom: 0.5em;
}
-div.note div.paragraph
+
+.note .paragraph
{
- text-align: right;
- font-style: italic;
+ text-align: justify;
}
-div.dedication
-{
- text-align: right;
- font-style: italic;
-}
-div.dedication div.paragaph
+
+.dedication, .dedication .paragraph
{
text-align: right;
font-style: italic;
}
-
hr.spacer
{
height: 3em;
diff --git a/librarian/epub/toc.html b/librarian/epub/toc.html
index 69d8724..d29356b 100755
--- a/librarian/epub/toc.html
+++ b/librarian/epub/toc.html
@@ -3,6 +3,7 @@
WolneLektury.pl
+
Spis treÅci
diff --git a/librarian/epub/xsltAnnotations.xsl b/librarian/epub/xsltAnnotations.xsl
index f3e6443..faba10f 100644
--- a/librarian/epub/xsltAnnotations.xsl
+++ b/librarian/epub/xsltAnnotations.xsl
@@ -31,16 +31,13 @@
-
-
-
- []
-
-
+
+
+
+ .
[przypis autorski]
-
-
+
diff --git a/librarian/epub/xsltContent.xsl b/librarian/epub/xsltContent.xsl
index 83eb376..c211448 100644
--- a/librarian/epub/xsltContent.xsl
+++ b/librarian/epub/xsltContent.xsl
@@ -1,13 +1,13 @@
-
+
-
-
+
+
@@ -15,13 +15,16 @@
-
-
+
+
+
+
+
-
+
@@ -46,5 +49,13 @@
+
+
+
+
+
+
+
+
diff --git a/librarian/epub/xsltScheme.xsl b/librarian/epub/xsltScheme.xsl
index 3ddcf97..d2d7871 100644
--- a/librarian/epub/xsltScheme.xsl
+++ b/librarian/epub/xsltScheme.xsl
@@ -291,8 +291,8 @@
- []
+
diff --git a/librarian/functions.py b/librarian/functions.py
index 523b3d5..b88a7fb 100644
--- a/librarian/functions.py
+++ b/librarian/functions.py
@@ -7,6 +7,7 @@ from lxml import etree
import re
from librarian.dcparser import Person
+from librarian import get_resource
def _register_function(f):
""" Register extension function with lxml """
@@ -102,5 +103,21 @@ def reg_texcommand():
text = ''.join(text)
return re.sub(r'[^a-zA-Z]', '', text).strip()
_register_function(texcommand)
+
+def reg_lang_code_3to2():
+ def lang_code_3to2(context, text):
+ """Convert 3-letter language code to 2-letter code"""
+ result = ''
+ text = ''.join(text)
+ with open(get_resource('res/ISO-639-2_8859-1.txt'), 'rb') as f:
+ for line in f:
+ list = line.strip().split('|')
+ if list[0] == text:
+ result=list[2]
+ if result == '':
+ return text
+ else:
+ return result
+ _register_function(lang_code_3to2)
diff --git a/librarian/mobi.py b/librarian/mobi.py
index 74018b3..3c4c949 100644
--- a/librarian/mobi.py
+++ b/librarian/mobi.py
@@ -42,9 +42,9 @@ def transform(wldoc, verbose=False,
if not flags:
flags = []
- flags = list(flags) + ['without-fonts']
+ flags = list(flags) + ['with-full-fonts']
epub = document.as_epub(verbose=verbose, sample=sample, html_toc=True,
- flags=flags, style=get_resource('mobi/style.css'))
+ flags=flags, style=get_resource('epub/style.css'))
if verbose:
kwargs = {}
@@ -55,6 +55,6 @@ def transform(wldoc, verbose=False,
output_file = NamedTemporaryFile(prefix='librarian', suffix='.mobi', delete=False)
output_file.close()
subprocess.check_call(['ebook-convert', epub.get_filename(), output_file.name,
- '--no-inline-toc', '--cover=%s' % cover_file.name], **kwargs)
+ '--no-inline-toc', '--mobi-file-type=both', '--subset-embedded-fonts', '--mobi-ignore-margins', '--cover=%s' % cover_file.name], **kwargs)
os.unlink(cover_file.name)
return OutputFile.from_filename(output_file.name)
diff --git a/librarian/mobi/style.css b/librarian/mobi/style.css
deleted file mode 100644
index 99792e5..0000000
--- a/librarian/mobi/style.css
+++ /dev/null
@@ -1,306 +0,0 @@
-/* =================================================== */
-/* = Common elements: headings, paragraphs and lines = */
-/* =================================================== */
-
-
-.h2
-{
- font-size: 2em;
- margin: 0;
- margin-top: 1.5em;
- font-weight: bold;
- line-height: 1.5em;
-}
-
-.h3
-{
- text-align:left;
- font-size: 1.5em;
- margin-top: 1.5em;
- font-weight: normal;
- line-height: 1.5em;
-}
-
-.h4
-{
- font-size: 1em;
- margin: 0;
- margin-top: 1em;
- line-height: 1.5em;
-}
-
-.paragraph
-{
- margin-top: 0;
-}
-
-/* ======================== */
-/* = Footnotes and themes = */
-/* ======================== */
-
-.annotation-anchor
-{
- font-style: normal;
- font-weight: normal;
- font-size: 0.875em;
- display: block;
- float: left;
- width: 2.5em;
- clear: both;
-}
-
-.annotation
-{
- margin: 0;
- margin-top: 1.5em;
-}
-
-.annotation-body
-{
- margin-left: 2.5em;
- font-size: 0.875em;
-}
-
-.block
-{
- font-size: 0.875em;
- padding: 1em;
-}
-
-/* ============= */
-/* = Numbering = */
-/* ============= */
-
-.anchor
-{
- margin: -0.25em -0.5em;
- color: #777;
- font-size: 0.875em;
- width: 2em;
- text-align: center;
- padding: 0.25em 0.5em;
- line-height: 1.5em;
-}
-
-/* =================== */
-/* = Custom elements = */
-/* =================== */
-
-.title-page
-{
- margin-top: 1.5em;
-}
-
-.title
-{
- font-size: 3em;
- text-align: center;
- line-height: 1.5em;
- font-weight: bold;
-}
-
-.author
-{
- margin: 0;
- text-align: center;
- font-weight: bold;
-
- font-size: 1.5em;
- line-height: 1.5em;
- margin-bottom: 0.25em;
-}
-
-.intitle
-{
- margin: 0;
- text-align: center;
- font-weight: bold;
-
- font-size: 1.5em;
- line-height: 1.5em;
- margin-bottom: 0.25em;
-}
-
-.insubtitle
-{
- margin: 0;
- text-align: center;
- font-weight: bold;
-
- font-size: 1em;
- line-height: 1.5em;
- margin-bottom: 0.25em;
-}
-
-.collection
-{
- margin: 0;
- text-align: center;
- font-weight: bold;
-
- font-size: 1.125em;
- line-height: 1.5em;
- margin-bottom: -0.25em;
-}
-
-.subtitle
-{
- margin: 0;
- text-align: center;
- font-weight: bold;
-
- font-size: 1.5em;
- line-height: 1.5em;
- margin-top: -0.25em;
-}
-
-div.didaskalia
-{
- font-style: italic;
- margin-top: 0.5em;
- margin-left: 1.5em;
-}
-
-div.kwestia
-{
- margin-top: 0.5em;
-}
-
-.stanza
-{
- margin-bottom: 1em;
-}
-
-.stanza-spacer
-{
- display: none;
-}
-
-.motto
-{
- text-align: justify;
- font-style: italic;
- margin-top: 1.5em;
-}
-
-.motto_podpis
-{
- font-size: 0.875em;
- text-align: right;
-}
-
-div.fragment
-{
- border-bottom: 0.1em solid #999;
- padding-bottom: 1.5em;
-}
-
-div.note
-{
- text-align: right;
- font-style: italic;
-}
-div.note div.paragraph
-{
- text-align: right;
- font-style: italic;
-}
-div.dedication
-{
- text-align: right;
- font-style: italic;
-}
-div.dedication div.paragaph
-{
- text-align: right;
- font-style: italic;
-}
-
-
-hr.spacer
-{
- height: 3em;
- visibility: hidden;
-}
-
-hr.spacer-line
-{
- margin: 0;
- margin-top: 1.5em;
- margin-bottom: 1.5em;
- border: none;
- border-bottom: 0.1em solid #000;
-}
-
-.spacer-asterisk
-{
- padding: 0;
- margin: 0;
- margin-top: 1.5em;
- margin-bottom: 1.5em;
- text-align: center;
-}
-
-div.person-list ol
-{
- list-style: none;
- padding: 0;
- padding-left: 1.5em;
-}
-
-.place-and-time
-{
- font-style: italic;
-}
-
-em.math
-{
- font-style: italic;
-}
-em.foreign-word
-{
- font-style: italic;
-}
-em.book-title
-{
- font-style: italic;
-}
-em.didaskalia
-{
- font-style: italic;
-}
-
-em.author-emphasis
-{
- letter-spacing: 0.1em;
-}
-
-.person-list em.person
-{
- font-style: normal;
- text-transform: uppercase;
-}
-
-.info
-{
- text-align: center;
- margin-bottom: 1em;
-}
-.info div
-{
- text-align: center;
-}
-
-.info img
-{
- margin: 0;
- margin-left: 2em;
- margin-right: 2em;
-}
-
-p.minor {
- font-size: 0.75em;
-}
-p.footer {
- margin-top: 2em;
-}
diff --git a/librarian/res/ISO-639-2_8859-1.txt b/librarian/res/ISO-639-2_8859-1.txt
new file mode 100644
index 0000000..65b549e
--- /dev/null
+++ b/librarian/res/ISO-639-2_8859-1.txt
@@ -0,0 +1,486 @@
+aar||aa|Afar|afar
+abk||ab|Abkhazian|abkhaze
+ace|||Achinese|aceh
+ach|||Acoli|acoli
+ada|||Adangme|adangme
+ady|||Adyghe; Adygei|adyghé
+afa|||Afro-Asiatic languages|afro-asiatiques, langues
+afh|||Afrihili|afrihili
+afr||af|Afrikaans|afrikaans
+ain|||Ainu|aïnou
+aka||ak|Akan|akan
+akk|||Akkadian|akkadien
+alb|sqi|sq|Albanian|albanais
+ale|||Aleut|aléoute
+alg|||Algonquian languages|algonquines, langues
+alt|||Southern Altai|altai du Sud
+amh||am|Amharic|amharique
+ang|||English, Old (ca.450-1100)|anglo-saxon (ca.450-1100)
+anp|||Angika|angika
+apa|||Apache languages|apache, langues
+ara||ar|Arabic|arabe
+arc|||Official Aramaic (700-300 BCE); Imperial Aramaic (700-300 BCE)|araméen d'empire (700-300 BCE)
+arg||an|Aragonese|aragonais
+arm|hye|hy|Armenian|arménien
+arn|||Mapudungun; Mapuche|mapudungun; mapuche; mapuce
+arp|||Arapaho|arapaho
+art|||Artificial languages|artificielles, langues
+arw|||Arawak|arawak
+asm||as|Assamese|assamais
+ast|||Asturian; Bable; Leonese; Asturleonese|asturien; bable; léonais; asturoléonais
+ath|||Athapascan languages|athapascanes, langues
+aus|||Australian languages|australiennes, langues
+ava||av|Avaric|avar
+ave||ae|Avestan|avestique
+awa|||Awadhi|awadhi
+aym||ay|Aymara|aymara
+aze||az|Azerbaijani|azéri
+bad|||Banda languages|banda, langues
+bai|||Bamileke languages|bamiléké, langues
+bak||ba|Bashkir|bachkir
+bal|||Baluchi|baloutchi
+bam||bm|Bambara|bambara
+ban|||Balinese|balinais
+baq|eus|eu|Basque|basque
+bas|||Basa|basa
+bat|||Baltic languages|baltes, langues
+bej|||Beja; Bedawiyet|bedja
+bel||be|Belarusian|biélorusse
+bem|||Bemba|bemba
+ben||bn|Bengali|bengali
+ber|||Berber languages|berbères, langues
+bho|||Bhojpuri|bhojpuri
+bih||bh|Bihari languages|langues bihari
+bik|||Bikol|bikol
+bin|||Bini; Edo|bini; edo
+bis||bi|Bislama|bichlamar
+bla|||Siksika|blackfoot
+bnt|||Bantu languages|bantou, langues
+bos||bs|Bosnian|bosniaque
+bra|||Braj|braj
+bre||br|Breton|breton
+btk|||Batak languages|batak, langues
+bua|||Buriat|bouriate
+bug|||Buginese|bugi
+bul||bg|Bulgarian|bulgare
+bur|mya|my|Burmese|birman
+byn|||Blin; Bilin|blin; bilen
+cad|||Caddo|caddo
+cai|||Central American Indian languages|amérindiennes de l'Amérique centrale, langues
+car|||Galibi Carib|karib; galibi; carib
+cat||ca|Catalan; Valencian|catalan; valencien
+cau|||Caucasian languages|caucasiennes, langues
+ceb|||Cebuano|cebuano
+cel|||Celtic languages|celtiques, langues; celtes, langues
+cha||ch|Chamorro|chamorro
+chb|||Chibcha|chibcha
+che||ce|Chechen|tchétchène
+chg|||Chagatai|djaghataï
+chi|zho|zh|Chinese|chinois
+chk|||Chuukese|chuuk
+chm|||Mari|mari
+chn|||Chinook jargon|chinook, jargon
+cho|||Choctaw|choctaw
+chp|||Chipewyan; Dene Suline|chipewyan
+chr|||Cherokee|cherokee
+chu||cu|Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic|slavon d'église; vieux slave; slavon liturgique; vieux bulgare
+chv||cv|Chuvash|tchouvache
+chy|||Cheyenne|cheyenne
+cmc|||Chamic languages|chames, langues
+cop|||Coptic|copte
+cor||kw|Cornish|cornique
+cos||co|Corsican|corse
+cpe|||Creoles and pidgins, English based|créoles et pidgins basés sur l'anglais
+cpf|||Creoles and pidgins, French-based|créoles et pidgins basés sur le français
+cpp|||Creoles and pidgins, Portuguese-based|créoles et pidgins basés sur le portugais
+cre||cr|Cree|cree
+crh|||Crimean Tatar; Crimean Turkish|tatar de Crimé
+crp|||Creoles and pidgins|créoles et pidgins
+csb|||Kashubian|kachoube
+cus|||Cushitic languages|couchitiques, langues
+cze|ces|cs|Czech|tchèque
+dak|||Dakota|dakota
+dan||da|Danish|danois
+dar|||Dargwa|dargwa
+day|||Land Dayak languages|dayak, langues
+del|||Delaware|delaware
+den|||Slave (Athapascan)|esclave (athapascan)
+dgr|||Dogrib|dogrib
+din|||Dinka|dinka
+div||dv|Divehi; Dhivehi; Maldivian|maldivien
+doi|||Dogri|dogri
+dra|||Dravidian languages|dravidiennes, langues
+dsb|||Lower Sorbian|bas-sorabe
+dua|||Duala|douala
+dum|||Dutch, Middle (ca.1050-1350)|néerlandais moyen (ca. 1050-1350)
+dut|nld|nl|Dutch; Flemish|néerlandais; flamand
+dyu|||Dyula|dioula
+dzo||dz|Dzongkha|dzongkha
+efi|||Efik|efik
+egy|||Egyptian (Ancient)|égyptien
+eka|||Ekajuk|ekajuk
+elx|||Elamite|élamite
+eng||en|English|anglais
+enm|||English, Middle (1100-1500)|anglais moyen (1100-1500)
+epo||eo|Esperanto|espéranto
+est||et|Estonian|estonien
+ewe||ee|Ewe|éwé
+ewo|||Ewondo|éwondo
+fan|||Fang|fang
+fao||fo|Faroese|féroïen
+fat|||Fanti|fanti
+fij||fj|Fijian|fidjien
+fil|||Filipino; Pilipino|filipino; pilipino
+fin||fi|Finnish|finnois
+fiu|||Finno-Ugrian languages|finno-ougriennes, langues
+fon|||Fon|fon
+fre|fra|fr|French|français
+frm|||French, Middle (ca.1400-1600)|français moyen (1400-1600)
+fro|||French, Old (842-ca.1400)|français ancien (842-ca.1400)
+frr|||Northern Frisian|frison septentrional
+frs|||Eastern Frisian|frison oriental
+fry||fy|Western Frisian|frison occidental
+ful||ff|Fulah|peul
+fur|||Friulian|frioulan
+gaa|||Ga|ga
+gay|||Gayo|gayo
+gba|||Gbaya|gbaya
+gem|||Germanic languages|germaniques, langues
+geo|kat|ka|Georgian|géorgien
+ger|deu|de|German|allemand
+gez|||Geez|guèze
+gil|||Gilbertese|kiribati
+gla||gd|Gaelic; Scottish Gaelic|gaélique; gaélique écossais
+gle||ga|Irish|irlandais
+glg||gl|Galician|galicien
+glv||gv|Manx|manx; mannois
+gmh|||German, Middle High (ca.1050-1500)|allemand, moyen haut (ca. 1050-1500)
+goh|||German, Old High (ca.750-1050)|allemand, vieux haut (ca. 750-1050)
+gon|||Gondi|gond
+gor|||Gorontalo|gorontalo
+got|||Gothic|gothique
+grb|||Grebo|grebo
+grc|||Greek, Ancient (to 1453)|grec ancien (jusqu'à 1453)
+gre|ell|el|Greek, Modern (1453-)|grec moderne (après 1453)
+grn||gn|Guarani|guarani
+gsw|||Swiss German; Alemannic; Alsatian|suisse alémanique; alémanique; alsacien
+guj||gu|Gujarati|goudjrati
+gwi|||Gwich'in|gwich'in
+hai|||Haida|haida
+hat||ht|Haitian; Haitian Creole|haïtien; créole haïtien
+hau||ha|Hausa|haoussa
+haw|||Hawaiian|hawaïen
+heb||he|Hebrew|hébreu
+her||hz|Herero|herero
+hil|||Hiligaynon|hiligaynon
+him|||Himachali languages; Western Pahari languages|langues himachalis; langues paharis occidentales
+hin||hi|Hindi|hindi
+hit|||Hittite|hittite
+hmn|||Hmong; Mong|hmong
+hmo||ho|Hiri Motu|hiri motu
+hrv||hr|Croatian|croate
+hsb|||Upper Sorbian|haut-sorabe
+hun||hu|Hungarian|hongrois
+hup|||Hupa|hupa
+iba|||Iban|iban
+ibo||ig|Igbo|igbo
+ice|isl|is|Icelandic|islandais
+ido||io|Ido|ido
+iii||ii|Sichuan Yi; Nuosu|yi de Sichuan
+ijo|||Ijo languages|ijo, langues
+iku||iu|Inuktitut|inuktitut
+ile||ie|Interlingue; Occidental|interlingue
+ilo|||Iloko|ilocano
+ina||ia|Interlingua (International Auxiliary Language Association)|interlingua (langue auxiliaire internationale)
+inc|||Indic languages|indo-aryennes, langues
+ind||id|Indonesian|indonésien
+ine|||Indo-European languages|indo-européennes, langues
+inh|||Ingush|ingouche
+ipk||ik|Inupiaq|inupiaq
+ira|||Iranian languages|iraniennes, langues
+iro|||Iroquoian languages|iroquoises, langues
+ita||it|Italian|italien
+jav||jv|Javanese|javanais
+jbo|||Lojban|lojban
+jpn||ja|Japanese|japonais
+jpr|||Judeo-Persian|judéo-persan
+jrb|||Judeo-Arabic|judéo-arabe
+kaa|||Kara-Kalpak|karakalpak
+kab|||Kabyle|kabyle
+kac|||Kachin; Jingpho|kachin; jingpho
+kal||kl|Kalaallisut; Greenlandic|groenlandais
+kam|||Kamba|kamba
+kan||kn|Kannada|kannada
+kar|||Karen languages|karen, langues
+kas||ks|Kashmiri|kashmiri
+kau||kr|Kanuri|kanouri
+kaw|||Kawi|kawi
+kaz||kk|Kazakh|kazakh
+kbd|||Kabardian|kabardien
+kha|||Khasi|khasi
+khi|||Khoisan languages|khoïsan, langues
+khm||km|Central Khmer|khmer central
+kho|||Khotanese; Sakan|khotanais; sakan
+kik||ki|Kikuyu; Gikuyu|kikuyu
+kin||rw|Kinyarwanda|rwanda
+kir||ky|Kirghiz; Kyrgyz|kirghiz
+kmb|||Kimbundu|kimbundu
+kok|||Konkani|konkani
+kom||kv|Komi|kom
+kon||kg|Kongo|kongo
+kor||ko|Korean|coréen
+kos|||Kosraean|kosrae
+kpe|||Kpelle|kpellé
+krc|||Karachay-Balkar|karatchai balkar
+krl|||Karelian|carélien
+kro|||Kru languages|krou, langues
+kru|||Kurukh|kurukh
+kua||kj|Kuanyama; Kwanyama|kuanyama; kwanyama
+kum|||Kumyk|koumyk
+kur||ku|Kurdish|kurde
+kut|||Kutenai|kutenai
+lad|||Ladino|judéo-espagnol
+lah|||Lahnda|lahnda
+lam|||Lamba|lamba
+lao||lo|Lao|lao
+lat||la|Latin|latin
+lav||lv|Latvian|letton
+lez|||Lezghian|lezghien
+lim||li|Limburgan; Limburger; Limburgish|limbourgeois
+lin||ln|Lingala|lingala
+lit||lt|Lithuanian|lituanien
+lol|||Mongo|mongo
+loz|||Lozi|lozi
+ltz||lb|Luxembourgish; Letzeburgesch|luxembourgeois
+lua|||Luba-Lulua|luba-lulua
+lub||lu|Luba-Katanga|luba-katanga
+lug||lg|Ganda|ganda
+lui|||Luiseno|luiseno
+lun|||Lunda|lunda
+luo|||Luo (Kenya and Tanzania)|luo (Kenya et Tanzanie)
+lus|||Lushai|lushai
+mac|mkd|mk|Macedonian|macédonien
+mad|||Madurese|madourais
+mag|||Magahi|magahi
+mah||mh|Marshallese|marshall
+mai|||Maithili|maithili
+mak|||Makasar|makassar
+mal||ml|Malayalam|malayalam
+man|||Mandingo|mandingue
+mao|mri|mi|Maori|maori
+map|||Austronesian languages|austronésiennes, langues
+mar||mr|Marathi|marathe
+mas|||Masai|massaï
+may|msa|ms|Malay|malais
+mdf|||Moksha|moksa
+mdr|||Mandar|mandar
+men|||Mende|mendé
+mga|||Irish, Middle (900-1200)|irlandais moyen (900-1200)
+mic|||Mi'kmaq; Micmac|mi'kmaq; micmac
+min|||Minangkabau|minangkabau
+mis|||Uncoded languages|langues non codées
+mkh|||Mon-Khmer languages|môn-khmer, langues
+mlg||mg|Malagasy|malgache
+mlt||mt|Maltese|maltais
+mnc|||Manchu|mandchou
+mni|||Manipuri|manipuri
+mno|||Manobo languages|manobo, langues
+moh|||Mohawk|mohawk
+mon||mn|Mongolian|mongol
+mos|||Mossi|moré
+mul|||Multiple languages|multilingue
+mun|||Munda languages|mounda, langues
+mus|||Creek|muskogee
+mwl|||Mirandese|mirandais
+mwr|||Marwari|marvari
+myn|||Mayan languages|maya, langues
+myv|||Erzya|erza
+nah|||Nahuatl languages|nahuatl, langues
+nai|||North American Indian languages|nord-amérindiennes, langues
+nap|||Neapolitan|napolitain
+nau||na|Nauru|nauruan
+nav||nv|Navajo; Navaho|navaho
+nbl||nr|Ndebele, South; South Ndebele|ndébélé du Sud
+nde||nd|Ndebele, North; North Ndebele|ndébélé du Nord
+ndo||ng|Ndonga|ndonga
+nds|||Low German; Low Saxon; German, Low; Saxon, Low|bas allemand; bas saxon; allemand, bas; saxon, bas
+nep||ne|Nepali|népalais
+new|||Nepal Bhasa; Newari|nepal bhasa; newari
+nia|||Nias|nias
+nic|||Niger-Kordofanian languages|nigéro-kordofaniennes, langues
+niu|||Niuean|niué
+nno||nn|Norwegian Nynorsk; Nynorsk, Norwegian|norvégien nynorsk; nynorsk, norvégien
+nob||nb|Bokmål, Norwegian; Norwegian Bokmål|norvégien bokmål
+nog|||Nogai|nogaï; nogay
+non|||Norse, Old|norrois, vieux
+nor||no|Norwegian|norvégien
+nqo|||N'Ko|n'ko
+nso|||Pedi; Sepedi; Northern Sotho|pedi; sepedi; sotho du Nord
+nub|||Nubian languages|nubiennes, langues
+nwc|||Classical Newari; Old Newari; Classical Nepal Bhasa|newari classique
+nya||ny|Chichewa; Chewa; Nyanja|chichewa; chewa; nyanja
+nym|||Nyamwezi|nyamwezi
+nyn|||Nyankole|nyankolé
+nyo|||Nyoro|nyoro
+nzi|||Nzima|nzema
+oci||oc|Occitan (post 1500)|occitan (après 1500)
+oji||oj|Ojibwa|ojibwa
+ori||or|Oriya|oriya
+orm||om|Oromo|galla
+osa|||Osage|osage
+oss||os|Ossetian; Ossetic|ossète
+ota|||Turkish, Ottoman (1500-1928)|turc ottoman (1500-1928)
+oto|||Otomian languages|otomi, langues
+paa|||Papuan languages|papoues, langues
+pag|||Pangasinan|pangasinan
+pal|||Pahlavi|pahlavi
+pam|||Pampanga; Kapampangan|pampangan
+pan||pa|Panjabi; Punjabi|pendjabi
+pap|||Papiamento|papiamento
+pau|||Palauan|palau
+peo|||Persian, Old (ca.600-400 B.C.)|perse, vieux (ca. 600-400 av. J.-C.)
+per|fas|fa|Persian|persan
+phi|||Philippine languages|philippines, langues
+phn|||Phoenician|phénicien
+pli||pi|Pali|pali
+pol||pl|Polish|polonais
+pon|||Pohnpeian|pohnpei
+por||pt|Portuguese|portugais
+pra|||Prakrit languages|prâkrit, langues
+pro|||Provençal, Old (to 1500); Occitan, Old (to 1500)|provençal ancien (jusqu'à 1500); occitan ancien (jusqu'à 1500)
+pus||ps|Pushto; Pashto|pachto
+qaa-qtz|||Reserved for local use|réservée à l'usage local
+que||qu|Quechua|quechua
+raj|||Rajasthani|rajasthani
+rap|||Rapanui|rapanui
+rar|||Rarotongan; Cook Islands Maori|rarotonga; maori des îles Cook
+roa|||Romance languages|romanes, langues
+roh||rm|Romansh|romanche
+rom|||Romany|tsigane
+rum|ron|ro|Romanian|roumain
+run||rn|Rundi|rundi
+rup|||Aromanian; Arumanian; Macedo-Romanian|aroumain; macédo-roumain
+rus||ru|Russian|russe
+sad|||Sandawe|sandawe
+sag||sg|Sango|sango
+sah|||Yakut|iakoute
+sai|||South American Indian languages|sud-amérindiennes, langues
+sal|||Salishan languages|salishennes, langues
+sam|||Samaritan Aramaic|samaritain
+san||sa|Sanskrit|sanskrit
+sas|||Sasak|sasak
+sat|||Santali|santal
+scn|||Sicilian|sicilien
+sco|||Scots|écossais
+sel|||Selkup|selkoupe
+sem|||Semitic languages|sémitiques, langues
+sga|||Irish, Old (to 900)|irlandais ancien (jusqu'à 900)
+sgn|||Sign Languages|langues des signes
+shn|||Shan|chan
+sid|||Sidamo|sidamo
+sin||si|Sinhala; Sinhalese|singhalais
+sio|||Siouan languages|sioux, langues
+sit|||Sino-Tibetan languages|sino-tibétaines, langues
+sla|||Slavic languages|slaves, langues
+slo|slk|sk|Slovak|slovaque
+slv||sl|Slovenian|slovène
+sma|||Southern Sami|sami du Sud
+sme||se|Northern Sami|sami du Nord
+smi|||Sami languages|sames, langues
+smj|||Lule Sami|sami de Lule
+smn|||Inari Sami|sami d'Inari
+smo||sm|Samoan|samoan
+sms|||Skolt Sami|sami skolt
+sna||sn|Shona|shona
+snd||sd|Sindhi|sindhi
+snk|||Soninke|soninké
+sog|||Sogdian|sogdien
+som||so|Somali|somali
+son|||Songhai languages|songhai, langues
+sot||st|Sotho, Southern|sotho du Sud
+spa||es|Spanish; Castilian|espagnol; castillan
+srd||sc|Sardinian|sarde
+srn|||Sranan Tongo|sranan tongo
+srp||sr|Serbian|serbe
+srr|||Serer|sérère
+ssa|||Nilo-Saharan languages|nilo-sahariennes, langues
+ssw||ss|Swati|swati
+suk|||Sukuma|sukuma
+sun||su|Sundanese|soundanais
+sus|||Susu|soussou
+sux|||Sumerian|sumérien
+swa||sw|Swahili|swahili
+swe||sv|Swedish|suédois
+syc|||Classical Syriac|syriaque classique
+syr|||Syriac|syriaque
+tah||ty|Tahitian|tahitien
+tai|||Tai languages|tai, langues
+tam||ta|Tamil|tamoul
+tat||tt|Tatar|tatar
+tel||te|Telugu|télougou
+tem|||Timne|temne
+ter|||Tereno|tereno
+tet|||Tetum|tetum
+tgk||tg|Tajik|tadjik
+tgl||tl|Tagalog|tagalog
+tha||th|Thai|thaï
+tib|bod|bo|Tibetan|tibétain
+tig|||Tigre|tigré
+tir||ti|Tigrinya|tigrigna
+tiv|||Tiv|tiv
+tkl|||Tokelau|tokelau
+tlh|||Klingon; tlhIngan-Hol|klingon
+tli|||Tlingit|tlingit
+tmh|||Tamashek|tamacheq
+tog|||Tonga (Nyasa)|tonga (Nyasa)
+ton||to|Tonga (Tonga Islands)|tongan (Îles Tonga)
+tpi|||Tok Pisin|tok pisin
+tsi|||Tsimshian|tsimshian
+tsn||tn|Tswana|tswana
+tso||ts|Tsonga|tsonga
+tuk||tk|Turkmen|turkmène
+tum|||Tumbuka|tumbuka
+tup|||Tupi languages|tupi, langues
+tur||tr|Turkish|turc
+tut|||Altaic languages|altaïques, langues
+tvl|||Tuvalu|tuvalu
+twi||tw|Twi|twi
+tyv|||Tuvinian|touva
+udm|||Udmurt|oudmourte
+uga|||Ugaritic|ougaritique
+uig||ug|Uighur; Uyghur|ouïgour
+ukr||uk|Ukrainian|ukrainien
+umb|||Umbundu|umbundu
+und|||Undetermined|indéterminée
+urd||ur|Urdu|ourdou
+uzb||uz|Uzbek|ouszbek
+vai|||Vai|vaï
+ven||ve|Venda|venda
+vie||vi|Vietnamese|vietnamien
+vol||vo|Volapük|volapük
+vot|||Votic|vote
+wak|||Wakashan languages|wakashanes, langues
+wal|||Wolaitta; Wolaytta|wolaitta; wolaytta
+war|||Waray|waray
+was|||Washo|washo
+wel|cym|cy|Welsh|gallois
+wen|||Sorbian languages|sorabes, langues
+wln||wa|Walloon|wallon
+wol||wo|Wolof|wolof
+xal|||Kalmyk; Oirat|kalmouk; oïrat
+xho||xh|Xhosa|xhosa
+yao|||Yao|yao
+yap|||Yapese|yapois
+yid||yi|Yiddish|yiddish
+yor||yo|Yoruba|yoruba
+ypk|||Yupik languages|yupik, langues
+zap|||Zapotec|zapotèque
+zbl|||Blissymbols; Blissymbolics; Bliss|symboles Bliss; Bliss
+zen|||Zenaga|zenaga
+zgh|||Standard Moroccan Tamazight|amazighe standard marocain
+zha||za|Zhuang; Chuang|zhuang; chuang
+znd|||Zande languages|zandé, langues
+zul||zu|Zulu|zoulou
+zun|||Zuni|zuni
+zxx|||No linguistic content; Not applicable|pas de contenu linguistique; non applicable
+zza|||Zaza; Dimili; Dimli; Kirdki; Kirmanjki; Zazaki|zaza; dimili; dimli; kirdki; kirmanjki; zazaki
\ No newline at end of file
diff --git a/librarian/text.py b/librarian/text.py
index d965a47..37bd7ed 100644
--- a/librarian/text.py
+++ b/librarian/text.py
@@ -84,7 +84,7 @@ def transform(wldoc, flags=None, **options):
source = ""
contributors = ""
funders = ""
- return OutputFile.from_string((TEMPLATE % {
+ result = (TEMPLATE % {
'description': description,
'url': url,
'license_description': license_description,
@@ -92,7 +92,8 @@ def transform(wldoc, flags=None, **options):
'source': source,
'contributors': contributors,
'funders': funders,
- }).encode('utf-8'))
+ }).encode('utf-8')
else:
- return OutputFile.from_string(unicode(result).encode('utf-8'))
+ result = unicode(result).encode('utf-8')
+ return OutputFile.from_string("\r\n".join(result.splitlines()))