setup(
name='librarian',
- version='24.5.2',
+ version='24.5.3',
description='Converter from WolneLektury.pl XML-based language to XHTML, TXT and other formats',
author="Marek Stępniowski",
author_email='marek@stepniowski.com',
from lxml import etree
from . import (blocks, comments, drama, figures, footnotes, front, headers,
masters, paragraphs, poetry, ref, root, separators, styles, themes,
- tools, base, bible)
+ tools, base, bible, letter)
WL_ELEMENTS = {
"wywiad_odp": blocks.WywiadOdp,
"werset": bible.Werset,
+
+ "list": letter.List,
+ "adresat": letter.Adresat,
+ "miejsce_data": letter.MiejsceData,
+ "naglowek_listu": letter.NaglowekListu,
+ "pozdrowienie": letter.Pozdrowienie,
+ "podpis": letter.Podpis,
# Inline MathML, should really be namespaced.
"mrow": etree.ElementBase,
--- /dev/null
+from ..base import WLElement
+
+
+class List(WLElement):
+ CAN_HAVE_TEXT = False
+
+ TXT_TOP_MARGIN = 3
+ TXT_BOTTOM_MARGIN = 2
+ TXT_LEGACY_TOP_MARGIN = 1
+ TXT_LEGACY_BOTTOM_MARGIN = 0
+
+ HTML_TAG = 'blockquote'
+
+ EPUB_TAG = 'div'
+ EPUB_CLASS = 'block'
+
+
+class Adresat(WLElement):
+ STRIP = True
+ SHOULD_HAVE_ID = True
+
+ TXT_TOP_MARGIN = 2
+ TXT_BOTTOM_MARGIN = 2
+ TXT_LEGACY_TOP_MARGIN = 2
+ TXT_LEGACY_BOTTOM_MARGIN = 0
+
+ EPUB_TAG = HTML_TAG = 'p'
+ EPUB_CLASS = HTML_CLASS = 'paragraph adresat'
+
+class MiejsceData(WLElement):
+ STRIP = True
+ SHOULD_HAVE_ID = True
+
+ TXT_TOP_MARGIN = 2
+ TXT_BOTTOM_MARGIN = 2
+ TXT_LEGACY_TOP_MARGIN = 2
+ TXT_LEGACY_BOTTOM_MARGIN = 0
+
+ EPUB_TAG = HTML_TAG = 'p'
+ EPUB_CLASS = HTML_CLASS = 'paragraph miejscedata'
+
+class NaglowekListu(WLElement):
+ STRIP = True
+ SHOULD_HAVE_ID = True
+
+ TXT_TOP_MARGIN = 2
+ TXT_BOTTOM_MARGIN = 2
+ TXT_LEGACY_TOP_MARGIN = 2
+ TXT_LEGACY_BOTTOM_MARGIN = 0
+
+ EPUB_TAG = HTML_TAG = 'p'
+ EPUB_CLASS = HTML_CLASS = 'paragraph nagloweklistu'
+
+class Pozdrowienie(WLElement):
+ STRIP = True
+ SHOULD_HAVE_ID = True
+
+ TXT_TOP_MARGIN = 2
+ TXT_BOTTOM_MARGIN = 2
+ TXT_LEGACY_TOP_MARGIN = 2
+ TXT_LEGACY_BOTTOM_MARGIN = 0
+
+ EPUB_TAG = HTML_TAG = 'p'
+ EPUB_CLASS = HTML_CLASS = 'paragraph pozdrowienie'
+
+class Podpis(WLElement):
+ STRIP = True
+ SHOULD_HAVE_ID = True
+
+ TXT_TOP_MARGIN = 2
+ TXT_BOTTOM_MARGIN = 2
+ TXT_LEGACY_TOP_MARGIN = 2
+ TXT_LEGACY_BOTTOM_MARGIN = 0
+
+ EPUB_TAG = HTML_TAG = 'p'
+ EPUB_CLASS = HTML_CLASS = 'paragraph podpis'
for s in self.edoc.findall('//slowo_obce'):
if not s.text and len(s) == 1 and s[0].tag == 'slowo_obce':
continue
- if re.match(r'^[\s\u0590-\u05ff]+$', s.text):
+ if re.match(r'^[\s\u0590-\u05ff]+$', s.text or ''):
s.attrib['protect'] = 'true'
def editors(self):
{\scshape \MakeLowercase{#1}}%
}
+
+\newcommand{\list}[1]{%
+\begin{quotation}%
+#1%
+\end{quotation}%
+}
+
+\newcommand{\adresat}[1]{%
+\par{\N#1}%
+}
+\newcommand{\miejscedata}[1]{%
+\par{\raggedright\N#1}%
+}
+\newcommand{\nagloweklistu}[1]{%
+\begin{center}%
+\par{\N#1}%
+\end{center}%
+}
+\newcommand{\pozdrowienie}[1]{%
+\par{\hspace{4em}\N#1}%
+}
+\newcommand{\podpis}[1]{%
+\par{\hspace{4em}\N#1}%
+}
+
+
\newcommand{\sekcjaswiatlo}{%
\vspace{30pt}%
}
<xsl:template
- match="naglowek_osoba|naglowek_podrozdzial|podtytul_podrozdzial|miejsce_czas|didaskalia|lista_osoba|akap|akap_dialog|akap_cd|motto_podpis|naglowek_listy|srodtytul|podtytul_czesc|podtytul_rozdzial|podtytul_akt|podtytul_scena|werset">
+ match="naglowek_osoba|naglowek_podrozdzial|podtytul_podrozdzial|miejsce_czas|didaskalia|lista_osoba|akap|akap_dialog|akap_cd|motto_podpis|naglowek_listy|srodtytul|podtytul_czesc|podtytul_rozdzial|podtytul_akt|podtytul_scena|werset|list|adresat|miejsce_data|naglowek_listu|pozdrowienie|podpis">
<xsl:choose>
<xsl:when test="@inline">
<xsl:apply-templates mode="inline"/>
margin: 0;
text-indent: 1.2em;
}
+.paragraph.nagloweklistu {
+ text-align: center;
+ margin: .5em 0;
+ text-indent: 0;
+}
+.paragraph.miejscedata, .paragraph.pozdrowienie, .paragraph.podpis {
+ text-align: right;
+ text-indent: 0;
+}
h1 + .paragraph, h2 + .paragraph
{
</p>
</xsl:template>
+<xsl:template match="list">
+ <blockquote class="letter"><xsl:apply-templates /></blockquote>
+</xsl:template>
+<xsl:template match="adresat">
+ <p class="paragraph adresat">
+ <xsl:call-template name="block-args" />
+ <xsl:call-template name="section-anchor"/>
+ <xsl:apply-templates mode="inline" />
+ </p>
+</xsl:template>
+<xsl:template match="miejsce_data">
+ <p class="paragraph miejsce_data">
+ <xsl:call-template name="block-args" />
+ <xsl:call-template name="section-anchor"/>
+ <xsl:apply-templates mode="inline" />
+ </p>
+</xsl:template>
+<xsl:template match="naglowek_listu">
+ <p class="paragraph naglowek_listu">
+ <xsl:call-template name="block-args" />
+ <xsl:call-template name="section-anchor"/>
+ <xsl:apply-templates mode="inline" />
+ </p>
+</xsl:template>
+<xsl:template match="pozdrowienie">
+ <p class="paragraph pozdrowienie">
+ <xsl:call-template name="block-args" />
+ <xsl:call-template name="section-anchor"/>
+ <xsl:apply-templates mode="inline" />
+ </p>
+</xsl:template>
+<xsl:template match="podpis">
+ <p class="paragraph podpis">
+ <xsl:call-template name="block-args" />
+ <xsl:call-template name="section-anchor"/>
+ <xsl:apply-templates mode="inline" />
+ </p>
+</xsl:template>
+
<xsl:template match="strofa" mode="inline">
<xsl:apply-templates select="." />
</xsl:template>
<xsl:value-of select="wl:wrap_words(wl:strip($content), $wrapping)" />
</xsl:template>
+<xsl:template match="list">
+<xsl:text>
+
+
+</xsl:text>
+<xsl:apply-templates />
+<xsl:text>
+
+
+</xsl:text>
+</xsl:template>
+<xsl:template match="adesat">
+ <xsl:text>
+ </xsl:text>
+ <xsl:apply-templates select="*|text()" mode="inline" />
+ <xsl:text>
+</xsl:text>
+</xsl:template>
+<xsl:template match="miejsce_data">
+ <xsl:text>
+ </xsl:text>
+ <xsl:apply-templates select="*|text()" mode="inline" />
+ <xsl:text>
+</xsl:text>
+</xsl:template>
+<xsl:template match="naglowek_listu">
+ <xsl:text>
+
+ </xsl:text>
+ <xsl:apply-templates select="*|text()" mode="inline" />
+ <xsl:text>
+</xsl:text>
+</xsl:template>
+<xsl:template match="pozdrowienie">
+ <xsl:text>
+ </xsl:text>
+ <xsl:apply-templates select="*|text()" mode="inline" />
+ <xsl:text>
+</xsl:text>
+</xsl:template>
+<xsl:template match="podpis">
+ <xsl:text>
+ </xsl:text>
+ <xsl:apply-templates select="*|text()" mode="inline" />
+ <xsl:text>
+</xsl:text>
+</xsl:template>
+
<xsl:template match="strofa">
<xsl:text>
</xsl:text>