From 387bff61a13e750e1ef4e015025415a8b311b25b Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Thu, 27 Jan 2011 11:27:04 +0100 Subject: [PATCH] whitespace, line breaks etc. --- AUTHORS.md | 2 +- NOTICE | 6 +- README.md | 14 +- librarian/cover.py | 2 +- librarian/epub.py | 6 +- librarian/epub/emptyChunk.html | 14 +- librarian/epub/style.css | 744 ++++++++++++++-------------- librarian/epub/xsltAnnotations.xsl | 152 +++--- librarian/epub/xsltChunkTitle.xsl | 78 +-- librarian/epub/xsltContent.xsl | 98 ++-- librarian/epub/xsltLast.xsl | 198 ++++---- librarian/epub/xsltScheme.xsl | 632 +++++++++++------------ librarian/epub/xsltTitle.xsl | 268 +++++----- librarian/functions.py | 2 +- librarian/pdf.py | 12 +- librarian/pdf/wl2tex.xslt | 10 +- librarian/text.py | 4 +- librarian/xslt/book2txt.xslt | 14 +- librarian/xslt/config.xml | 22 +- librarian/xslt/normalize.xslt | 34 +- librarian/xslt/wl2html_base.xslt | 34 +- librarian/xslt/wl2html_full.xslt | 14 +- librarian/xslt/wl2html_partial.xslt | 18 +- scripts/book2epub | 3 +- scripts/book2html | 6 +- scripts/book2ihtml | 6 +- scripts/book2partner | 17 +- scripts/book2pdf | 8 +- scripts/book2txt | 8 +- scripts/bookfragments | 16 +- scripts/genslugs | 12 +- scripts/master.css | 2 +- scripts/master.plain.css | 2 +- setup.py | 2 +- 34 files changed, 1229 insertions(+), 1231 deletions(-) diff --git a/AUTHORS.md b/AUTHORS.md index 0482d09..70fe140 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -4,6 +4,6 @@ Authors Originally written by Marek Stępniowski Later contributions: - + * Łukasz Rekucki * Radek Czajka diff --git a/NOTICE b/NOTICE index ff69f4a..e4e6ec5 100644 --- a/NOTICE +++ b/NOTICE @@ -1,9 +1,9 @@ - + FNP Librarian Copyright © 2010 Fundacja Nowoczesna Polska - - For full list of contributors see AUTHORS file. + + For full list of contributors see AUTHORS file. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by diff --git a/README.md b/README.md index 7588245..c0e13e9 100755 --- a/README.md +++ b/README.md @@ -2,10 +2,10 @@ License ------- ![AGPL Logo](http://www.gnu.org/graphics/agplv3-155x51.png) - + Copyright © 2008,2009,2010 Fundacja Nowoczesna Polska - - For full list of contributors see AUTHORS section at the end. + + For full list of contributors see AUTHORS section at the end. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by @@ -21,10 +21,10 @@ License along with this program. If not, see . -About +About ------ -Librarian converts XML-based markup language used by FNP for writing books to +Librarian converts XML-based markup language used by FNP for writing books to other formats, which are more suitable for presentation. Currently we support: @@ -33,8 +33,8 @@ Currently we support: * Plain text * EPUB (XHTML based) * print-ready PDF - -Other features: + +Other features: * extract DublinCore meta-data from documents; * extract marked "themes" from documents. diff --git a/librarian/cover.py b/librarian/cover.py index 20cca66..8aa9abe 100644 --- a/librarian/cover.py +++ b/librarian/cover.py @@ -70,7 +70,7 @@ def virtualo_cover(author, title): 300, 0 ) -def asbis_cover(author, title): +def prestigio_cover(author, title): return cover(author, u"„%s”" % title, 580, 783, '#fff', get_resource('res/cover-prestigio.png'), 446, 118, 62, 60, '#fff', ImageFont.truetype(get_resource('fonts/JunicodeWL-Italic.ttf'), 50), '#000', diff --git a/librarian/epub.py b/librarian/epub.py index 527d050..a87e1d8 100644 --- a/librarian/epub.py +++ b/librarian/epub.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # # This file is part of Librarian, licensed under GNU Affero GPLv3 or later. -# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. +# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # from __future__ import with_statement @@ -33,7 +33,7 @@ def inner_xml(node): """ nt = node.text if node.text is not None else '' - return ''.join([nt] + [etree.tostring(child) for child in node]) + return ''.join([nt] + [etree.tostring(child) for child in node]) def set_inner_xml(node, text): """ sets node's text and children from a string @@ -467,7 +467,7 @@ def transform(provider, slug=None, file_path=None, output_file=None, output_dir= 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'), + 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" diff --git a/librarian/epub/emptyChunk.html b/librarian/epub/emptyChunk.html index 14dd415..1452a99 100644 --- a/librarian/epub/emptyChunk.html +++ b/librarian/epub/emptyChunk.html @@ -1,8 +1,8 @@ - - - - - WolneLektury.pl - - + + + + + WolneLektury.pl + + \ No newline at end of file diff --git a/librarian/epub/style.css b/librarian/epub/style.css index 70b05ae..249ae09 100644 --- a/librarian/epub/style.css +++ b/librarian/epub/style.css @@ -1,372 +1,372 @@ -@font-face { - font-family: "DejaVu Serif"; - font-weight: normal; - font-style: normal; - src: url(DejaVuSerif.ttf); -} -@font-face { - font-family: "DejaVu Serif"; - font-weight: bold; - font-style: normal; - src: url(DejaVuSerif-Bold.ttf); -} -@font-face { - font-family: "DejaVu Serif"; - font-weight: normal; - font-style: italic; - src: url(DejaVuSerif-Italic.ttf); -} -@font-face { - font-family: "DejaVu Serif"; - font-weight: bold; - font-style: italic; - src: url(DejaVuSerif-BoldItalic.ttf); -} - -body, p, h1, h2, h3, h4 { - font-family: "DejaVu Serif", serif; -} - - -body -{ - line-height: 1.5em; - margin: 0; -} - -a -{ - text-decoration: none; - color: #00e; -} - -a img { - border: 0; -} - -#book-text -{ - margin: 2em; - /*margin-right: 9em;*/ -} - -/* =================================================== */ -/* = 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: 1.5em; - line-height: 1.5em; -} - -p -{ - margin: 0; -} - -/* ======================== */ -/* = Footnotes and themes = */ -/* ======================== */ - -.theme-begin -{ - border-left: 0.1em solid #DDDDDD; - color: #777; - padding: 0 0.5em; - width: 7.5em; - font-style: normal; - font-weight: normal; - font-size: 0.875em; - float: right; - margin-right: -9.5em; - clear: both; - left: 40em; - line-height: 1.5em; - text-align: left; -} - -.annotation -{ - font-style: normal; - font-weight: normal; - font-size: 0.875em; -} - -#footnotes .annotation -{ - display: block; - float: left; - width: 2.5em; - clear: both; -} - -#footnotes div -{ - margin: 0; - margin-top: 1.5em; -} - -#footnotes p -{ - 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; -} - -.paragraph -{ - text-align: justify; - margin-top: 1.5em; -} - -.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; - /*font-variant: small-caps;*/ - text-transform: uppercase; -} - -p.info -{ - text-align: center; - margin-bottom: 1em; -} - -p.info img -{ - margin: 0; - margin-left: 2em; - margin-right: 2em; -} - -p.minor { - font-size: 0.75em; -} -p.footer { - margin-top: 2em; -} +@font-face { + font-family: "DejaVu Serif"; + font-weight: normal; + font-style: normal; + src: url(DejaVuSerif.ttf); +} +@font-face { + font-family: "DejaVu Serif"; + font-weight: bold; + font-style: normal; + src: url(DejaVuSerif-Bold.ttf); +} +@font-face { + font-family: "DejaVu Serif"; + font-weight: normal; + font-style: italic; + src: url(DejaVuSerif-Italic.ttf); +} +@font-face { + font-family: "DejaVu Serif"; + font-weight: bold; + font-style: italic; + src: url(DejaVuSerif-BoldItalic.ttf); +} + +body, p, h1, h2, h3, h4 { + font-family: "DejaVu Serif", serif; +} + + +body +{ + line-height: 1.5em; + margin: 0; +} + +a +{ + text-decoration: none; + color: #00e; +} + +a img { + border: 0; +} + +#book-text +{ + margin: 2em; + /*margin-right: 9em;*/ +} + +/* =================================================== */ +/* = 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: 1.5em; + line-height: 1.5em; +} + +p +{ + margin: 0; +} + +/* ======================== */ +/* = Footnotes and themes = */ +/* ======================== */ + +.theme-begin +{ + border-left: 0.1em solid #DDDDDD; + color: #777; + padding: 0 0.5em; + width: 7.5em; + font-style: normal; + font-weight: normal; + font-size: 0.875em; + float: right; + margin-right: -9.5em; + clear: both; + left: 40em; + line-height: 1.5em; + text-align: left; +} + +.annotation +{ + font-style: normal; + font-weight: normal; + font-size: 0.875em; +} + +#footnotes .annotation +{ + display: block; + float: left; + width: 2.5em; + clear: both; +} + +#footnotes div +{ + margin: 0; + margin-top: 1.5em; +} + +#footnotes p +{ + 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; +} + +.paragraph +{ + text-align: justify; + margin-top: 1.5em; +} + +.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; + /*font-variant: small-caps;*/ + text-transform: uppercase; +} + +p.info +{ + text-align: center; + margin-bottom: 1em; +} + +p.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/epub/xsltAnnotations.xsl b/librarian/epub/xsltAnnotations.xsl index d0af8ab..bc5693e 100644 --- a/librarian/epub/xsltAnnotations.xsl +++ b/librarian/epub/xsltAnnotations.xsl @@ -1,77 +1,77 @@ - - - - - - - - - - - - - <xsl:text>Przypisy</xsl:text> - - - -
-
-

- Przypisy: -

- -
-
- - -
- - - - - - -
-

- - [] - -

- -

-
-
- - - - - - - - -

- -

-
- - -
- -
-
- - - - „ - - ” - - - - -

- -

-
- + + + + + + + + + + + + + <xsl:text>Przypisy</xsl:text> + + + +
+
+

+ Przypisy: +

+ +
+
+ + +
+ + + + + + +
+

+ + [] + +

+ +

+
+
+ + + + + + + + +

+ +

+
+ + +
+ +
+
+ + + + „ + + ” + + + + +

+ +

+
+
\ No newline at end of file diff --git a/librarian/epub/xsltChunkTitle.xsl b/librarian/epub/xsltChunkTitle.xsl index 5827157..caf464d 100644 --- a/librarian/epub/xsltChunkTitle.xsl +++ b/librarian/epub/xsltChunkTitle.xsl @@ -1,40 +1,40 @@ - - - - - - - - - - - - - <xsl:text>Strona tytułowa</xsl:text> - - - -
-
- -
-
- - -
- - - - - - - - - - -

- -

-
- + + + + + + + + + + + + + <xsl:text>Strona tytułowa</xsl:text> + + + +
+
+ +
+
+ + +
+ + + + + + + + + + +

+ +

+
+
\ No newline at end of file diff --git a/librarian/epub/xsltContent.xsl b/librarian/epub/xsltContent.xsl index 30546a5..27a317f 100644 --- a/librarian/epub/xsltContent.xsl +++ b/librarian/epub/xsltContent.xsl @@ -1,50 +1,50 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/librarian/epub/xsltLast.xsl b/librarian/epub/xsltLast.xsl index 92f5be6..0a4ca5f 100644 --- a/librarian/epub/xsltLast.xsl +++ b/librarian/epub/xsltLast.xsl @@ -1,100 +1,100 @@ - - - - - - - - - - - - - <xsl:text>Strona redakcyjna</xsl:text> - - - -
-

- - - Ten utwór jest udostepniony na licencji - - - - - - - - - Ten utwór nie jest chroniony prawem autorskim i znajduje się w domenie - publicznej, co oznacza że możesz go swobodnie wykorzystywać, publikować - i rozpowszechniać. Jeśli utwór opatrzony jest dodatkowymi materiałami - (przypisy, motywy literackie etc.), które podlegają prawu autorskiemu, to - te dodatkowe materiały udostępnione są na licencji - Creative Commons - Uznanie Autorstwa – Na Tych Samych Warunkach 3.0 PL. - - -

- -

Źródło: - - - - - , - - -

- - -

Tekst opracowany na podstawie:

-
- - -

-
- - - -

 

-

- Plik wygenerowany dnia . -

- -
- - -
- - - - - - - -

- Opracowanie redakcyjne i przypisy: - - - , - - . -

-
-
- - -
-
- - - - + + + + + + + + + + + + + <xsl:text>Strona redakcyjna</xsl:text> + + + +
+

+ + + Ten utwór jest udostepniony na licencji + + + + + + + + + Ten utwór nie jest chroniony prawem autorskim i znajduje się w domenie + publicznej, co oznacza że możesz go swobodnie wykorzystywać, publikować + i rozpowszechniać. Jeśli utwór opatrzony jest dodatkowymi materiałami + (przypisy, motywy literackie etc.), które podlegają prawu autorskiemu, to + te dodatkowe materiały udostępnione są na licencji + Creative Commons + Uznanie Autorstwa – Na Tych Samych Warunkach 3.0 PL. + + +

+ +

Źródło: + + + + + , + + +

+ + +

Tekst opracowany na podstawie:

+
+ + +

+
+ + + +

 

+

+ Plik wygenerowany dnia . +

+ +
+ + +
+ + + + + + + +

+ Opracowanie redakcyjne i przypisy: + + + , + + . +

+
+
+ + +
+
+ + + +
\ No newline at end of file diff --git a/librarian/epub/xsltScheme.xsl b/librarian/epub/xsltScheme.xsl index 1543268..7e866fd 100644 --- a/librarian/epub/xsltScheme.xsl +++ b/librarian/epub/xsltScheme.xsl @@ -1,317 +1,317 @@ - - - - - - - - - - - - - WolneLektury.pl - - - - - book-text - - - - - - - - - - - - - - - - - -
- -
-
- - -
-
- -
-
    - -
-
-
- - -
- -
-
- - -
- -
-
- - -
- -
-
- - -
- -
-
- - - - - - -

- -

-
- - - - -

- -

-
- - - - -

- -

-
- - - - -

- -

-
- - - - -

- -

-
- - -

- -

-
- - - -

- -

-
- - - -

- -

-
- - -

- -

-
- - -

- -

-
- - -
- -
-
- - -
- -
-
- - -

- -

-
- - -
- -
 
-
- - -
- -  
-
- - -
- -  
-
- - -
- -  
-
- - -
- - margin-left: em; - - -  
-
- - -
- -  
-
- - -
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - „ - - ” - - - - - - - - - - - - - - - - - - - - -
  • - -
  • -
    - - - - - - -

     

    -
    - - -

    *

    -
    - - -
    -
    - - - - - - - - - - - - - - - [] - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + WolneLektury.pl + + + + + book-text + + + + + + + + + + + + + + + + + +
    + +
    +
    + + +
    +
    + +
    +
      + +
    +
    +
    + + +
    + +
    +
    + + +
    + +
    +
    + + +
    + +
    +
    + + +
    + +
    +
    + + + + + + +

    + +

    +
    + + + + +

    + +

    +
    + + + + +

    + +

    +
    + + + + +

    + +

    +
    + + + + +

    + +

    +
    + + +

    + +

    +
    + + + +

    + +

    +
    + + + +

    + +

    +
    + + +

    + +

    +
    + + +

    + +

    +
    + + +
    + +
    +
    + + +
    + +
    +
    + + +

    + +

    +
    + + +
    + +
     
    +
    + + +
    + +  
    +
    + + +
    + +  
    +
    + + +
    + +  
    +
    + + +
    + + margin-left: em; + + +  
    +
    + + +
    + +  
    +
    + + +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + „ + + ” + + + + + + + + + + + + + + + + + + + + +
  • + +
  • +
    + + + + + + +

     

    +
    + + +

    *

    +
    + + +
    +
    + + + + + + + + + + + + + + + [] + + + + + + + + + + + + + + + + + + + + +
    \ No newline at end of file diff --git a/librarian/epub/xsltTitle.xsl b/librarian/epub/xsltTitle.xsl index 53bbb1a..544b4b9 100644 --- a/librarian/epub/xsltTitle.xsl +++ b/librarian/epub/xsltTitle.xsl @@ -1,135 +1,135 @@ - - - - - - - - - - - - - <xsl:text>Strona tytułowa</xsl:text> - - - -
    -
    - - - - - - - - - - -
    - -

     

    - - - - -

    - - - - - Ta lektura, - podobnie jak tysiące innych, jest dostępna on-line na stronie - wolnelektury.pl. -

    -
    - -

    - Utwór opracowany został w ramach projektu Wolne Lektury przez fundację Nowoczesna Polska. -

    - - -
    - - -
    - - - - - - - - - - -

    - -

    -
    - - -

    - -

    -
    - - - -

    - tłum. - - , - - -

    -
    -
    - - - - - - -

    - -

    -
    - - -

    - -

    -
    - - -

    - -

    -
    - - -

    - -

    -
    - - -

    - -

    -
    - - - - - - - + + + + + + + + + + + + + <xsl:text>Strona tytułowa</xsl:text> + + + +
    +
    + + + + + + + + + + +
    + +

     

    + + + + +

    + + + + + Ta lektura, + podobnie jak tysiące innych, jest dostępna on-line na stronie + wolnelektury.pl. +

    +
    + +

    + Utwór opracowany został w ramach projektu Wolne Lektury przez fundację Nowoczesna Polska. +

    + + +
    + + +
    + + + + + + + + + + +

    + +

    +
    + + +

    + +

    +
    + + + +

    + tłum. + + , + + +

    +
    +
    + + + + + + +

    + +

    +
    + + +

    + +

    +
    + + +

    + +

    +
    + + +

    + +

    +
    + + +

    + +

    +
    + + + + + + +
    \ No newline at end of file diff --git a/librarian/functions.py b/librarian/functions.py index 08f920d..523b3d5 100644 --- a/librarian/functions.py +++ b/librarian/functions.py @@ -14,7 +14,7 @@ def _register_function(f): ns[f.__name__] = f -def reg_substitute_entities(): +def reg_substitute_entities(): ENTITY_SUBSTITUTIONS = [ (u'---', u'—'), (u'--', u'–'), diff --git a/librarian/pdf.py b/librarian/pdf.py index 5f28547..5f6f0a2 100644 --- a/librarian/pdf.py +++ b/librarian/pdf.py @@ -37,7 +37,7 @@ STYLESHEETS = { def insert_tags(doc, split_re, tagname, exclude=None): - """ inserts for every occurence of `split_re' in text nodes in the `doc' tree + """ inserts for every occurence of `split_re' in text nodes in the `doc' tree >>> t = etree.fromstring('A-B-CX-Y-Z'); >>> insert_tags(t, re.compile('-'), 'd'); @@ -67,7 +67,7 @@ def insert_tags(doc, split_re, tagname, exclude=None): def substitute_hyphens(doc): - insert_tags(doc, + insert_tags(doc, re.compile("(?<=[^-\s])-(?=[^-\s])"), "dywiz", exclude=[DCNS("identifier.url"), DCNS("rights.license")] @@ -75,7 +75,7 @@ def substitute_hyphens(doc): def fix_hanging(doc): - insert_tags(doc, + insert_tags(doc, re.compile("(?<=\s\w)\s+"), "nbsp", exclude=[DCNS("identifier.url"), DCNS("rights.license")] @@ -147,7 +147,7 @@ def get_stylesheet(name): def package_available(package, args='', verbose=False): - """ check if a verion of a latex package accepting given args is available """ + """ check if a verion of a latex package accepting given args is available """ tempdir = mkdtemp('-wl2pdf-test') fpath = os.path.join(tempdir, 'test.tex') f = open(fpath, 'w') @@ -166,7 +166,7 @@ def package_available(package, args='', verbose=False): return p == 0 -def transform(provider, slug=None, file_path=None, +def transform(provider, slug=None, file_path=None, output_file=None, output_dir=None, make_dir=False, verbose=False, save_tex=None, morefloats=None): """ produces a PDF file with XeLaTeX @@ -271,7 +271,7 @@ def transform(provider, slug=None, file_path=None, def load_including_children(provider, slug=None, uri=None, file_path=None): - """ makes one big xml file with children inserted at end + """ makes one big xml file with children inserted at end either slug or uri must be provided """ diff --git a/librarian/pdf/wl2tex.xslt b/librarian/pdf/wl2tex.xslt index c577313..5a49a01 100644 --- a/librarian/pdf/wl2tex.xslt +++ b/librarian/pdf/wl2tex.xslt @@ -1,9 +1,9 @@ - @@ -199,7 +199,7 @@ - @@ -211,7 +211,7 @@ - diff --git a/librarian/text.py b/librarian/text.py index f5aafc1..c0591e0 100644 --- a/librarian/text.py +++ b/librarian/text.py @@ -45,7 +45,7 @@ def transform(input_file, output_file, parse_dublincore=True, **options): license_description = parsed_dc.license_description license = parsed_dc.license if license: - license_description = u"Ten utwór jest udostepniony na licencji %s: \n%s" % (license_description, license) + license_description = u"Ten utwór jest udostepniony na licencji %s: \n%s" % (license_description, license) else: license_description = u"Ten utwór nie jest chroniony prawem autorskim i znajduje się w domenie publicznej, co oznacza że możesz go swobodnie wykorzystywać, publikować i rozpowszechniać. Jeśli utwór opatrzony jest dodatkowymi materiałami (przypisy, motywy literackie etc.), które podlegają prawu autorskiemu, to te dodatkowe materiały udostępnione są na licencji Creative Commons Uznanie Autorstwa – Na Tych Samych Warunkach 3.0 PL (http://creativecommons.org/licenses/by-sa/3.0/)" @@ -55,7 +55,7 @@ def transform(input_file, output_file, parse_dublincore=True, **options): else: source = '' - contributors = ', '.join(person.readable() for person in + contributors = ', '.join(person.readable() for person in sorted(set(p for p in (parsed_dc.technical_editors + parsed_dc.editors) if p))) if contributors: contributors = "\n\nOpracowanie redakcyjne i przypisy: %s" % contributors diff --git a/librarian/xslt/book2txt.xslt b/librarian/xslt/book2txt.xslt index 604b8bd..bf78d41 100755 --- a/librarian/xslt/book2txt.xslt +++ b/librarian/xslt/book2txt.xslt @@ -1,9 +1,9 @@ - + / / @@ -176,16 +176,16 @@ - + - + - @@ -195,7 +195,7 @@ - + diff --git a/librarian/xslt/config.xml b/librarian/xslt/config.xml index ad09e36..e9e999c 100755 --- a/librarian/xslt/config.xml +++ b/librarian/xslt/config.xml @@ -1,9 +1,9 @@ @@ -48,27 +48,27 @@ - - + + - + - + - + - + - + @@ -91,13 +91,13 @@ - + - +
    diff --git a/librarian/xslt/normalize.xslt b/librarian/xslt/normalize.xslt index 400c927..494d028 100755 --- a/librarian/xslt/normalize.xslt +++ b/librarian/xslt/normalize.xslt @@ -1,17 +1,17 @@ - + @@ -38,10 +38,10 @@ - + -
    +
    @@ -111,7 +111,7 @@ - + @@ -146,7 +146,7 @@ dot - + @@ -244,7 +244,7 @@ - + @@ -253,7 +253,7 @@ - + @@ -276,7 +276,7 @@ - + @@ -309,7 +309,7 @@ - + @@ -357,7 +357,7 @@ - + @@ -378,7 +378,7 @@ - + @@ -389,11 +389,11 @@ Nieprzetworzony węzeł: - + - +
    \ No newline at end of file diff --git a/librarian/xslt/wl2html_base.xslt b/librarian/xslt/wl2html_base.xslt index 7a2b3ae..3341658 100755 --- a/librarian/xslt/wl2html_base.xslt +++ b/librarian/xslt/wl2html_base.xslt @@ -1,15 +1,15 @@ @@ -21,7 +21,7 @@ indent="yes" omit-xml-declaration = "yes" /> - @@ -89,12 +89,12 @@ - + - + @@ -113,7 +113,7 @@ - + @@ -228,7 +228,7 @@ - + @@ -326,12 +326,12 @@ - + - + @@ -345,7 +345,7 @@ - + @@ -355,9 +355,9 @@ - + - + diff --git a/librarian/xslt/wl2html_full.xslt b/librarian/xslt/wl2html_full.xslt index 050f1e8..30381c3 100755 --- a/librarian/xslt/wl2html_full.xslt +++ b/librarian/xslt/wl2html_full.xslt @@ -1,17 +1,17 @@ - - + - + @@ -20,7 +20,7 @@ - + diff --git a/librarian/xslt/wl2html_partial.xslt b/librarian/xslt/wl2html_partial.xslt index 22ee122..0e5e27b 100755 --- a/librarian/xslt/wl2html_partial.xslt +++ b/librarian/xslt/wl2html_partial.xslt @@ -1,20 +1,20 @@ - - - - + + + -
    - +
    +
    \ No newline at end of file diff --git a/scripts/book2epub b/scripts/book2epub index ea87483..502d965 100755 --- a/scripts/book2epub +++ b/scripts/book2epub @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # # This file is part of Librarian, licensed under GNU Affero GPLv3 or later. -# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. +# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # import os.path import optparse @@ -55,4 +55,3 @@ if __name__ == '__main__': 'name': e.__class__.__name__, 'message': e.message } - \ No newline at end of file diff --git a/scripts/book2html b/scripts/book2html index a48aa64..f42c0ff 100755 --- a/scripts/book2html +++ b/scripts/book2html @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # # This file is part of Librarian, licensed under GNU Affero GPLv3 or later. -# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. +# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # import os import optparse @@ -21,7 +21,7 @@ if __name__ == '__main__': help='print status messages to stdout') parser.add_option('-i', '--ignore-dublin-core', action='store_false', dest='parse_dublincore', default=True, help='don\'t try to parse dublin core metadata') - + options, input_filenames = parser.parse_args() if len(input_filenames) < 1: @@ -32,7 +32,7 @@ if __name__ == '__main__': for input_filename in input_filenames: if options.verbose: print input_filename - + output_filename = os.path.splitext(input_filename)[0] + '.html' try: html.transform(input_filename, output_filename, parse_dublincore=options.parse_dublincore, flags=('full-page',)) diff --git a/scripts/book2ihtml b/scripts/book2ihtml index 101b4cf..97d8ebd 100755 --- a/scripts/book2ihtml +++ b/scripts/book2ihtml @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # # This file is part of Librarian, licensed under GNU Affero GPLv3 or later. -# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. +# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # import os import optparse @@ -21,7 +21,7 @@ if __name__ == '__main__': help='print status messages to stdout') parser.add_option('-i', '--ignore-dublin-core', action='store_false', dest='parse_dublincore', default=True, help='don\'t try to parse dublin core metadata') - + options, input_filenames = parser.parse_args() if len(input_filenames) < 1: @@ -32,7 +32,7 @@ if __name__ == '__main__': for input_filename in input_filenames: if options.verbose: print input_filename - + output_filename = os.path.splitext(input_filename)[0] + '.html' try: html.transform(input_filename, output_filename, parse_dublincore=options.parse_dublincore,\ diff --git a/scripts/book2partner b/scripts/book2partner index 786c2c2..d2a47b3 100755 --- a/scripts/book2partner +++ b/scripts/book2partner @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # # This file is part of Librarian, licensed under GNU Affero GPLv3 or later. -# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. +# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # import os.path import optparse @@ -67,7 +67,7 @@ def virtualo(filenames, output_dir, verbose): xml.append(product_elem) cover.virtualo_cover( - u' '.join(info.author.first_names + (info.author.last_name,)), + u' '.join(info.author.first_names + (info.author.last_name,)), info.title ).save(os.path.join(outfile_dir, slug+'.jpg')) outfile = os.path.join(outfile_dir, '1.epub') @@ -86,7 +86,7 @@ def virtualo(filenames, output_dir, verbose): xml_file.close() -def asbis(filenames, output_dir, verbose): +def prestigio(filenames, output_dir, verbose): try: for main_input in input_filenames: if options.verbose: @@ -102,7 +102,7 @@ def asbis(filenames, output_dir, verbose): pass outfile = os.path.join(output_dir, slug + '.epub') epub.transform(provider, file_path=main_input, output_file=outfile, - cover_fn=cover.asbis_cover, flags=('less-advertising',)) + cover_fn=cover.prestigio_cover, flags=('less-advertising',)) except ParseError, e: print '%(file)s:%(name)s:%(message)s' % { 'file': main_input, @@ -125,8 +125,8 @@ if __name__ == '__main__': help='specifies the directory for output') parser.add_option('--virtualo', action='store_true', dest='virtualo', default=False, help='prepare files for Virtualo API') - parser.add_option('--asbis', action='store_true', dest='asbis', default=False, - help='prepare files for Asbis') + parser.add_option('--prestigio', action='store_true', dest='prestigio', default=False, + help='prepare files for prestigio') options, input_filenames = parser.parse_args() @@ -136,6 +136,5 @@ if __name__ == '__main__': if options.virtualo: virtualo(input_filenames, options.output_dir, options.verbose) - if options.asbis: - asbis(input_filenames, options.output_dir, options.verbose) - \ No newline at end of file + if options.prestigio: + prestigio(input_filenames, options.output_dir, options.verbose) diff --git a/scripts/book2pdf b/scripts/book2pdf index fd69970..532577c 100755 --- a/scripts/book2pdf +++ b/scripts/book2pdf @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # # This file is part of Librarian, licensed under GNU Affero GPLv3 or later. -# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. +# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # import os.path from optparse import OptionParser @@ -49,9 +49,9 @@ if __name__ == '__main__': else: output_dir = path - pdf.transform(provider, - file_path=main_input, - output_file=output_file, + pdf.transform(provider, + file_path=main_input, + output_file=output_file, output_dir=output_dir, verbose=options.verbose, make_dir=options.make_dir, diff --git a/scripts/book2txt b/scripts/book2txt index d5e18c6..f77e512 100755 --- a/scripts/book2txt +++ b/scripts/book2txt @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # # This file is part of Librarian, licensed under GNU Affero GPLv3 or later. -# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. +# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # import os import optparse @@ -24,9 +24,9 @@ if __name__ == '__main__': help='set line wrap column') parser.add_option('-i', '--ignore-dublin-core', action='store_false', dest='parse_dublincore', default=True, help='don\'t try to parse dublin core metadata') - + options, input_filenames = parser.parse_args() - + if len(input_filenames) < 1: parser.print_help() exit(1) @@ -35,7 +35,7 @@ if __name__ == '__main__': for input_filename in input_filenames: if options.verbose: print input_filename - + output_filename = os.path.splitext(input_filename)[0] + '.txt' try: output_file = open(output_filename, 'w') diff --git a/scripts/bookfragments b/scripts/bookfragments index 124c1c5..0d94497 100755 --- a/scripts/bookfragments +++ b/scripts/bookfragments @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # # This file is part of Librarian, licensed under GNU Affero GPLv3 or later. -# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. +# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # import os import optparse @@ -14,25 +14,25 @@ if __name__ == '__main__': # Parse commandline arguments usage = """Usage: %prog [options] SOURCE [SOURCE...] Extract theme fragments from SOURCE.""" - + parser = optparse.OptionParser(usage=usage) - + parser.add_option('-v', '--verbose', action='store_true', dest='verbose', default=False, help='print status messages to stdout') - + options, input_filenames = parser.parse_args() - + if len(input_filenames) < 1: parser.print_help() exit(1) - + # Do some real work for input_filename in input_filenames: if options.verbose: print input_filename - + output_filename = os.path.splitext(input_filename)[0] + '.fragments.html' - + closed_fragments, open_fragments = html.extract_fragments(input_filename) for fragment_id in open_fragments: diff --git a/scripts/genslugs b/scripts/genslugs index 0957da7..a234096 100755 --- a/scripts/genslugs +++ b/scripts/genslugs @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # # This file is part of Librarian, licensed under GNU Affero GPLv3 or later. -# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. +# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # import os import optparse @@ -26,7 +26,7 @@ if __name__ == '__main__': help='print status messages to stdout') parser.add_option('-f', '--force', action='store_true', dest='force', default=False, help='overwrite current identifiers') - + options, input_filenames = parser.parse_args() if len(input_filenames) < 1: @@ -37,14 +37,14 @@ if __name__ == '__main__': for input_filename in input_filenames: if options.verbose: print input_filename - + doc = etree.parse(input_filename) try: title = doc.find('//{http://purl.org/dc/elements/1.1/}title').text except AttributeError: print '%s:error:Book title not found. Skipping.' % input_filename continue - + parent = '' try: parent_url = doc.find('//{http://purl.org/dc/elements/1.1/}relation.isPartOf').text @@ -53,7 +53,7 @@ if __name__ == '__main__': pass except IndexError: print '%s:error:Invalid parent URL "%s". Skipping.' % (input_filename, parent_url) - + book_url = doc.find('//{http://purl.org/dc/elements/1.1/}identifier.url') if book_url is None: book_description = doc.find('//{http://www.w3.org/1999/02/22-rdf-syntax-ns#}Description') @@ -61,7 +61,7 @@ if __name__ == '__main__': if not options.force and book_url.text.startswith('http://'): print '%s:Notice:Book already has identifier URL "%s". Skipping.' % (input_filename, book_url.text) continue - + book_url.text = BOOK_URL + slughifi(parent + title)[:60] doc.write(input_filename, xml_declaration=True, pretty_print=True, encoding='utf-8') diff --git a/scripts/master.css b/scripts/master.css index 264dc07..44fe927 100755 --- a/scripts/master.css +++ b/scripts/master.css @@ -1,7 +1,7 @@ /* * This file is part of Librarian, licensed under GNU Affero GPLv3 or later. * Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. - * + * */ body { font-size: 16px; diff --git a/scripts/master.plain.css b/scripts/master.plain.css index b580c19..68fd9c5 100755 --- a/scripts/master.plain.css +++ b/scripts/master.plain.css @@ -1,7 +1,7 @@ /* * This file is part of Librarian, licensed under GNU Affero GPLv3 or later. * Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. - * + * */ body { font-size: 16px; diff --git a/setup.py b/setup.py index 017cc57..d1db01b 100644 --- a/setup.py +++ b/setup.py @@ -29,7 +29,7 @@ setup( maintainer_email='radek.czajka@gmail.com', url='http://github.com/fnp/librarian', packages=['librarian'], - package_data={'librarian': ['xslt/*.xslt', 'epub/*', 'pdf/*', 'fonts/*', 'res/*'] + + package_data={'librarian': ['xslt/*.xslt', 'epub/*', 'pdf/*', 'fonts/*', 'res/*'] + whole_tree(os.path.join(os.path.dirname(__file__), 'librarian'), 'font-optimizer')}, include_package_data=True, install_requires=['lxml>=2.2'], -- 2.20.1