From 6d65ed2b0c5f9f6df14de211ea2bf1de0a5dac70 Mon Sep 17 00:00:00 2001
From: Radek Czajka
Date: Wed, 19 Jan 2011 15:15:48 +0100
Subject: [PATCH 01/16] book2html generates full page
---
librarian/html.py | 6 +-
librarian/xslt/book2html.xslt | 809 +++++++++++++++++-----------------
scripts/book2html | 2 +-
3 files changed, 416 insertions(+), 401 deletions(-)
diff --git a/librarian/html.py b/librarian/html.py
index 9401a01..4e9abd0 100644
--- a/librarian/html.py
+++ b/librarian/html.py
@@ -30,7 +30,7 @@ def html_has_content(text):
return etree.ETXPath('//p|//{%(ns)s}p|//h1|//{%(ns)s}h1' % {'ns': str(XHTMLNS)})(text)
def transform(input, output_filename=None, is_file=True, \
- parse_dublincore=True, stylesheet='legacy', options={}):
+ parse_dublincore=True, stylesheet='legacy', options={}, flags=None):
"""Transforms file input_filename in XML to output_filename in XHTML.
If output_filename is None, returns an XML,
@@ -49,6 +49,10 @@ def transform(input, output_filename=None, is_file=True, \
document = WLDocument.from_string(input, True, \
parse_dublincore=parse_dublincore)
+ if flags:
+ for flag in flags:
+ document.edoc.getroot().set(flag, 'yes')
+
document.clean_ed_note()
result = document.transform(style, **options)
diff --git a/librarian/xslt/book2html.xslt b/librarian/xslt/book2html.xslt
index 752eade..0f9b665 100755
--- a/librarian/xslt/book2html.xslt
+++ b/librarian/xslt/book2html.xslt
@@ -1,408 +1,419 @@
-
-
-
-
-
-
-
-
+
+
+
+
+ KsiÄ
żka z serwisu WolneLektury.pl
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -511,16 +522,16 @@
-
+
-
+
-
@@ -530,7 +541,7 @@
-
+
diff --git a/scripts/book2html b/scripts/book2html
index f7eaf63..a48aa64 100755
--- a/scripts/book2html
+++ b/scripts/book2html
@@ -35,7 +35,7 @@ if __name__ == '__main__':
output_filename = os.path.splitext(input_filename)[0] + '.html'
try:
- html.transform(input_filename, output_filename, parse_dublincore=options.parse_dublincore)
+ html.transform(input_filename, output_filename, parse_dublincore=options.parse_dublincore, flags=('full-page',))
except ParseError, e:
print '%(file)s:%(name)s:%(message)s' % {
'file': input_filename,
--
2.20.1
From a2f8ee881d66601e9cb714069dc88d3ed9703db6 Mon Sep 17 00:00:00 2001
From: Radek Czajka
Date: Wed, 19 Jan 2011 16:47:33 +0100
Subject: [PATCH 02/16] #961: full info in all formats; epub: less-advertising
flag some fixes
---
librarian/epub.py | 8 ++-
librarian/epub/style.css | 22 ++++++++
librarian/epub/xsltLast.xsl | 29 +++++++----
librarian/epub/xsltScheme.xsl | 4 +-
librarian/epub/xsltTitle.xsl | 24 ++++++---
librarian/html.py | 1 +
librarian/pdf.py | 20 +++----
librarian/pdf/wl.sty | 60 ++++++++++++++-------
librarian/pdf/wl2tex.xslt | 98 +++++++++++++++++++++++++++--------
librarian/text.py | 25 ++++++---
librarian/xslt/book2html.xslt | 35 ++++++++++++-
librarian/xslt/book2txt.xslt | 36 +++++++++----
scripts/book2partner | 3 +-
13 files changed, 275 insertions(+), 90 deletions(-)
diff --git a/librarian/epub.py b/librarian/epub.py
index ad84ab0..527d050 100644
--- a/librarian/epub.py
+++ b/librarian/epub.py
@@ -265,7 +265,8 @@ def transform_chunk(chunk_xml, chunk_no, annotations, empty=False, _empty_html_s
return output_html, toc, chars
-def transform(provider, slug=None, file_path=None, output_file=None, output_dir=None, make_dir=False, verbose=False, sample=None, cover_fn=None):
+def transform(provider, slug=None, file_path=None, output_file=None, output_dir=None, make_dir=False, verbose=False,
+ sample=None, cover_fn=None, flags=None):
""" produces a EPUB file
provider: a DocProvider
@@ -275,6 +276,7 @@ def transform(provider, slug=None, file_path=None, output_file=None, output_dir=
make_dir: writes output to //.epub instead of /.epub
sample=n: generate sample e-book (with at least n paragraphs)
cover_fn: function(author, title) -> cover image
+ flags: less-advertising,
"""
def transform_file(input_xml, chunk_counter=1, first=True, sample=None):
@@ -355,6 +357,10 @@ def transform(provider, slug=None, file_path=None, output_file=None, output_dir=
raise ValueError('either slug or file_path should be specified')
input_xml = etree.parse(provider[slug])
+ if flags:
+ for flag in flags:
+ input_xml.getroot().set(flag, 'yes')
+
metadata = input_xml.find('.//'+RDFNS('Description'))
if metadata is None:
raise NoDublinCore('Document has no DublinCore - which is required.')
diff --git a/librarian/epub/style.css b/librarian/epub/style.css
index 55ac117..fd98f07 100644
--- a/librarian/epub/style.css
+++ b/librarian/epub/style.css
@@ -183,6 +183,28 @@ p
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;
diff --git a/librarian/epub/xsltLast.xsl b/librarian/epub/xsltLast.xsl
index 6cb2748..3949878 100644
--- a/librarian/epub/xsltLast.xsl
+++ b/librarian/epub/xsltLast.xsl
@@ -33,12 +33,12 @@
Ten utwór nie jest chroniony prawem autorskim i znajduje siÄ w domenie
- publicznej, co oznacza, że możesz go swobodnie wykorzystywaÄ, publikowaÄ
+ 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
+ (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.
+ Uznanie Autorstwa â Na Tych Samych Warunkach 3.0 PL.
@@ -54,16 +54,15 @@
- Na podstawie:
+ Tekst opracowany na podstawie:
-
-
- Opracowanie redakcyjne i przypisy:
-
-
+
+
+
+
Plik wygenerowany dnia .
@@ -78,6 +77,18 @@
+
+
+
+ Opracowanie redakcyjne i przypisy:
+
+ ,
+
+ .
+
+
+
+
diff --git a/librarian/epub/xsltScheme.xsl b/librarian/epub/xsltScheme.xsl
index 8b384c3..1543268 100644
--- a/librarian/epub/xsltScheme.xsl
+++ b/librarian/epub/xsltScheme.xsl
@@ -94,7 +94,7 @@
-
+
@@ -102,7 +102,7 @@
-
+
diff --git a/librarian/epub/xsltTitle.xsl b/librarian/epub/xsltTitle.xsl
index 347f038..53bbb1a 100644
--- a/librarian/epub/xsltTitle.xsl
+++ b/librarian/epub/xsltTitle.xsl
@@ -34,9 +34,10 @@
-
+
-
+
+
- Utwór opracowany zostaÅ w ramach projektu Wolne Lektury przez FundacjÄ Nowoczesna Polska.
+ Utwór opracowany zostaÅ w ramach projektu Wolne Lektury przez fundacjÄ Nowoczesna Polska.