Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Showing with 94 additions and 5 deletions.
  1. +83 −0 librarian/fb2/description.xslt
  2. +11 −5 librarian/fb2/fb2.xslt
View
83 librarian/fb2/description.xslt
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ This file is part of Librarian, licensed under GNU Affero GPLv3 or later.
+ Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns="http://www.gribuser.ru/xml/fictionbook/2.0">
+
+ <!-- description parsing -->
+ <xsl:template match="rdf:Description" mode="outer">
+ <description>
+ <!-- need to keep ordering here... -->
+
+ <title-info>
+ <!-- obligatory: genre, author, book-title, lang -->
+
+ <!-- XXX -->
+ <genre>literature</genre>
+ <xsl:apply-templates mode="description"
+ select="dc:creator"/>
+ <xsl:apply-templates mode="description"
+ select="dc:title"/>
+ <xsl:apply-templates mode="description"
+ select="dc:date.pd"/>
+ <xsl:apply-templates mode="description"
+ select="dc:language"/>
+ </title-info>
+ <document-info>
+ <!-- obligatory: author, date, id, version -->
+
+ <xsl:apply-templates mode="description"
+ select="dc:contributor.editor"/>
+ <xsl:apply-templates mode="description"
+ select="dc:contributor.technical_editor"/>
+ <program-used>book2fb2</program-used>
+ <!-- maybe today's date instead? -->
+ <xsl:apply-templates mode="description"
+ select="dc:date"/>
+ <xsl:apply-templates mode="description"
+ select="dc:identifier.url"/>
+ <!-- XXX -->
+ <version>0</version>
+ </document-info>
+ <publish-info>
+ <xsl:apply-templates mode="description"
+ select="dc:publisher"/>
+ </publish-info>
+ </description>
+ </xsl:template>
+
+ <xsl:template mode="description"
+ match="dc:creator|dc:contributor.editor|dc:contributor.technical_editor">
+ <!-- last name, first name -->
+ <xsl:variable name="last"
+ select="normalize-space(substring-before(., ','))"/>
+ <xsl:variable name="first"
+ select="normalize-space(substring-after(., ','))"/>
+
+ <author>
+ <first-name><xsl:value-of select="$first"/></first-name>
+ <last-name><xsl:value-of select="$last"/></last-name>
+ </author>
+ </xsl:template>
+ <xsl:template mode="description" match="dc:title">
+ <book-title><xsl:value-of select="."/></book-title>
+ </xsl:template>
+ <xsl:template mode="description" match="dc:language">
+ <lang><xsl:value-of select="."/></lang>
+ </xsl:template>
+ <xsl:template mode="description" match="dc:date.pd|dc:date">
+ <date><xsl:value-of select="."/></date>
+ </xsl:template>
+ <xsl:template mode="description" match="dc:publisher">
+ <publisher><xsl:value-of select="."/></publisher>
+ </xsl:template>
+ <xsl:template mode="description" match="dc:identifier.url">
+ <id><xsl:value-of select="."/></id>
+ </xsl:template>
+</xsl:stylesheet>
View
16 librarian/fb2/fb2.xslt
@@ -7,10 +7,10 @@
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:wl="http://wolnelektury.pl/functions"
- xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns="http://www.gribuser.ru/xml/fictionbook/2.0"
xmlns:l="http://www.w3.org/1999/xlink">
+ <xsl:include href="description.xslt"/>
<xsl:include href="footnotes.xslt"/>
<xsl:include href="inline.xslt"/>
<xsl:include href="paragraphs.xslt"/>
@@ -30,11 +30,8 @@
</FictionBook>
</xsl:template>
- <xsl:template match="dc:*" mode="outer">
- </xsl:template>
-
<!-- we can't handle lyrics nicely yet -->
- <xsl:template match="powiesc|opowiadanie" mode="outer">
+ <xsl:template match="powiesc|opowiadanie|liryka_l|liryka_lp" mode="outer">
<body> <!-- main body for main book flow -->
<xsl:if test="autor_utworu or nazwa_utworu">
<title>
@@ -43,6 +40,15 @@
</title>
</xsl:if>
+ <epigraph>
+ <p>
+ Utwór opracowany został w&#160;ramach projektu
+ <a l:href="http://www.wolnelektury.pl/">Wolne Lektury</a>
+ przez <a l:href="http://www.nowoczesnapolska.org.pl/">fundację
+ Nowoczesna Polska</a>.
+ </p>
+ </epigraph>
+
<xsl:variable name="sections" select="count(naglowek_rozdzial)"/>
<section>
<xsl:choose>

No commit comments for this range

Something went wrong with that request. Please try again.