from librarian import DirDocProvider, ParseError
from librarian.parser import WLDocument
-from librarian.cover import WLCover
+from librarian.cover import WLCover, FutureOfCopyrightCover
class Option(object):
if cls.uses_cover:
if options.image_cache:
def cover_class(*args, **kwargs):
- return WLCover(image_cache=options.image_cache, *args, **kwargs)
+ return FutureOfCopyrightCover(image_cache=options.image_cache, *args, **kwargs)
transform_args['cover'] = cover_class
elif not cls.cover_optional or options.with_cover:
- transform_args['cover'] = WLCover
+ transform_args['cover'] = FutureOfCopyrightCover
# Do some real work
logo_bottom = 25
logo_width = 250
format = 'PNG'
+
+class FutureOfCopyrightCover(Cover):
+ width = 420
+ height = 595
+ background_img = 'cover.png'
+ format = 'PNG'
+
+ def save(self, dest):
+ dest.write(open(self.background_img).read())
from shutil import rmtree
from librarian import RDFNS, WLNS, NCXNS, OPFNS, XHTMLNS, OutputFile
-from librarian.cover import WLCover
+from librarian.cover import WLCover, FutureOfCopyrightCover
from librarian import functions, get_resource
zip.writestr('OPS/title.html',
etree.tostring(html_tree, method="html", pretty_print=True))
# add a title page TOC entry
- toc.add(u"Strona tytułowa", "title.html")
+ toc.add(u"Title", "title.html")
elif wldoc.book_info.parts:
# write title page for every parent
if sample is not None and sample <= 0:
'media-type="application/oebps-package+xml" />' \
'</rootfiles></container>')
zip.write(get_resource('res/wl-logo-small.png'), os.path.join('OPS', 'logo_wolnelektury.png'))
+ zip.write(get_resource('res/logo.png'), os.path.join('OPS', 'logo.png'))
zip.write(get_resource('res/jedenprocent.png'), os.path.join('OPS', 'jedenprocent.png'))
if not style:
style = get_resource('epub/style.css')
if cover:
if cover is True:
- cover = WLCover
+ cover = FutureOfCopyrightCover
cover_file = StringIO()
c = cover(document.book_info)
del cover_file
cover_tree = etree.parse(get_resource('epub/cover.html'))
- cover_tree.find('//' + XHTMLNS('img')).set('src', cover_name)
+ cover_tree.find('//' + XHTMLNS('img')).set('src', c_name)
zip.writestr('OPS/cover.html', etree.tostring(
cover_tree, method="html", pretty_print=True))
- if bound_cover.uses_dc_cover:
+ if c.uses_dc_cover:
if document.book_info.cover_by:
document.edoc.getroot().set('data-cover-by', document.book_info.cover_by)
if document.book_info.cover_source:
manifest.append(etree.fromstring(
'<item id="cover" href="cover.html" media-type="application/xhtml+xml" />'))
manifest.append(etree.fromstring(
- '<item id="cover-image" href="%s" media-type="%s" />' % (cover_name, bound_cover.mime_type())))
+ '<item id="cover-image" href="%s" media-type="%s" />' % (c_name, c.mime_type())))
spine.insert(0, etree.fromstring('<itemref idref="cover" linear="no" />'))
opf.getroot()[0].append(etree.fromstring('<meta name="cover" content="cover-image"/>'))
guide.append(etree.fromstring('<reference href="cover.html" type="cover" title="Okładka"/>'))
-
+
+
annotations = etree.Element('annotations')
'</navMap></ncx>')
nav_map = toc_file[-1]
+ manifest.append(etree.fromstring(
+ '<item id="intro" href="intro.html" media-type="application/xhtml+xml" />'))
+ spine.append(etree.fromstring(
+ '<itemref idref="intro" />'))
+ zip.writestr('OPS/intro.html', open(get_resource('epub/intro.html')).read())
+
+
if html_toc:
manifest.append(etree.fromstring(
'<item id="html_toc" href="toc.html" media-type="application/xhtml+xml" />'))
spine.append(etree.fromstring(
'<itemref idref="html_toc" />'))
- guide.append(etree.fromstring('<reference href="toc.html" type="toc" title="Spis treści"/>'))
+ guide.append(etree.fromstring('<reference href="toc.html" type="toc" title="Table of Contents"/>'))
toc, chunk_counter, chars, sample = transform_file(document, sample=sample)
if len(toc.children) < 2:
- toc.add(u"Początek utworu", "part1.html")
+ toc.add(u"Beginning of the book", "part1.html")
# Last modifications in container files and EPUB creation
if len(annotations) > 0:
- toc.add("Przypisy", "annotations.html")
+ toc.add("Footnotes", "annotations.html")
manifest.append(etree.fromstring(
'<item id="annotations" href="annotations.html" media-type="application/xhtml+xml" />'))
spine.append(etree.fromstring(
# chars.update(used_chars(etree.fromstring(html_string)))
# zip.writestr('OPS/support.html', html_string)
- toc.add("Strona redakcyjna", "last.html")
+ toc.add("Editors", "last.html")
manifest.append(etree.fromstring(
'<item id="last" href="last.html" media-type="application/xhtml+xml" />'))
spine.append(etree.fromstring(
# write TOC
if html_toc:
- toc.add(u"Spis treści", "toc.html", index=1)
+ toc.add(u"Table of Contents", "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))
<img alt="Cover" />
</div>
</body>
-</html>
\ No newline at end of file
+</html>
--- /dev/null
+<!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">
+ <head>
+ <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
+ <title>Cover</title>
+ <style type="text/css"> img { max-width: 100%; } </style>
+ </head>
+ <body style="oeb-column-number: 1;">
+ <div id="body-text">
+
+<h2 xmlns="http://www.w3.org/1999/xhtml" class="intitle">Dear readers!</h2>
+
+<p xmlns="http://www.w3.org/1999/xhtml" class="paragraph">It is our great pleasure to present the anthology of the second edition of the Future of Copyright Contest organized by Modern Poland Foundation. <br/>These works have been selected by our jury: Beatriz Busaniche (Via Libre Foundation, Wikimedia Argentina, University of Buenos Aires), Shun-Ling Chen (University of Arizona James E. Rogers College of Law), Mike Linksvayer (Creative Commons, OpenHatch and Software Freedom Conservanc, Open Definition Advisory Council) Joe McNamee (EDRi), Jérémie Zimmermann (La Quadrature du Net) and Jarosław Lipszyc (Modern Poland Foundation).</p>
+
+<p xmlns="http://www.w3.org/1999/xhtml" class="paragraph"> We are proud to announce that the first prize goes to <wyroznienie>Talllama</wyroznienie>, the author of <i xmlns="http://www.w3.org/1999/xhtml">A Penny for Your Thoughts</i> As our jurors noticed:</p>
+
+
+<p xmlns="http://www.w3.org/1999/xhtml" class="paragraph"><i>"it is engagingly written and fun to read transposition of exactly today's copyright and debates (including wild mischaracterization) into a future with mind uploading. The idea of having all our thoughts fixed and therefore protected by copyright is a smart way of showing how ridiculous the current situation is."</i></p>
+
+
+<p xmlns="http://www.w3.org/1999/xhtml" class="paragraph">Talllama and all competitors - thank you for your contribution to the copyright debate.</p>
+
+
+<p xmlns="http://www.w3.org/1999/xhtml" class="paragraph">We also would like to thank all for crowd-funding support and funding the prize for the winner via the <a xmlns="http://www.w3.org/1999/xhtml" href="http://www.indiegogo.com/projects/future-of-copyright-contest-2-0">Indiegogo</a> platform.</p>
+
+
+<p xmlns="http://www.w3.org/1999/xhtml" class="paragraph">The picture used on the cover is a remix based on Leonardo da Vinci's <tytul_dziela>Lady with an Ermine</tytul_dziela> and Johannes Vermeer's <tytul_dziela>Girl with a Pearl Earring</tytul_dziela> (remix by Radek Czajka, license: CC-BY-SA). The Modern Poland Foundation was involved in the discussion with the Polish Ministry of Culture and National Heritage about the rights to use the image and the name of da Vinci's painting. Although <tytul_dziela>Lady with an Ermine</tytul_dziela> was painted even before the creation of the idea of copyright and is in the public domain since the moment when it started to function, one of the Polish foundations wanted to sell the rights to this painting. The Modern Poland Foundation publicly defended the right to re-use and remix this work of art.</p>
+<p xmlns="http://www.w3.org/1999/xhtml" class="paragraph">Enjoy!</p>
+
+<p xmlns="http://www.w3.org/1999/xhtml" class="paragraph">You can find best works submitted to the first edition of The Future of Copyright Contest here:
+<a xmlns="http://www.w3.org/1999/xhtml" href="http://prawokultury.pl/en/publications/future-copyright-2012/">prawokultury.pl/en/publications/future-copyright-2012/</a>
+</p>
+
+
+<p xmlns="http://www.w3.org/1999/xhtml" class="paragraph">Modern Poland Foundation Team</p>
+
+<p xmlns="http://www.w3.org/1999/xhtml" class="paragraph">
+<img xmlns="http://www.w3.org/1999/xhtml" alt="Modern Poland Foundation" src="logo.png" />
+</p>
+
+<p xmlns="http://www.w3.org/1999/xhtml" class="paragraph"><a xmlns="http://www.w3.org/1999/xhtml" href="http://nowoczesnapolska.org.pl">http://nowoczesnapolska.org.pl</a></p>
+ </div>
+ </body>
+</html>
<link rel="stylesheet" href="style.css" type="text/css" />
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
<title>
- <xsl:text>Strona redakcyjna</xsl:text>
+ <xsl:text>Credits</xsl:text>
</title>
</head>
<body>
<div id="book-text" >
- <p class="info">
- <xsl:choose>
- <xsl:when test="//dc:rights.license">
- Ten utwór jest udostepniony na licencji
- <a>
- <xsl:attribute name="href">
- <xsl:value-of select="//dc:rights.license" />
- </xsl:attribute>
- <xsl:value-of select="//dc:rights" />
- </a>
- </xsl:when>
- <xsl:otherwise>
- 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
- <a href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons
- Uznanie Autorstwa – Na Tych Samych Warunkach 3.0 PL</a>.
- </xsl:otherwise>
- </xsl:choose>
- </p>
+
+
+<p>The Future of Copyright 2.0 Contest is a~part of Future of Copyright Project supported by Trust for Civil Society in Central and Eastern Europe</p>
+
+<!-- \includegraphics[scale=.2]<p>trust.eps} -->
+
+<p>This book is available under the terms of Creative Commons Attribution-ShareAlike 3.0 Unported License (read more:
+<a href="http://creativecommons.org/licenses/by-sa/3.0/">http://creativecommons.org/licenses/by-sa/3.0/</a>) <br/>
+Published by Modern Poland Foundation, Warsaw 2013 </p>
+
+<p>Technical editor: Paulina Choromańska <br/>
+Book design: Jakub Waluchowski<br/>
+Typography: Marcin Koziej </p>
+
+<p>Modern Poland Fundation <br/>
+Marszalkowska St. 84/92 app. 125 <br/>
+00-514 Warsaw <br/>
+tel/fax: +48 22 621-30-17 <br/>
+email: fundacja@nowoczesnapolska.org.pl <br/>
+</p>
+
+
+<p>If you wish to support our projects, feel free to make a~donation via our secure online payment service:
+<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=L2CLCXHZCWYJN">PLN</a> or <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XVC8XD7DBGV6N">USD</a>
+ or direct payment account number: 59 1030 0019 0109 8530 0040 5685 </p>
+
+<p> Thank you for your support.</p>
+
+
+
+
- <p class="info">Źródło: <a>
- <xsl:attribute name="href">
- <xsl:value-of select="//dc:identifier.url" />
- </xsl:attribute>
- <xsl:attribute name="title">
- <xsl:value-of select="wl:person_name(//dc:creator/text())" />, <xsl:value-of select="//dc:title" />
- </xsl:attribute>
- <xsl:value-of select="//dc:identifier.url" />
- </a></p>
-
- <xsl:if test="//dc:source" >
- <p class="info">Tekst opracowany na podstawie: <xsl:value-of select="//dc:source" /></p>
- </xsl:if>
-
- <xsl:if test="//dc:description" >
- <p class="info"><xsl:value-of select="//dc:description" /></p>
- </xsl:if>
-
- <xsl:call-template name="editors" />
-
- <xsl:if test="@data-cover-by">
- <p class="info">Okładka na podstawie:
- <xsl:choose>
- <xsl:when test="@data-cover-source">
- <a>
- <xsl:attribute name="href">
- <xsl:value-of select="@data-cover-source" />
- </xsl:attribute>
- <xsl:value-of select="@data-cover-by" />
- </a>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="@data-cover-by" />
- </xsl:otherwise>
- </xsl:choose>
- </p>
- </xsl:if>
-
- <div class="info">
+<!-- <div class="info">
<img src="jedenprocent.png" alt="Logo 1%" />
<div>Przekaż 1% podatku na rozwój Wolnych Lektur.</div>
<div>Nazwa organizacji: Fundacja Nowoczesna Polska</div>
<div>KRS 0000070056</div>
- </div>
+ </div>-->
<p class="info"> </p>
<p class="minor info">
- Plik wygenerowany dnia <span id="file_date"><xsl:value-of select="substring(date:date(), 1, 10)" /></span>.
+ Generated on <span id="file_date"><xsl:value-of select="substring(date:date(), 1, 10)" /></span>.
</p>
</div>
<xsl:element name="body" xmlns="http://www.w3.org/1999/xhtml">
<xsl:element name="div" xmlns="http://www.w3.org/1999/xhtml">
<xsl:attribute name="id">book-text</xsl:attribute>
+
<xsl:if test="//nazwa_utworu">
<!--h1 xmlns="http://www.w3.org/1999/xhtml"-->
<xsl:apply-templates select="//dzielo_nadrzedne" mode="poczatek"/>
</xsl:template>
<xsl:template match="autor_utworu" />
+ <xsl:template match="autor_rozdzialu">
+ <xsl:apply-templates />
+ </xsl:template>
<xsl:template match="dzielo_nadrzedne" mode="poczatek">
<h2 class="collection" xmlns="http://www.w3.org/1999/xhtml">
c = cover(book_info)
c.save(cover_file)
- if bound_cover.uses_dc_cover:
+ if c.uses_dc_cover:
if document.remobook_info.cover_by:
document.edoc.getroot().set('data-cover-by', document.book_info.cover_by)
if document.book_info.cover_source:
subprocess.check_call(['ebook-convert', epub.get_filename(), output_file.name,
'--no-inline-toc', '--cover=%s' % cover_file.name], **kwargs)
os.unlink(cover_file.name)
- return OutputFile.from_filename(output_file.name)
\ No newline at end of file
+ return OutputFile.from_filename(output_file.name)
% nowlfont - don't use customized WL font
%\RequirePackage{geometry}
+
\RequirePackage{setspace}
\RequirePackage{type1cm}
\RequirePackage{amssymb}
\RequirePackage{paralist}
\RequirePackage[normalem]{ulem}
\RequirePackage{xifthen}
+
%\DeclareOption{13pt}{%
%\AtEndOfClass{%
% font size definitions, similar to ones in /usr/share/texmf-texlive/tex/latex/base/
\usepackage[colorlinks=true,linkcolor=black,setpagesize=false,urlcolor=black,xetex]{hyperref}
\usepackage{fancyhdr}
\usepackage[explicit]{titlesec}
-\usepackage{fnpos}
+%\usepackage{fnpos}
\usepackage{printlen}
\usepackage{calc}
+\usepackage[stable]{footmisc}
+
\pagestyle{plain}
% bottom figure below footnotes
-\makeFNabove
+%\makeFNabove
%%%%%%%%%%%%%%%%%%%%%%% Paper size
}
\makeatother
-\setlength{\parindent}{4mm}
+\setlength{\parindent}{3mm}
\setlength{\parskip}{0mm}
\renewcommand{\normalsize}{\fontsize{10.4}{14.28}\addfontfeature{LetterSpace=0.3}\selectfont}
%% Sections
\titleformat{\section}%
{\addfontfeature{LetterSpace=0.3}\large}%
-{\thesection}{.5em}{\MakeUppercase{#1}}
+{\thesection{}.}{.5em}{\MakeUppercase{#1}}
\renewcommand{\thesection}{\Roman{section}}
-\titleformat{\subsection}%
+\titleformat{\subsection}[runin]%
{}%
-{\thesubsection}{0pt}{\fakesc{#1}}
+{\thesubsection{}.}{.5em}{\MakeUppercase{#1}.}[]
+\renewcommand{\thesubsection}{\Alph{subsection}}
+\titlespacing*{\subsection}{0pt}{0pt}{.5em}
\newcommand{\typosubsubsection}[1]{%
{\textsc{#1}}
}
%%%%%%%%%%%%%%%%%% ^^
-%%%%% Footnotes %%%%%%%%
+%%%%% Footnotes (works with footmisc) %%%%%%%%
\newlength{\footnoteindent}\newlength{\footnoteprespace}
\setlength{\footnoteindent}{6mm}%{3.5mm}
-\setlength{\footnoteprespace}{.3em}
+\setlength{\footnoteprespace}{0em}
\makeatletter
\renewcommand\@makefnmark{%
-\hspace{\footnoteprespace}\hbox{{\normalfont \@thefnmark}}%
+\hspace{\footnoteprespace}
+\hbox{{\normalfont \@thefnmark}}%
}
\renewcommand\thefootnote{[\arabic{footnote}]}
-\long\def\@makefntext#1{%
-\setlength{\leftskip}{\footnoteindent}%
-\setlength{\hskip}{-\footnoteindent-\footnoteprespace-.1em}%
-\hb@xt@ \dimexpr\footnoteindent+\footnoteprespace%
-{\@makefnmark}#1
-% \parindent 1em\noindent \hb@xt@ 1.8em{\hss \@makefnmark \enskip}#1
-}
+\setlength{\footnotemargin}{-\footnoteindent-\footnoteprespace-.3em}
+\renewcommand\footnotelayout[1]{%
+ \setlength{\leftskip}{\footnoteindent}#1}
+
+%% \long\def\@makefntext#1{%
+%% \setlength{\leftskip}{\footnoteindent}%
+%% \setlength{\hskip}{-\footnoteindent-\footnoteprespace-.1em}%
+%% \hb@xt@ \dimexpr\footnoteindent+\footnoteprespace%
+%% {\@makefnmark}#1
+%% % \parindent 1em\noindent \hb@xt@ 1.8em{\hss \@makefnmark \enskip}#1
+%% }
\def\trimspace#1{\trim@spaces{#1}}
\raisebox{0pt}[0pt][0pt]{\makebox[0pt][r]{\usebox{\xglyphbox}}}}
-\newcommand{\makecover}[2]{
-
+\newcommand{\makecover}{
%\pdfpagewidth=#1
%\pdfpageheight=#2
\raisebox{\PictVOffset}[0pt][0pt]{\makebox[0pt][l]{%
\includegraphics[height=\paperheight,width=\paperwidth]{cover.jpg}}}
-
}
-
-
\renewcommand{\maketitle}{
- \newpage
%\vspace{\paperheight}
-
+ \newpage
\thispagestyle{empty}
\begin{center}
\intro
}
\end{center}
- \vspace{2em}
+ \vspace{\baselineskip}
\begin{center}
\intro
{
- \huge \noindent \theauthor
+ \huge \noindent
+ \theauthor
+
}
\end{center}
%\emph{\thankyou}\\
%\indent\emph{You made this book possible.}
- \vspace{16em}
+ \vspace{7\baselineskip}
\begin{center}
\includegraphics[scale=.2]{logo.eps}
\end{center}
-
+
}
\newcommand{\editorialsection}{
\newpage
\thispagestyle{empty}
+ \input{editorial}
}
\renewcommand*\contentsname{Table of Contents}
\newcommand{\nota}[1]{%
\begin{em}%
-\begin{flushright}%
-#1%
-\end{flushright}%
+\begin{flushleft}%
+\noindent #1%
+\end{flushleft}%
\end{em}%
}
\part{#1}%
}
\newcommand{\srodtytul}[1]{%
-\subsection*{\typosubsection{#1}}%
+\subsection{#1}%
}
\newcommand{\naglowekscena}[1]{%
\newcommand{\theautorrozdzialu}{}
\newcommand{\autorrozdzialu}[1]{%
-\renewcommand{\theautorrozdzialu}{\newline\newline#1}
+\renewcommand{\theautorrozdzialu}{\newline{}{\normalfont by}\newline#1}
}
\newcommand{\naglowekrozdzial}[1]{%
}
\newcommand{\link}[2]{\href{#1}{\uline{#2}\footnote{#1}}}
-\newcommand{\www}[1]{{\normalfont\small\url{#1}}}
+\newcommand{\www}[1]{{\normalfont\small\href{#1}{#1}}}