local changes from server
authorJan Szejko <j-sz@o2.pl>
Mon, 7 Mar 2016 12:41:58 +0000 (13:41 +0100)
committerJan Szejko <j-sz@o2.pl>
Mon, 7 Mar 2016 12:41:58 +0000 (13:41 +0100)
14 files changed:
a.py [new file with mode: 0644]
librarian/document.py
librarian/formats/html/__init__.py
librarian/formats/pdf/__init__.py [new file with mode: 0644]
librarian/formats/pdf/res/TonyJericho.png [new file with mode: 0644]
librarian/formats/pdf/res/coverimage.sty [new file with mode: 0755]
librarian/formats/pdf/res/default.sty [new file with mode: 0755]
librarian/formats/pdf/res/insertimage.sty [new file with mode: 0644]
librarian/formats/pdf/res/template.texml [new file with mode: 0644]
librarian/formats/pdf/res/wl.cls [new file with mode: 0755]
librarian/formats/pdf/res/wl2tex.xslt [new file with mode: 0755]
milpdf/a.xml [new file with mode: 0644]
milpdf/m.xml [new file with mode: 0644]
milpdf/p.xml [new file with mode: 0644]

diff --git a/a.py b/a.py
new file mode 100644 (file)
index 0000000..d5f4886
--- /dev/null
+++ b/a.py
@@ -0,0 +1,13 @@
+#!/usr/bin/env python
+
+from librarian.document import Document as SST
+from librarian.formats.pdf import PdfFormat
+from librarian.utils import Context
+import shutil
+
+sst = SST.from_file('milpdf/a.xml')
+of = PdfFormat(sst).build(Context(), verbose=True)
+shutil.copy(of.get_filename(), 'a.pdf')
+
+
+
index 32148e3..acc80ae 100755 (executable)
@@ -21,11 +21,22 @@ class Document(object):
 
         if not isinstance(root_elem, Section):
             if root_elem.tag != SSTNS('section'):
-                raise ValidationError("Invalid root element. Found '%s', should be '%s'" % (
-                    root_elem.tag, SSTNS('section')))
+                if root_elem.tag == 'section':
+                    for element in root_elem.iter():
+                        if element.tag in ('section', 'header', 'div', 'span', 'aside', 'metadata'):
+                            element.tag = str(SSTNS(element.tag))
+
+                    parser = SSTParser()
+                    tree = etree.parse(StringIO(etree.tostring(root_elem)), parser)
+                    tree.xinclude()
+                    self.edoc = tree
+                else:
+                    raise ValueError("Invalid root element. Found '%s', should be '%s'" % (
+                        root_elem.tag, SSTNS('section')))
             else:
-                raise ValidationError("Invalid class of root element. "
+                raise ValueError("Invalid class of root element. "
                     "Use librarian.parser.SSTParser.")
+        #print etree.tostring(self.edoc.getroot())
 
     @classmethod
     def from_string(cls, xml, *args, **kwargs):
@@ -47,6 +58,8 @@ class Document(object):
             data = data.decode('utf-8')
 
         data = data.replace(u'\ufeff', '')
+        # This is bad. The editor shouldn't spew unknown HTML entities.
+        data = data.replace(u'&nbsp;', u'\u00a0')
 
         parser = SSTParser()
         tree = etree.parse(StringIO(data.encode('utf-8')), parser)
index ddf2c78..2cf2601 100644 (file)
@@ -22,7 +22,7 @@ class HtmlFormat(Format):
         super(HtmlFormat, self).__init__(doc)
         self.standalone = standalone
 
-    def build(self):
+    def build(self, files_path=None):
         if self.standalone:
             tmpl = get_resource("formats/html/res/html_standalone.html")
         else:
@@ -30,6 +30,7 @@ class HtmlFormat(Format):
         t = etree.parse(tmpl)
 
         ctx = Context(format=self)
+        ctx.files_path = files_path
         ctx.toc = TOC()
         ctx.toc_level = 0
         ctx.footnotes = Footnotes()
@@ -39,7 +40,7 @@ class HtmlFormat(Format):
 
         t.find('.//div[@id="content"]').extend(
             self.render(self.doc.edoc.getroot(), ctx))
-        t.find('.//div[@id="toc"]').append(ctx.toc.render())
+        #t.find('.//div[@id="toc"]').append(ctx.toc.render())
         t.find('.//div[@id="footnotes"]').extend(ctx.footnotes.output)
 
         return OutputFile.from_string(etree.tostring(
@@ -67,6 +68,12 @@ class LiteralText(TreeRenderer):
     pass
 
 
+class Silent(TreeRenderer):
+    def render_text(self, text, ctx):
+        root, inner = self.text_container()
+        return root
+
+
 class Footnotes(object):
     def __init__(self):
         self.counter = 0
@@ -122,6 +129,7 @@ class TOC(object):
 # Renderers
 
 HtmlFormat.renderers.register(core.Aside, None, NaturalText('aside'))
+HtmlFormat.renderers.register(core.Aside, 'comment', Silent())
 
 class AsideFootnote(NaturalText):
     def render(self, element, ctx):
@@ -132,13 +140,60 @@ class AsideFootnote(NaturalText):
         return root
 HtmlFormat.renderers.register(core.Aside, 'footnote', AsideFootnote())
 
+
+class Header(NaturalText):
+    def render(self, element, ctx):
+        root = super(Header, self).render(element, ctx)
+        if ctx.toc_level == 1:
+            d = etree.SubElement(root, 'div', {'class': "page-header"})
+            d.insert(0, root[0])
+        else:
+            root[0].tag = 'h2'
+            if root[0].text:
+                d = etree.SubElement(root[0], 'a', {'id': root[0].text, 'style': 'pointer: hand; color:#ddd; font-size:.8em'})
+                #d.text = "per"
+        return root
+
        
-HtmlFormat.renderers.register(core.Header, None, NaturalText('h1'))
+HtmlFormat.renderers.register(core.Header, None, Header('h1'))
 
 
 HtmlFormat.renderers.register(core.Div, None, NaturalText('div'))
+
+class DivDefined(NaturalText):
+    def render(self, element, ctx):
+        output = super(DivDefined, self).render(element, ctx)
+        output[0].text = (output[0].text or '') + ':'
+        output[0].attrib['id'] = output[0].text # not so cool?
+        return output
+
+HtmlFormat.renderers.register(core.Div, 'defined', DivDefined('dt', {'style': 'display: inline-block'}))
+
+
+class DivImage(NaturalText):
+    def render(self, element, ctx):
+        output = super(DivImage, self).render(element, ctx)
+        src = element.attrib.get('src', '')
+        if src.startswith('file://'):
+            src = ctx.files_path + src[7:]
+        output[0].attrib['src'] = src
+        output[0].attrib['style'] = 'display: block; width: 60%; margin: 3em auto'
+        return output
+
+HtmlFormat.renderers.register(core.Div, 'img', DivImage('img'))
+
 HtmlFormat.renderers.register(core.Div, 'item', NaturalText('li'))
 HtmlFormat.renderers.register(core.Div, 'list', NaturalText('ul'))
+HtmlFormat.renderers.register(core.Div, 'list.enum', NaturalText('ol'))
+
+class DivListDefinitions(NaturalText):
+    def render(self, element, ctx):
+        output = super(DivListDefinitions, self).render(element, ctx)
+        #if ctx.toc_level > 2:
+        #    output[0].attrib['style'] = 'float: right'
+        return output
+
+HtmlFormat.renderers.register(core.Div, 'list.definitions', DivListDefinitions('ul'))
 HtmlFormat.renderers.register(core.Div, 'p', NaturalText('p'))
 
 
@@ -158,6 +213,7 @@ HtmlFormat.renderers.register(core.Span, None, NaturalText('span'))
 HtmlFormat.renderers.register(core.Span, 'cite', NaturalText('cite'))
 HtmlFormat.renderers.register(core.Span, 'cite.code', LiteralText('code'))
 HtmlFormat.renderers.register(core.Span, 'emph', NaturalText('em'))
+HtmlFormat.renderers.register(core.Span, 'emp', NaturalText('strong'))
 
 class SpanUri(LiteralText):
     def render(self, element, ctx):
@@ -165,3 +221,14 @@ class SpanUri(LiteralText):
         root[0].attrib['href'] = element.text
         return root
 HtmlFormat.renderers.register(core.Span, 'uri', SpanUri('a'))
+
+class SpanLink(LiteralText):
+    def render(self, element, ctx):
+        root = super(SpanLink, self).render(element, ctx)
+        src = element.attrib.get('href', '')
+        if src.startswith('file://'):
+            src = ctx.files_path + src[7:]
+        root[0].attrib['href'] = src
+        return root
+HtmlFormat.renderers.register(core.Span, 'link', SpanLink('a'))
+
diff --git a/librarian/formats/pdf/__init__.py b/librarian/formats/pdf/__init__.py
new file mode 100644 (file)
index 0000000..298db09
--- /dev/null
@@ -0,0 +1,381 @@
+# -*- 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.
+#
+import os
+import re
+import shutil
+from subprocess import call, PIPE
+from tempfile import NamedTemporaryFile, mkdtemp
+from lxml import etree
+from urllib import urlretrieve
+from StringIO import StringIO
+from Texml.processor import process
+from librarian import DCNS, XMLNamespace
+from librarian.formats import Format
+from librarian.output import OutputFile
+from librarian.renderers import Register, TreeRenderer
+from librarian.utils import Context, get_resource, extend_element
+from librarian import core
+from PIL import Image
+from ..html import Silent
+
+
+TexmlNS = XMLNamespace('http://getfo.sourceforge.net/texml/ns1')
+
+
+def texml_cmd(name, *parms, **kwargs):
+    cmd = etree.Element(TexmlNS('cmd'), name=name)
+    for opt in kwargs.get('opts', []):
+        etree.SubElement(cmd, TexmlNS('opt')).text = opt
+    for parm in parms:
+        etree.SubElement(cmd, TexmlNS('parm')).text = parm
+    return cmd
+
+
+class PdfFormat(Format):
+    format_name = 'PDF'
+    format_ext = 'pdf'
+    tex_passes = 1
+    style = get_resource('formats/pdf/res/default.sty')
+
+    local_packages = [
+        get_resource('formats/pdf/res/coverimage.sty'),
+        get_resource('formats/pdf/res/insertimage.sty'),
+    ]
+
+    renderers = Register()
+
+    def retrieve_file(self, url, save_as):
+        # TODO: local sheme
+        return False
+
+    def add_file(self, ctx, filename, url=None, path=None, image=False):
+        from subprocess import call
+        assert url or path
+        save_as = os.path.join(ctx.workdir, filename)
+        if path is not None:
+            ext = path.rsplit('.', 1)[-1]
+            if image:
+                if ext == 'gif':
+                    call(['convert', path, save_as])
+                else:
+                    # JPEGs with bad density will break LaTeX with 'Dimension too large'.
+                    call(['convert', '-units', 'PixelsPerInch', path, '-density', '300', save_as + '_.' + ext])
+                    shutil.move(save_as + '_.' + ext, save_as)
+            else:
+                shutil.copy(path, save_as)
+        elif not self.retrieve_file(url, save_as):
+            if url.startswith('file://'):
+                url = ctx.files_path + url[7:]
+
+            if url.startswith('/'):
+                url = 'http://milpeer.eu' + url
+
+            ext = url.rsplit('.', 1)[-1]
+            if image:
+                urlretrieve(url, save_as + '_.' + ext)
+                if ext == 'gif':
+                    call(['convert', save_as + '_.' + ext, save_as])
+                else:
+                    # JPEGs with bad density will break LaTeX with 'Dimension too large'.
+                    r = call(['convert', '-units', 'PixelsPerInch', save_as + '_.' + ext, '-density', '300', save_as + '_2.' + ext])
+                    if r:
+                        shutil.move(save_as + '_.' + ext, save_as)
+                    else:
+                        shutil.move(save_as + '_2.' + ext, save_as)
+            else:
+                urlretrieve(url, save_as)
+
+    def get_file(self, ctx, filename):
+        return os.path.join(ctx.workdir, filename)
+
+    def get_texml(self, build_ctx):
+        t = etree.Element(TexmlNS('TeXML'))
+
+        self.add_file(build_ctx, 'wl.cls', path=get_resource('formats/pdf/res/wl.cls'))
+        t.append(texml_cmd("documentclass", "wl"))
+
+        # global packages
+        self.add_file(build_ctx, 'style.sty', path=self.style)
+        t.append(texml_cmd("usepackage", "style"))
+        t.append(texml_cmd("usepackage", "hyphenat"))
+
+        # local packages
+        for i, package in enumerate(self.local_packages):
+            self.add_file(build_ctx, "librarianlocalpackage%s.sty" % i, path=package)
+            t.append(texml_cmd("usepackage", "librarianlocalpackage%s" % i))
+
+        author = ", ". join(self.doc.meta.get(DCNS('creator')) or '')
+        title = self.doc.meta.title()
+        t.append(texml_cmd("author", author))
+        t.append(texml_cmd("title", title))
+
+        doc = etree.SubElement(t, TexmlNS('env'), name="document")
+        doc.append(texml_cmd("thispagestyle", "empty"))
+
+        # title page
+        height_left = 297
+        cover_url = self.doc.meta.get_one(DCNS('relation.coverimage.url'))
+        if cover_url:
+            self.add_file(build_ctx, 'cover.png', cover_url, image=True)
+            
+            img = Image.open(self.get_file(build_ctx, 'cover.png'))
+            size = img.size
+
+            if (size[1] > size[0]):
+                img = img.crop((0, 0, size[0], size[0]))
+                img.save(self.get_file(build_ctx, 'cover.png'), format=img.format, quality=90)
+            size = img.size
+
+            # TODO: hardcoded paper size here
+            height = 210.0 * size[1] / size[0]
+            doc.append(texml_cmd("makecover", "%fmm" % height))
+        else:
+            doc.append(texml_cmd("vfill*"))
+
+        # Wielkości!
+        grp = etree.SubElement(doc, 'group')
+        grp.append(texml_cmd("raggedright"))
+        grp.append(texml_cmd("vfill"))
+        if author:
+            p = texml_cmd("par", "")
+            grp.append(p)
+            p[0].append(texml_cmd("Large"))
+            p[0].append(texml_cmd("noindent"))
+            p[0].append(texml_cmd("nohyphens", author))
+            p[0].append(texml_cmd("vspace", "1em"))
+            #p[0][-1].tail = author
+        if title:
+            p = texml_cmd("par", "")
+            grp.append(p)
+            p[0].append(texml_cmd("Huge"))
+            p[0].append(texml_cmd("noindent"))
+            p[0].append(texml_cmd("nohyphens", title))
+            #p[0][-1].tail = title
+        doc.append(texml_cmd("vfill"))
+        doc.append(texml_cmd("vfill"))
+
+        # IOFile probably would be better
+        cover_logo_url = getattr(build_ctx, 'cover_logo', None)
+        # TEST
+        # TODO: convert
+        #cover_logo_url = 'http://milpeer.mdrn.pl/media/dynamic/people/logo/nowoczesnapolska.org.pl.png'
+        if cover_logo_url:
+            self.add_file(build_ctx, 'coverlogo.png', cover_logo_url, image=True)
+            size = Image.open(self.get_file(build_ctx, 'coverlogo.png')).size
+            p = texml_cmd("par", "")
+            doc.append(p)
+            p[0].append(texml_cmd("noindent"))
+            p[0].append(texml_cmd("insertimage", 'coverlogo.png', "%fcm" % (1.0 * size[0] / size[1]), "1cm"))
+            
+        # logo organizacji!
+        doc.append(texml_cmd("clearpage"))
+
+        ctx = Context(build_ctx, format=self, img=1)
+        doc.extend(self.render(self.doc.edoc.getroot(), ctx))
+
+        # Redakcyjna na końcu.
+        doc.append(texml_cmd("clearpage"))
+
+        doc.append(texml_cmd("section*", "Information about the resource"))
+        doc.append(texml_cmd("vspace", "1em"))
+
+        for m, f in (
+            ('Publisher: ', DCNS('publisher')),
+            ('Rights: ', DCNS('rights')),
+            ('Intended audience: ', DCNS('audience')),
+            ('', DCNS('description')),
+            ):
+            v = self.doc.meta.get_one(f)
+            if v:
+                e = texml_cmd("par", "")
+                e[0].append(texml_cmd("noindent"))
+                e[0][0].tail = "%s%s" % (m, v)
+                doc.append(e)
+                doc.append(texml_cmd("vspace", "1em"))
+
+
+        e = texml_cmd("par", "")
+        e[0].append(texml_cmd("noindent"))
+        e[0][0].tail = "Resource prepared using "
+        e[0].append(texml_cmd("href", "http://milpeer.eu", "MIL/PEER"))
+        e[0][-1].tail = " editing platform. "
+        doc.append(e)
+
+        source_url = getattr(build_ctx, 'source_url', None)
+        #source_url = 'http://milpeer.mdrn.pl/documents/27/'
+        if source_url:
+            e = texml_cmd("par", "")
+            doc.append(e)
+            e[0].append(texml_cmd("noindent"))
+            e[0][0].tail = "Source available at "
+            e[0].append(texml_cmd("href", source_url, source_url))
+
+        return t
+
+    def get_tex_dir(self, ctx):
+        ctx.workdir = mkdtemp('-wl2pdf')
+        texml = self.get_texml(ctx)
+        tex_path = os.path.join(ctx.workdir, 'doc.tex')
+        with open(tex_path, 'w') as fout:
+            #print etree.tostring(texml)
+            process(StringIO(etree.tostring(texml)), fout, 'utf-8')
+
+        #~ if self.save_tex:
+            #~ shutil.copy(tex_path, self.save_tex)
+
+
+
+        #for sfile in ['wasysym.sty', 'uwasyvar.fd', 'uwasy.fd']:
+        #    shutil.copy(get_resource(os.path.join('res/wasysym', sfile)), temp)
+        return ctx.workdir
+
+    def build(self, ctx=None, verbose=False):
+        temp = self.get_tex_dir(ctx)
+        tex_path = os.path.join(temp, 'doc.tex')
+        try:
+            cwd = os.getcwd()
+        except OSError:
+            cwd = None
+        os.chdir(temp)
+
+        if verbose:
+            for i in range(self.tex_passes):
+                p = call(['xelatex', tex_path])
+        else:
+            for i in range(self.tex_passes):
+                p = call(['xelatex', '-interaction=batchmode', tex_path],
+                            stdout=PIPE, stderr=PIPE)
+        if p:
+            #raise ParseError("Error parsing .tex file: %s" % tex_path)
+            raise RuntimeError("Error parsing .tex file: %s" % tex_path)
+
+        if cwd is not None:
+            os.chdir(cwd)
+
+        output_file = NamedTemporaryFile(prefix='librarian', suffix='.pdf', delete=False)
+        pdf_path = os.path.join(temp, 'doc.pdf')
+        shutil.move(pdf_path, output_file.name)
+        shutil.rmtree(temp)
+        os.system("ls -l " + output_file.name)
+        return OutputFile.from_filename(output_file.name)
+    
+    def render(self, element, ctx):
+        return self.renderers.get_for(element).render(element, ctx)
+
+
+
+
+class CmdRenderer(TreeRenderer):
+    def parms(self):
+        return []
+    def container(self):
+        root = etree.Element(self.root_name)
+        root.append(texml_cmd(self.tag_name, *(self.parms() + [""])))
+        inner = root[0][-1]
+        return root, inner
+
+class EnvRenderer(TreeRenderer):
+    def container(self):
+        root = etree.Element(self.root_name)
+        inner = etree.SubElement(root, 'env', name=self.tag_name)
+        return root, inner
+
+class GroupRenderer(CmdRenderer):
+    def container(self):
+        root = etree.Element(self.root_name)
+        inner = etree.SubElement(root, 'group')
+        if self.tag_name:
+            inner.append(texml_cmd(self.tag_name, *(self.parms() + [""])))
+        return root, inner
+
+
+class SectionRenderer(CmdRenderer):
+    def subcontext(self, element, ctx):
+        # here?
+        return Context(ctx, toc_level=getattr(ctx, 'toc_level', 1) + 2)
+
+    def container(self):
+        root = etree.Element(self.root_name)
+        root.append(texml_cmd('pagebreak', opts=['1']))
+        root.append(texml_cmd(self.tag_name, *(self.parms() + [""])))
+        inner = root[1][0]
+        return root, inner
+
+PdfFormat.renderers.register(core.Section, None, SectionRenderer('par'))
+
+# TODO: stopnie
+PdfFormat.renderers.register(core.Header, None, CmdRenderer('section*'))
+
+PdfFormat.renderers.register(core.Div, None, CmdRenderer('par'))
+
+class ImgRenderer(CmdRenderer):
+    def parms(self):
+        return ["", ""]
+
+    def render(self, element, ctx):
+        root = super(ImgRenderer, self).render(element, ctx)
+        url = element.get('src')
+        nr = getattr(ctx, 'img', 0)
+        ctx.img = nr + 1
+        ctx.format.add_file(ctx, 'f%d.png' % nr, url, image=True)
+        root[0][0].text = 'f%d.png' % nr
+        try:
+            size = Image.open(ctx.format.get_file(ctx, 'f%d.png' % nr)).size
+        except IOError: # not an image
+            del root[0];
+            return root
+        root[0][1].text = '15cm'
+        root[0][2].text = '%fcm' % (15.0 * size[1] / size[0])
+        return root
+
+PdfFormat.renderers.register(core.Div, 'img', ImgRenderer('insertimage'))
+
+
+PdfFormat.renderers.register(core.Div, 'defined', CmdRenderer('textbf'))
+PdfFormat.renderers.register(core.Div, 'item', CmdRenderer('item'))
+PdfFormat.renderers.register(core.Div, 'list', EnvRenderer('itemize'))
+PdfFormat.renderers.register(core.Div, 'list.enum', EnvRenderer('enumerate'))
+
+
+
+PdfFormat.renderers.register(core.Span, None, TreeRenderer())
+PdfFormat.renderers.register(core.Span, 'cite', CmdRenderer('emph'))
+PdfFormat.renderers.register(core.Span, 'cite.code', CmdRenderer('texttt'))
+PdfFormat.renderers.register(core.Span, 'emp', CmdRenderer('textbf'))
+PdfFormat.renderers.register(core.Span, 'emph', CmdRenderer('emph'))
+
+class SpanUri(CmdRenderer):
+    def parms(self):
+        return [""]
+    def render(self, element, ctx):
+        root = super(SpanUri, self).render(element, ctx)
+        src = element.text
+        if src.startswith('file://'):
+           src = ctx.files_path + src[7:]
+        root[0][0].text = src
+        return root
+PdfFormat.renderers.register(core.Span, 'uri', SpanUri('href'))
+
+
+class SpanLink(CmdRenderer):
+    def parms(self):
+        return [""]
+    def render(self, element, ctx):
+        root = super(SpanLink, self).render(element, ctx)
+        src = element.attrib.get('href', '')
+        if src.startswith('file://'):
+           src = ctx.files_path + src[7:]
+        root[0][0].text = src
+        return root
+PdfFormat.renderers.register(core.Span, 'link', SpanLink('href'))
+
+
+
+
+PdfFormat.renderers.register(core.Aside, None, TreeRenderer())
+PdfFormat.renderers.register(core.Aside, 'editorial', CmdRenderer('editorialpage'))
+PdfFormat.renderers.register(core.Aside, 'comment', Silent())
+
diff --git a/librarian/formats/pdf/res/TonyJericho.png b/librarian/formats/pdf/res/TonyJericho.png
new file mode 100644 (file)
index 0000000..08089b6
Binary files /dev/null and b/librarian/formats/pdf/res/TonyJericho.png differ
diff --git a/librarian/formats/pdf/res/coverimage.sty b/librarian/formats/pdf/res/coverimage.sty
new file mode 100755 (executable)
index 0000000..4f3f117
--- /dev/null
@@ -0,0 +1,23 @@
+\newcommand{\makecover}[1]{
+% parametry: wysokosc po obcieciu, ile obciac z dolu
+        \newlength{\PictHOffset}
+        \newlength{\PictVOffset}
+        \setlength{\PictHOffset}{1in}
+        \addtolength{\PictHOffset}{\hoffset}
+        \addtolength{\PictHOffset}{\oddsidemargin}
+
+        \setlength{\PictVOffset}{1.166in}
+        %\setlength{\PictVOffset}{0pt}
+        \addtolength{\PictVOffset}{\voffset}
+        \addtolength{\PictVOffset}{\topmargin}
+        \addtolength{\PictVOffset}{\headheight}
+        \addtolength{\PictVOffset}{\headsep}
+        \addtolength{\PictVOffset}{\topskip}
+        \addtolength{\PictVOffset}{-#1}
+
+        \noindent\hspace*{-\PictHOffset}%
+        \raisebox{\PictVOffset}[0pt][0pt]{\makebox[0pt][l]{%
+            \includegraphics[width=210mm,height=#1]{cover.png}}}
+
+        \vspace{-\PictVOffset}
+}
diff --git a/librarian/formats/pdf/res/default.sty b/librarian/formats/pdf/res/default.sty
new file mode 100755 (executable)
index 0000000..40b867d
--- /dev/null
@@ -0,0 +1,33 @@
+\usepackage[MeX]{polski}
+
+\newcommand{\rightsinfostr}[2][] {
+    \ifx&#1&%
+        #2
+    \else
+        Ten utwór jest udostępniony na licencji
+        \href{#1}{#2}.
+    \fi
+}
+
+
+\renewcommand{\maketitle}{}
+
+\newcommand{\editorialsection}{
+  \begin{figure}[b!]
+  {
+    \footnotesize
+    \color{theme}
+    \noindent \rule{\linewidth}{0.4pt}
+
+    \rightsinfo
+    \vspace{.6em}
+
+    \editors
+
+    \vspace{.6em}
+    \coverby
+
+    \color{black}
+  }
+  \end{figure}
+}
diff --git a/librarian/formats/pdf/res/insertimage.sty b/librarian/formats/pdf/res/insertimage.sty
new file mode 100644 (file)
index 0000000..9fbcb9d
--- /dev/null
@@ -0,0 +1,5 @@
+\newcommand{\insertimage}[3]{
+
+   \includegraphics[width=#2,height=#3]{#1}
+
+}
diff --git a/librarian/formats/pdf/res/template.texml b/librarian/formats/pdf/res/template.texml
new file mode 100644 (file)
index 0000000..1eb8f78
--- /dev/null
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<TeXML xmlns="http://getfo.sourceforge.net/texml/ns1">
+    <TeXML escape="0">
+        \documentclass{wl}
+        \usepackage{style}
+        \usepackage{coverimage}
+
+        <env name="document">
+            <cmd name="makecover" />
+        </env>
+    </TeXML>
+</TeXML>
diff --git a/librarian/formats/pdf/res/wl.cls b/librarian/formats/pdf/res/wl.cls
new file mode 100755 (executable)
index 0000000..f336749
--- /dev/null
@@ -0,0 +1,426 @@
+% -*- coding: utf-8 -*-
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesClass{wl}[2011/11/28 wolnelektury.pl book style]
+
+% PDF customizations
+%
+% nofootnotes - disable generation of footnotes
+% nothemes - disable generation of themes
+% defaultleading - default leading
+% onehalfleading - leading of 1.5 (interlinia)
+% doubleleading - double leading (interlinia)
+% a4paper,... - paper size as required by LaTeX
+% nowlfont - don't use customized WL font
+
+\RequirePackage{setspace}
+\RequirePackage{type1cm}
+%\RequirePackage{wasysym}
+\DeclareOption{13pt}{%
+\AtEndOfClass{%
+% font size definitions, similar to ones in /usr/share/texmf-texlive/tex/latex/base/
+\renewcommand\normalsize{%
+   \@setfontsize\normalsize{13pt}{14.5pt}%
+   \abovedisplayskip 12\p@ \@plus3\p@ \@minus7\p@
+   \abovedisplayshortskip \z@ \@plus3\p@
+   \belowdisplayshortskip 6.5\p@ \@plus3.5\p@ \@minus3\p@
+   \belowdisplayskip \abovedisplayskip
+   \let\@listi\@listI}\normalsize%
+\renewcommand\footnotesize{%
+   \@setfontsize\footnotesize\@xpt\@xiipt
+   \abovedisplayskip 10\p@ \@plus2\p@ \@minus5\p@
+   \abovedisplayshortskip \z@ \@plus3\p@
+   \belowdisplayshortskip 6\p@ \@plus3\p@ \@minus3\p@
+   \def\@listi{\leftmargin\leftmargini
+               \topsep 6\p@ \@plus2\p@ \@minus2\p@
+               \parsep 3\p@ \@plus2\p@ \@minus\p@
+               \itemsep \parsep}%
+   \belowdisplayskip \abovedisplayskip
+}%
+}%
+}
+
+%% \DeclareOption{14pt}{\renewcommand{\normalsize}{\AtEndOfClass{\fontsize{14}{17}\selectfont}}}
+
+\DeclareOption{defaultleading}{}
+\DeclareOption{doubleleading}{\AtBeginDocument{\doublespacing}}%\setlength{\leading}{1em plus 0.5ex minus 0.2ex}}
+\DeclareOption{onehalfleading}{\AtBeginDocument{\onehalfspacing}}%\setlength{\leading}{1em plus 0.5ex minus 0.2ex}}
+
+%% This does not really work, since dvipdfm(x) will use it's configuration in /etc/texmf/dvipdfm(x) and force a global paper size setting.
+\DeclareOption{a5paper}{%
+      \setlength{\paperheight}{210mm}%
+      \setlength{\paperwidth}{148mm}}
+
+
+\newif\ifshowfootnotes \showfootnotestrue
+\DeclareOption{nofootnotes}{\showfootnotesfalse}
+
+\newif\ifshowthemes \showthemestrue
+\DeclareOption{nothemes}{\showthemesfalse}
+
+\newif\ifenablewlfont \enablewlfonttrue
+\DeclareOption{nowlfont}{\enablewlfontfalse}
+
+\DeclareOption*{\PassOptionsToClass{\CurrentOption}{book}}
+\ProcessOptions\relax
+\LoadClass[a4paper,oneside]{book}
+
+
+\usepackage{trace}
+
+\usepackage[xetex]{graphicx}
+\usepackage{fontspec}
+\usepackage{xunicode}
+\usepackage{xltxtra}
+
+\usepackage[overload]{textcase}
+\usepackage{scalefnt}
+% TODO: link color is a style thing
+\usepackage[hyphens]{url}
+\usepackage[colorlinks=true,linkcolor=black,setpagesize=false,urlcolor=blue,xetex]{hyperref}
+
+\ifenablewlfont
+\setmainfont [
+%ExternalLocation,
+%UprightFont = Dosis-Regular,
+UprightFont = JunicodeWL-Regular,
+%ItalicFont = Dosis-SemiBold,
+%BoldFont = Dosis-Bold,
+%BoldItalicFont = Dosis-Bold,
+%SmallCapsFont = Dosis-Regular,
+ItalicFont = JunicodeWL-Italic,
+BoldFont = Junicode-Bold,
+%BoldFont = Junicode-Italic,
+BoldItalicFont = Junicode-BoldItalic,
+SmallCapsFont = JunicodeWL-Regular,
+SmallCapsFeatures = {Letters={SmallCaps,UppercaseSmallCaps}},
+Numbers=OldStyle,
+Scale=1.04,
+LetterSpace=-1.0
+] {Junicode}
+
+%\newfontfamily\alien[
+%\setmainfont[
+%SmallCapsFeatures = {Letters={SmallCaps,UppercaseSmallCaps}},
+%Numbers=OldStyle,
+%Scale=0.85,
+%LetterSpace=-1.0
+%] {FreeSans}
+%\setmainfont{FreeSans}
+
+
+\defaultfontfeatures{
+SizeFeatures={
+  {Size={-10.5}, FakeStretch=1.02, LetterSpace=2.0 },
+  {Size={10.5-12}, FakeStretch=2.00, LetterSpace=0.0 },
+  {Size={12-}, FakeStretch=0.98, LetterSpace=-2.0 }
+}
+}
+
+\renewcommand{\textsc}[1]{%
+{\addfontfeature{
+SizeFeatures={
+  {Size={-10.5}, Scale=1.2, FakeStretch=1.02, LetterSpace=8.0 },
+  {Size={10.5-12}, Scale=1.2, FakeStretch=1.02, LetterSpace=8.0 },
+  {Size={12-}, FakeStretch=1.0, LetterSpace=8.0 }
+},
+Letters={SmallCaps,UppercaseSmallCaps}
+}
+#1}
+}
+\fi% enablewlfont
+
+%{\Itshape JunicodeWL-Italic.ttf }
+%{\bfseries Junicode-Bold.ttf }
+%{\bfseries\itshape Junicode-BoldItalic.ttf }
+
+\pagestyle{plain}
+\usepackage{fancyhdr}
+
+\makeatletter
+
+% bottom figure below footnotes
+\usepackage{fnpos}
+\makeFNabove
+
+\usepackage{color}
+\definecolor{theme}{gray}{.3}
+
+
+\setlength{\marginparsep}{2em}
+%\setlength{\marginparwidth}{8.5em}
+\setlength{\marginparwidth}{2.5cm}
+\setlength{\oddsidemargin}{0pt}
+\setlength{\voffset}{0pt}
+\setlength{\topmargin}{0pt}
+\setlength{\headheight}{0pt}
+\setlength{\headsep}{0pt}
+\setlength{\textheight}{24cm}
+\setlength{\textwidth}{16cm}
+
+
+\pagestyle{fancy}
+\fancyhf{}
+\renewcommand{\headrulewidth}{0pt}
+\renewcommand{\footrulewidth}{0pt}
+\lfoot{{\footnotesize \@author{} \emph{\@title}}}
+\cfoot{}
+\rfoot{{\footnotesize \thepage}}
+
+\clubpenalty=100000
+\widowpenalty=100000
+
+
+% see http://osdir.com/ml/tex.xetex/2005-10/msg00003.html
+\newsavebox{\ximagebox}\newlength{\ximageheight}
+\newsavebox{\xglyphbox}\newlength{\xglyphheight}
+\newcommand{\xbox}[1]
+{\savebox{\ximagebox}{#1}\settoheight{\ximageheight}{\usebox {\ximagebox}}%
+\savebox{\xglyphbox}{\char32}\settoheight{\xglyphheight}{\usebox {\xglyphbox}}%
+\raisebox{\ximageheight}[0pt][0pt]{%\raisebox{-\xglyphheight}[0pt] [0pt]{%
+\makebox[0pt][l]{\usebox{\xglyphbox}}}%}%
+\usebox{\ximagebox}%
+\raisebox{0pt}[0pt][0pt]{\makebox[0pt][r]{\usebox{\xglyphbox}}}}
+
+
+
+\newcommand{\typosubsubsection}[1]{%
+{#1}
+}
+
+\newcommand{\typosubsection}[1]{%
+{\addfontfeature{
+SizeFeatures={
+  {Size={-10}, Scale=1.2, FakeStretch=1.00, LetterSpace=8.0 },
+  {Size={10.5-12}, Scale=1.2, FakeStretch=1.00, LetterSpace=8.0 },
+  {Size={12-}, FakeStretch=1.0, LetterSpace=8.0 }
+},
+Letters={Uppercase}
+}
+\MakeUppercase{#1}}
+}
+
+\newcommand{\typosection}[1]{%
+{\addfontfeature{FakeStretch=0.96, LetterSpace=-4.0}\emph{\scalefont{2}#1}}
+%{\addfontfeature{Scale=2.0, FakeStretch=0.98, LetterSpace=-2.0}\emph{#1}}
+}
+
+
+\newcommand{\tytul}[1]{%
+#1%
+\vspace{1em}%
+}
+
+\newcommand{\nazwapodutworu}[1]{%
+\section*{\typosection{#1}}%
+}
+
+\newcommand{\autorutworu}[1]{%
+\subsection*{\typosubsection{#1}}%
+}
+
+\newcommand{\dzielonadrzedne}[1]{%
+\subsection*{\typosubsubsection{#1}}%
+}
+
+\newcommand{\nazwautworu}[1]{%
+\section*{\raggedright{\typosection{#1}}}%
+}
+
+\newcommand{\podtytul}[1]{%
+\subsection*{\typosubsubsection{#1}}%
+}
+
+\newcommand{\translator}[1]{%
+% TODO: l10n is a style thing
+\subsection*{\typosubsubsection{tłum. #1}}%
+}
+
+
+\newcommand{\powiesc}[1]{#1}
+\newcommand{\opowiadanie}[1]{#1}
+\newcommand{\lirykal}[1]{#1}
+\newcommand{\lirykalp}[1]{#1}
+\newcommand{\dramatwierszowanyl}[1]{#1}
+\newcommand{\dramatwierszowanylp}[1]{#1}
+\newcommand{\dramatwspolczesny}[1]{#1}
+
+\newcommand{\nota}[1]{%
+\par{#1}%
+}
+
+\newcommand{\dedykacja}[1]{%
+\begin{em}%
+\begin{flushright}%
+#1%
+\end{flushright}%
+\end{em}%
+}
+
+\newcommand{\dlugicytat}[1]{%
+\begin{quotation}%
+#1%
+\end{quotation}%
+}
+
+\newcommand{\poezjacyt}[1]{%
+\begin{verse}%
+#1%
+\end{verse}%
+}
+\newcommand{\motto}[1]{%
+\begin{em}%
+#1%
+\end{em}%
+}
+\newcommand{\listaosob}[2]{%
+\par{#1}%
+\begin{itemize}%
+#2%
+\end{itemize}%
+}
+
+\newcommand{\nagloweklisty}[1]{%
+\typosubsubsection{#1}%
+}
+
+\newcommand{\listaosoba}[1]{%
+\item{#1}%
+}
+
+\newcommand{\kwestia}[1]{%
+\par{#1}%
+}
+
+\newcommand{\naglowekakt}[1]{%
+\pagebreak
+\subsection*{\typosubsection{#1}}%
+}
+\newcommand{\naglowekczesc}[1]{%
+\pagebreak
+\subsection*{\typosubsection{#1}}%
+}
+\newcommand{\srodtytul}[1]{%
+\subsection*{\typosubsection{#1}}%
+}
+
+\newcommand{\naglowekscena}[1]{%
+\subsubsection*{\typosubsubsection{#1}}%
+}
+\newcommand{\naglowekrozdzial}[1]{%
+{\subsubsection*{\raggedright{\typosubsubsection{#1}}}}%
+}
+
+\newcommand{\naglowekosoba}[1]{%
+\par{\textsc{#1}}\nopagebreak%
+}
+\newcommand{\naglowekpodrozdzial}[1]{%
+\par{#1}\nopagebreak%
+}
+
+\newcommand{\miejsceczas}[1]{%
+\par{\emph{#1}}%
+}
+\newcommand{\didaskalia}[1]{%
+\par{\emph{#1}}%
+}
+
+\newcommand{\akap}[1]{%
+\par{#1}%
+}
+\newcommand{\akapdialog}[1]{%
+\par{#1}%
+}
+\newcommand{\akapcd}[1]{%
+\par{#1}%
+}
+
+\newcommand{\mottopodpis}[1]{%
+\begin{em}%
+\begin{flushright}%
+#1%
+\end{flushright}%
+\end{em}%
+}
+
+\newcommand{\strofa}[1]{%
+\par{\noindent{\ignorespaces#1\vspace{1em}}}%
+}
+
+\newcommand{\wers}[1]{#1}
+
+\newcommand{\wersakap}[1]{%
+\hspace*{1em}#1%
+}
+\newcommand{\werscd}[1]{%
+\hspace*{8em}#1%
+}
+\newcommand{\werswciety}[2][1em]{%
+\hspace*{#1}#2%
+}
+
+\ifshowfootnotes
+  \newcommand{\pa}[1]{\NoCaseChange{\footnote{#1}}}
+  \newcommand{\pe}[1]{\NoCaseChange{\footnote{#1}}}
+  \newcommand{\pr}[1]{\NoCaseChange{\footnote{#1}}}
+  \newcommand{\pt}[1]{\NoCaseChange{\footnote{#1}}}
+\else
+  \newcommand{\pa}[1]{}
+  \newcommand{\pe}[1]{}
+  \newcommand{\pr}[1]{}
+  \newcommand{\pt}[1]{}
+\fi
+
+\newcommand{\mat}[1]{$#1$}
+
+\newcommand{\didasktekst}[1]{%
+\emph{#1}%
+}
+\newcommand{\slowoobce}[1]{%
+\emph{#1}%
+}
+\newcommand{\tytuldziela}[1]{%
+\emph{#1}%
+}
+\newcommand{\wyroznienie}[1]{%
+\emph{#1}%
+}
+
+\newcommand{\osoba}[1]{%
+#1%
+}
+
+\newcommand{\sekcjaswiatlo}{%
+\vspace{30pt}%
+}
+
+\newcommand{\sekcjaasterysk}{%
+\vspace{10pt}%
+\begin{center}%
+\par{*}%
+\end{center}%
+}
+
+\newcommand{\separatorlinia}{%
+\vspace{10pt}%
+\hrule{}%
+\vspace{10pt}%
+}
+
+\newcommand{\motyw}[2][0]{%
+\ifshowthemes
+\mbox{}%
+\marginpar{%
+\vspace{-8pt}%
+\vspace{-#1\baselineskip}%
+\raggedright{\hspace{0pt}%
+\footnotesize{\color{theme}{#2}}}%
+\vspace{\baselineskip}%
+}%
+\fi
+}
+
+
+\newcommand{\editorialpage}[1]{%
+#1%
+\pagebreak%
+}
diff --git a/librarian/formats/pdf/res/wl2tex.xslt b/librarian/formats/pdf/res/wl2tex.xslt
new file mode 100755 (executable)
index 0000000..f36172d
--- /dev/null
@@ -0,0 +1,441 @@
+<?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:wl="http://wolnelektury.pl/functions"
+    xmlns:dc="http://purl.org/dc/elements/1.1/"
+    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
+
+<xsl:output encoding="utf-8" indent="yes" version="2.0" />
+
+<xsl:template match="utwor">
+    <TeXML xmlns="http://getfo.sourceforge.net/texml/ns1">
+        <TeXML escape="0">
+        \documentclass[<xsl:value-of select="wl:get('customization_str')"/>]{wl}
+        \usepackage{style}
+        <xsl:if test="wl:get('has_cover')">
+            \usepackage{makecover}
+        </xsl:if>
+
+        <xsl:choose>
+            <xsl:when test="wl:get('morefloats') = 'new'">
+                <TeXML escape="0">
+                    \usepackage[maxfloats=64]{morefloats}
+                </TeXML>
+            </xsl:when>
+            <xsl:when test="wl:get('morefloats') = 'old'">
+                <TeXML escape="0">
+                    \usepackage{morefloats}
+                </TeXML>
+            </xsl:when>
+            <xsl:when test="wl:get('morefloats') = 'none'" />
+            <xsl:otherwise>
+                <TeXML escape="0">
+                    \IfFileExists{morefloats.sty}{
+                        \usepackage{morefloats}
+                    }{}
+                </TeXML>
+            </xsl:otherwise>
+        </xsl:choose>
+
+        <xsl:apply-templates select="rdf:RDF" mode="titlepage" />
+        <xsl:apply-templates select="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny" mode='titlepage' />
+
+        <env name="document">
+            <xsl:if test="wl:get('has_cover')">
+                <cmd name="makecover">
+                    <parm><xsl:value-of select="210 * wl:get('cover', 'width') div wl:get('cover', 'height')" />mm</parm>
+                    <parm>210mm</parm>
+                </cmd>
+            </xsl:if>
+            <cmd name="maketitle" />
+
+            <cmd name="tytul"><parm>
+              <xsl:choose>
+                <xsl:when test="(powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny)/nazwa_utworu">
+                    <!-- title in master -->
+                    <xsl:apply-templates select="(powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny)/autor_utworu" mode="title" />
+                    <xsl:apply-templates select="(powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny)/dzielo_nadrzedne" mode="title" />
+                    <xsl:apply-templates select="(powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny)/nazwa_utworu" mode="title" />
+                    <xsl:apply-templates select="(powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny)/podtytul" mode="title" />
+                    <!-- dc in master or not -->
+                    <cmd name="translatorsline" />
+                </xsl:when>
+                <xsl:otherwise>
+                    <!-- look for author title in dc -->
+                    <xsl:apply-templates select="rdf:RDF" mode="firstdctitle" />
+                    <xsl:apply-templates select="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny" mode='firstdctitle' />
+                </xsl:otherwise>
+              </xsl:choose>
+            </parm></cmd>
+            <xsl:apply-templates select="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny" />
+            <xsl:apply-templates select="utwor" mode="part" />
+
+            <TeXML escape="0">
+                \def\coverby{
+                <TeXML escape="1">
+                <xsl:if test="wl:get('has_cover') and wl:get('wldoc', 'book_info', 'cover_by')">
+                    <!-- FIXME: should be stylable -->
+                    Okładka na podstawie: 
+                    <xsl:choose>
+                    <xsl:when test="wl:get('wldoc', 'book_info', 'cover_source')">
+                        <cmd name="href"><parm>
+                            <xsl:value-of select="wl:get('wldoc', 'book_info', 'cover_source')" />
+                        </parm><parm>
+                            <xsl:value-of select="wl:get('wldoc', 'book_info', 'cover_by')" />
+                        </parm></cmd>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:value-of select="wl:get('wldoc', 'book_info', 'cover_by')" />
+                    </xsl:otherwise>
+                    </xsl:choose>
+                </xsl:if>
+                </TeXML>
+                }
+                \def\editors{<TeXML escape="1"><xsl:call-template name="editors" /></TeXML>}
+            </TeXML>
+
+            <cmd name="editorialsection" />
+
+        </env>
+        </TeXML>
+    </TeXML>
+</xsl:template>
+
+<xsl:template match="utwor" mode="part">
+    <cmd name="tytul"><parm>
+      <xsl:choose>
+        <xsl:when test="(powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny)/nazwa_utworu">
+            <!-- title in master -->
+            <xsl:apply-templates select="(powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny)/nazwa_utworu" mode="title" />
+            <xsl:apply-templates select="(powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny)/podtytul" mode="title" />
+        </xsl:when>
+        <xsl:otherwise>
+            <!-- look for title in dc -->
+            <xsl:apply-templates select="rdf:RDF" mode="dctitle" />
+            <xsl:apply-templates select="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny" mode='dctitle' />
+        </xsl:otherwise>
+      </xsl:choose>
+    </parm></cmd>
+
+    <xsl:apply-templates select="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny" />
+    <xsl:apply-templates select="utwor" mode="part" />
+</xsl:template>
+
+<!-- =================== -->
+<!-- = MAIN TITLE PAGE = -->
+<!-- = (from DC)       = -->
+<!-- =================== -->
+
+<xsl:template match="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny" mode="titlepage">
+    <xsl:apply-templates select="rdf:RDF" mode="titlepage" />
+</xsl:template>
+
+<xsl:template match="rdf:RDF" mode="titlepage">
+    <TeXML escape="0">
+        \def\authors{<TeXML escape="1"><xsl:call-template name="authors" /></TeXML>}
+        \author{\authors}
+        \title{<TeXML escape="1"><xsl:apply-templates select=".//dc:title" mode="inline" /></TeXML>}
+        \def\translatorsline{<TeXML escape="1"><xsl:call-template name="translators" /></TeXML>}
+
+        \def\bookurl{<TeXML escape="1"><xsl:value-of select=".//dc:identifier.url" /></TeXML>}
+
+        \def\rightsinfo{<TeXML excape="1">
+            <cmd name="rightsinfostr">
+                <xsl:if test=".//dc:rights.license">
+                    <opt><xsl:value-of select=".//dc:rights.license" /></opt>
+                </xsl:if>
+                <parm><xsl:value-of select=".//dc:rights" /></parm>
+            </cmd>
+        </TeXML>}
+
+        <!-- FIXME: should be stylable -->
+        \def\sourceinfo{<TeXML excape="1">
+            <xsl:if test=".//dc:source">
+                Tekst opracowany na podstawie: <xsl:apply-templates select=".//dc:source" mode="inline" />
+                \vspace{.6em}
+            </xsl:if>
+        </TeXML>}
+        \def\description{<TeXML excape="1">
+            <xsl:apply-templates select=".//dc:description" mode="inline" /></TeXML>}
+    </TeXML>
+</xsl:template>
+
+
+<!-- ============== -->
+<!-- = BOOK TITLE = -->
+<!-- = (from DC)  = -->
+<!-- ============== -->
+
+<xsl:template match="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny" mode="dctitle">
+    <xsl:apply-templates select="rdf:RDF" mode="dctitle" />
+</xsl:template>
+
+<xsl:template match="rdf:RDF" mode="dctitle">
+    <cmd name="nazwapodutworu"><parm>
+        <xsl:apply-templates select=".//dc:title/node()" mode="inline" />
+    </parm></cmd>
+</xsl:template>
+
+<xsl:template match="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny" mode="firstdctitle">
+    <xsl:apply-templates select="rdf:RDF" mode="firstdctitle" />
+</xsl:template>
+
+<xsl:template match="rdf:RDF" mode="firstdctitle">
+    <cmd name="autorutworu"><parm><cmd name="authors"/></parm></cmd>
+    <cmd name="nazwautworu"><parm>
+        <xsl:apply-templates select=".//dc:title/node()" mode="inline" />
+    </parm></cmd>
+    <cmd name="translatorsline" />
+</xsl:template>
+
+
+<!-- ============================================================================== -->
+<!-- = MASTER TAG                                                                 = -->
+<!-- = (can contain block tags, paragraph tags, standalone tags and special tags) = -->
+<!-- ============================================================================== -->
+<!-- ==================================================================================== -->
+<!-- = BLOCK TAGS                                                                       = -->
+<!-- = (can contain other block tags, paragraph tags, standalone tags and special tags) = -->
+<!-- ==================================================================================== -->
+
+<xsl:template
+    match="powiesc|opowiadanie|liryka_l|liryka_lp|dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny|nota|dedykacja|dlugi_cytat|poezja_cyt|motto">
+    <cmd>
+        <xsl:attribute name="name">
+            <xsl:value-of select="wl:texcommand(name())" />
+        </xsl:attribute>
+        <parm><xsl:apply-templates/></parm>
+    </cmd>
+</xsl:template>
+
+<xsl:template match="lista_osob">
+    <cmd name="listaosob">
+        <parm><xsl:apply-templates select="naglowek_listy" /></parm>
+        <parm><xsl:apply-templates select="lista_osoba" /></parm>
+    </cmd>
+</xsl:template>
+
+<xsl:template match="kwestia">
+    <cmd name="kwestia">
+        <parm><xsl:apply-templates select="strofa|akap|didaskalia" /></parm>
+    </cmd>
+</xsl:template>
+
+
+<!-- ========================================== -->
+<!-- = PARAGRAPH TAGS                         = -->
+<!-- = (can contain inline and special tags)  = -->
+<!-- ========================================== -->
+
+<!-- only in root -->
+<xsl:template
+    match="autor_utworu|dzielo_nadrzedne|nazwa_utworu|podtytul"
+    mode="title">
+    <cmd>
+        <xsl:attribute name="name">
+            <xsl:value-of select="wl:texcommand(name())" />
+        </xsl:attribute>
+        <parm><xsl:apply-templates mode="inline"/></parm>
+    </cmd>
+</xsl:template>
+
+
+<xsl:template
+    match="naglowek_akt|naglowek_czesc|srodtytul|naglowek_osoba|naglowek_podrozdzial|naglowek_scena|naglowek_rozdzial|miejsce_czas|didaskalia|lista_osoba|akap|akap_dialog|akap_cd|motto_podpis|naglowek_listy">
+    <cmd>
+        <xsl:attribute name="name">
+            <xsl:value-of select="wl:texcommand(name())" />
+        </xsl:attribute>
+        <parm><xsl:apply-templates mode="inline"/></parm>
+    </cmd>
+</xsl:template>
+
+<xsl:template match="strofa">
+  <cmd name="strofa"><parm>
+    <xsl:choose>
+        <xsl:when test="count(br) > 0">
+            <xsl:call-template name="verse">
+                <xsl:with-param name="verse-content" select="br[1]/preceding-sibling::text() | br[1]/preceding-sibling::node()" />
+                <xsl:with-param name="verse-type" select="br[1]/preceding-sibling::*[name() = 'wers_wciety' or name() = 'wers_akap' or name() = 'wers_cd'][1]" />
+            </xsl:call-template>
+            <xsl:for-each select="br">
+                <TeXML escape="0">\\{}</TeXML>
+                <!-- Each BR tag "consumes" text after it -->
+                <xsl:variable name="lnum" select="count(preceding-sibling::br)" />
+                <xsl:call-template name="verse">
+                    <xsl:with-param name="verse-content"
+                        select="following-sibling::text()[count(preceding-sibling::br) = $lnum+1] | following-sibling::node()[count(preceding-sibling::br) = $lnum+1]" />
+                    <xsl:with-param name="verse-type" select="following-sibling::*[count(preceding-sibling::br) = $lnum+1 and (name() = 'wers_wciety' or name() = 'wers_akap' or name() = 'wers_cd')][1]" />
+                </xsl:call-template>
+            </xsl:for-each>
+        </xsl:when>
+        <xsl:otherwise>
+            <xsl:call-template name="verse">
+                <xsl:with-param name="verse-content" select="text() | node()" />
+                <xsl:with-param name="verse-type" select="wers_wciety|wers_akap|wers_cd[1]" />
+            </xsl:call-template>
+        </xsl:otherwise>
+    </xsl:choose>
+  </parm></cmd>
+</xsl:template>
+
+
+<xsl:template name="verse">
+    <xsl:param name="verse-content" />
+    <xsl:param name="verse-type" />
+
+    <cmd>
+        <xsl:attribute name="name">
+            <xsl:choose>
+                <xsl:when test="$verse-type != ''">
+                    <xsl:value-of select='wl:texcommand(name($verse-type))' />
+                </xsl:when>
+                <xsl:otherwise>wers</xsl:otherwise>
+            </xsl:choose>
+        </xsl:attribute>
+        <xsl:if test="string($verse-content/@typ)">
+            <opt><xsl:value-of select="$verse-content/@typ" />em</opt>
+        </xsl:if>
+        <parm><xsl:apply-templates select="$verse-content" mode="inline"/></parm>
+    </cmd>
+</xsl:template>
+
+<!-- ================================================ -->
+<!-- = INLINE TAGS                                  = -->
+<!-- = (contain other inline tags and special tags) = -->
+<!-- ================================================ -->
+
+<xsl:template mode="inline"
+    match="pa|pe|pr|pt|mat|didask_tekst|slowo_obce|wyroznienie|osoba">
+    <cmd>
+        <xsl:attribute name="name">
+            <xsl:value-of select="wl:texcommand(name())" />
+        </xsl:attribute>
+        <parm><xsl:apply-templates mode="inline"/></parm>
+    </cmd>
+</xsl:template>
+
+
+
+<xsl:template match="tytul_dziela" mode="inline">
+    <cmd name="tytuldziela"><parm>
+        <xsl:if test="@typ = '1'">„</xsl:if><xsl:apply-templates mode="inline" /><xsl:if test="@typ = '1'">”</xsl:if>
+    </parm></cmd>
+</xsl:template>
+
+
+
+<!-- ============================================== -->
+<!-- = STANDALONE TAGS                            = -->
+<!-- = (cannot contain any other tags)            = -->
+<!-- ============================================== -->
+<xsl:template
+    match="sekcja_swiatlo|sekcja_asterysk|separator_linia">
+    <cmd>
+        <xsl:attribute name="name">
+            <xsl:value-of select="wl:texcommand(name())" />
+        </xsl:attribute>
+    </cmd>
+</xsl:template>
+
+
+<!-- ================ -->
+<!-- = SPECIAL TAGS = -->
+<!-- ================ -->
+<!-- Themes -->
+
+
+<xsl:template match="begin|end|motyw">
+    <xsl:apply-templates select='.' mode="inline" />
+</xsl:template>
+
+<xsl:template match="begin" mode="inline" />
+<xsl:template match="end" mode="inline" />
+
+<xsl:template match="motyw" mode="inline">
+    <cmd name="motyw">
+        <xsl:if test="@moved">
+            <opt name="moved"><xsl:value-of select="@moved" /></opt>
+        </xsl:if>
+        <parm><xsl:apply-templates mode="inline" /></parm>
+    </cmd>
+</xsl:template>
+
+<xsl:template name="authors">
+    <xsl:for-each select=".//dc:creator_parsed">
+        <xsl:if test="position() != 1">, </xsl:if>
+        <xsl:apply-templates mode="inline" />
+    </xsl:for-each>
+</xsl:template>
+
+<xsl:template name="editors">
+    <xsl:if test="@editors">
+        <xsl:text>Opracowanie redakcyjne i przypisy: </xsl:text>
+        <xsl:value-of select="@editors" />
+        <xsl:text>.</xsl:text>
+    </xsl:if>
+</xsl:template>
+
+<xsl:template name="translators">
+    <xsl:if test=".//dc:contributor.translator_parsed">
+        <cmd name='translator'><parm>
+            <xsl:for-each select=".//dc:contributor.translator_parsed">
+                <xsl:if test="position() != 1">, </xsl:if>
+                <xsl:apply-templates mode="inline" />
+            </xsl:for-each>
+        </parm></cmd>
+    </xsl:if>
+</xsl:template>
+
+
+<!-- ============== -->
+<!-- = ADDED TAGS = -->
+<!-- ============== -->
+
+
+<xsl:template match="dywiz" mode="inline">
+    <cmd name="dywiz" />
+</xsl:template>
+
+<xsl:template match="nbsp" mode="inline">
+    <spec cat="tilde" />
+</xsl:template>
+
+<xsl:template match="alien" mode="inline">
+    <group>
+        <cmd name="alien" />
+        <xsl:apply-templates mode="inline" />
+    </group>
+</xsl:template>
+
+<!-- ================ -->
+<!-- = IGNORED TAGS = -->
+<!-- ================ -->
+<xsl:template match="extra|uwaga" />
+<xsl:template match="extra|uwaga" mode="inline" />
+
+<xsl:template match="nota_red" />
+
+<!-- ======== -->
+<!-- = TEXT = -->
+<!-- ======== -->
+<xsl:template match="text()" />
+<xsl:template match="text()" mode="inline">
+    <xsl:if test="preceding-sibling::node() and wl:starts_white(.)">
+      <xsl:text> </xsl:text>
+    </xsl:if>
+
+    <xsl:value-of select="wl:substitute_entities(wl:strip(.))" />
+
+    <xsl:if test="following-sibling::node() and wl:ends_white(.)">
+      <xsl:text> </xsl:text>
+    </xsl:if>
+</xsl:template>
+
+
+</xsl:stylesheet>
diff --git a/milpdf/a.xml b/milpdf/a.xml
new file mode 100644 (file)
index 0000000..460f9ff
--- /dev/null
@@ -0,0 +1,4 @@
+<section xmlns="http://nowoczesnapolska.org.pl/sst#" xmlns:dc="http://purl.org/dc/elements/1.1/"><metadata><dc:publisher>Modern Poland Foundation</dc:publisher><dc:description></dc:description><dc:language>english</dc:language><dc:rights>Creative Commons Attribution – Share Alike</dc:rights><dc:audience>18+</dc:audience><dc:relation.coverimage.url>https://farm6.staticflickr.com/5308/5729009434_0038a5a6fb_o.jpg</dc:relation.coverimage.url></metadata>
+                
+                <header>Relations in the media environment</header><header>I</header><div class="list"><div class="item"> knows how to consciously create her image depending on needs or a recipient; e.g. knows how to use words and body language during lectures.</div><div class="item"> can react in a crisis situation concerning her image, e.g. demands deleting untrue information about her by sending corrections to website's administrators. </div></div><header class="">I and others</header><div class="list"><div class="item">can convince others through media, adjusting the message to its recipient and to the goal of the communication, e.g. knows how to discuss about an article, without offending the interlocutor. </div><div class="item">can influence others thanks to proper language and chosen channels of communication, e.g. can convince friends from social media to social activism on the university. </div><div class="item">knows that communication through media has its limitations and can counteract them, e.g. calls or talks directly if chat on instant messenger is not possible/ </div><div class="item">is aware that some recipients of her messages may be less competent. Can adjust her messages to recipients' capabilities, e.g. knows that some scholars rarely check their e-mails, so when necessary is able to find other effective means of communication. </div></div><header class="">I and environment</header><div class="list"><div class="item">knows the internet and reality permeat each other, and rules of human relationships are very similar, e.g. knows that group work when done remotely requires the same commitment as in person. </div><div class="item">knows that part of social life happens through media, e.g. knows that a party may happen on the internet. </div><div class="item">can plan and activate a group via different, virtual and real media, e.g. coordinates the preparations to student self-government elections. </div></div>
+                </section>
diff --git a/milpdf/m.xml b/milpdf/m.xml
new file mode 100644 (file)
index 0000000..b391d62
--- /dev/null
@@ -0,0 +1,151 @@
+<section xmlns:dc="http://purl.org/dc/elements/1.1/">
+    <metadata>
+           <dc:audience>przedszkole</dc:audience>
+           <dc:creator>Zuzanna Zasacka</dc:creator>
+           <dc:creator>Izabela Machnowska</dc:creator>
+
+        <dc:creator.scenario>Zuzanna Zasacka</dc:creator.scenario>
+        <dc:creator.methodologist>Izabela Machnowska</dc:creator.methodologist>
+        <dc:type>course</dc:type>
+        <dc:description>Publikacja zrealizowana w ramach projektu Cyfrowa Przyszłość, dofinansowanego ze środków Ministerstwa Kultury i Dziedzictwa Narodowego.</dc:description>
+        <dc:subject.curriculum>2014/0/wychowanie-przedszkolne/c7</dc:subject.curriculum>
+        <dc:relation.coverimage.url>http://milpeer.mdrn.pl/media/dynamic/uploads/13/3512808721_202609103f_b.jpg</dc:relation.coverimage.url>
+  </metadata>
+
+  <aside class="editorial">
+         <div class="p">Here be custom editorial information.</div>
+  </aside>
+
+  <header>Animacja - robimy film rysunkowy</header>
+  <section>
+    <header>Wiedza w pigułce<aside class="comment">Krótkie wprowadzenie zagadnienia dla osoby prowadzącej. Na potrzeby scenariuszy dla SP 1-3 i przedszkola wykorzystujemy już te opublikowane w serwisie. Poniżej wklej link do lekcji, której pigułka najlepiej odpowiada tematowi zajęć. </aside>
+    </header><div class="p">Porównanie sposobu zaprezentowania informacji w wielu różnych źródłach pozwala na celniejszą ocenę, który materiał będzie dla ciebie najprzydatniejszy. Sprzyja również krytycznemu spojrzeniu na dostępne źródła — dzięki temu łatwiej możemy wskazać intencję nadawcy, a także stopień wiarygodności przekazu.  </div><div class="p">Jednym z najważniejszych czynników kształtujących przekazy medialne jest intencja nadawcy — a więc to, co chciał osiągnąć poprzez rozpowszechnienie utworu czy tekstu. Wpływa na nią nie tylko cel czy funkcja komunikatu (np. zareklamowanie, przekonanie do danego poglądu czy informowanie), lecz także jego grupa docelowa. W inny sposób mówi się do młodzieży, w inny do dorosłych; w inny do znawców dziedziny, inaczej do laików.  </div><div class="p">Rzadko kiedy zdarzają się bezstronne artykuły, a i one przekazują tylko wybrane informacje na dany temat. Oddzielenie opinii od faktów jest kluczowe w krytycznej ocenie tekstów. Dzięki niej możesz uniknąć manipulacji, a także nieświadomego przyjmowania perspektywy autora. Większość materiałów dostępnych w internecie zawiera opinie ich twórców. Nawet jeśli na pierwszy rzut oka artykuł jest informacyjny, podczas uważnej lektury można dostrzec wyznaczniki subiektywnego punktu widzenia.  </div><div class="p">Zlewanie się informacji i opinii łatwo zaobserwować w reklamach. Z jednej strony opowiadają one o produkcie, z drugiej zaś przedstawiają jego subiektywną ocenę. Podczas odbioru przekazów medialnych warto zwracać uwagę na pojawianie się takich oceniających określeń.  </div><div class="p">Na to, w jaki sposób prezentowane są informacje, wpływają nie tylko opinie autorów. Również zastosowany gatunek medialny narzuca określony sposób mówienia o danym temacie: czego innego oczekujemy od felietonu, a czego innego od radiowego wydania wiadomości. Charakter i ograniczenia źródła zależą również od kanału komunikacyjnego, np. informacje zamieszczone w internecie są często aktualniejsze niż książki. Nie mogą one również oddziaływać na zmysł słuchu, w przeciwieństwie do radia czy telewizji.  </div><div class="p">Warto jednocześnie pamiętać, że do niektórych źródeł można dotrzeć poprzez różne kanały komunikacyjne. Dotyczy to m. in. codziennej prasy, drukowanej i udostępnianej w sieci.  </div><div class="p">Niezależnie od różnych czynników wpływających na kształt przekazów, najważniejszym kryterium ich oceny jest zawsze ich wiarygodność. </div>
+  </section>
+  <section><metadata><dc:audience>teacher</dc:audience></metadata>
+    
+    <header>Pomysł na lekcję<aside class="comment">W 1-2 zdaniach opisz temat i cel lekcji, ew. główne aktywności uczestników i uczestniczek. Postaraj się zaciekawić nauczyciela tematem!</aside>
+    </header>
+<div class="p">Podczas zajęć dzieci spróbują zrobić własny, krótki film animowany. Na początku narysują po kolei każdą klatkę, po czym "historia" zostanie sfilmowana przez prowadzącego. </div>
+    <section>
+      <header>Cele operacyjne<aside class="comment">Cele są ustalane na spotkaniu redakcyjnym zespołu. Mogą odnosić się zarówno do umiejętności, jak i postaw.</aside>
+      </header>
+<div class="p">
+        Uczestnicy i uczestniczki:
+        <div class="list.itemized"><div class="item">wiedzą, czym jest film rysunkowy; </div><div class="item">wiedzą, za pomocą jakich narzędzi medialnych można przygotować taki film;<aside class="comment"><metadata><dc:creator>olasekula (aleksandra.sekula@wolnepodreczniki.pl)</dc:creator><dc:date>22-08-2014 16:14:14</dc:date></metadata>,,za pomocą jakich narzędzi medialnych można przygotować rysunek" - kartki i kredek nie nazwałabym narzędziemi medialnymi, więc zmieniam: rysunek -&gt; film rysunkowy</aside></div><div class="item">wiedzą, że proste treści medialne można przetwarzać.</div>
+      </div>
+    </div></section>
+    <section>
+      <header>Przebieg zajęć<aside class="comment">Kolejne ćwiczenia możesz dodać wybierając w górnym menu szablon "sekcja przebiegu zajęć" i klikając "+". Zwracaj się bezpośrednio do osoby prowadzącej zajęcia (np. pokaż, opowiedz, podziel itd.). Unikaj opisywania czynności uczestników (np. grupy wymyślają). Pamiętaj, że scenariusz może być wykorzystywany nie tylko w przedszkolu lub szkole. Każde zajęcia mogą trwać maks. 45 min. </aside>
+      </header>
+<section>
+        <header>1.   <aside class="comment"><metadata><dc:creator>izabelamach (machizabela@gmail.com)</dc:creator><dc:date>04-07-2014 10:02:44</dc:date></metadata>Poproś dzieci ,aby spróbowały wymienić tytuły filmów animowanych ,które oglądały w domu lub w przedszkolu.
+2.Zabawa ruchowa "Słoneczko się budzi,słoneczko zasypia".W miejscu przeznaczonym do ćwiczeń ruchowych dzieci wraz z nauczycielem siedzą w dużym ,wspólnym kole- siad skrzyżny, dłonie na kolanach,głowa opuszczona w dół.Na hasło nauczyciela "film" każde dziecko, kolejno (zaczynając od pierwszego po prawej stronie nauczyciela)) kładzie się na podłogę
+("przykleja" plecy do podłogi),i mocno naprężone i wyciągnięte ręce kładzie równolegle wzdłuż głowy ("przykleja ręce do podłogi") imitując tym samym promyki słońca.Kiedy wszystkie dzieci wykonały już swoje ruchy i całe "otwarte",duże słońce z promykami leży na podłodze nauczyciel ponownie wypowiada hasło "film",a dzieci kolejno wracają do pozycji wyjściowej (słoneczko zasypia).UWAGA! Ćwiczenie należy zrobić bardzo płynnie,bez przerw, jakby we wspólnym rytmie, chodzi tu o uzyskanie tzw."efektu fali".Żeby doprowadzić je do oczekiwanego rezultatu ,powtórz je kilka razy.Jeśli masz czas,poproś wybrane dziecko o nakręcenie tego filmiku na komórkę.Czas 10 min.</aside><aside class="comment"><metadata><dc:creator>izabelamach (machizabela@gmail.com)</dc:creator><dc:date>04-07-2014 10:11:43</dc:date></metadata>Zapisać to ćwiczenie jako punkt 3 scenariusza.Proszę dodać ,że pracujemy przy stolikach.Skrócić czas do 10 min.</aside> </header><div class="p">Poproś dzieci, aby spróbowały wymienić tytuły filmów animowanych, które oglądały w domu lub w przedszkolu.</div>
+        <div class="list.definitions">
+          <div class="item"><div class="defined">Czas</div>
+<aside class="comment">Wpisz liczbę minut (sama liczba, bez "min").</aside>
+            5
+          </div>
+          <div class="item"><div class="defined">Metoda</div>
+<aside class="comment">Wpisz metodę pracy. Zobacz, czy jest już opisana na http://edukacjamedialna.edu.pl/lekcje/metody. Jeśli nie, przygotuj krótki opis i prześlij koordynatorce projektu.</aside>
+            rozmowa
+          </div>
+          <div class="item"><div class="defined">Pomoce</div>
+<aside class="comment">Wypisz przedmioty oraz materiały dodatkowe (np. karty pracy) potrzebne do przeprowadzenia zajęć. Staraj się przygotowywać lekcje, które nie wymagają korzystania ze sprzętu. Jeśli planujesz wykorzystanie komputerów napisz, ile ma ich być (np. jeden na parę), czy muszą być podłączone do internetu itd.</aside>
+            
+          </div>
+        </div>
+      </section><section>
+        <header>2. <aside class="comment"><metadata><dc:creator>izabelamach (machizabela@gmail.com)</dc:creator><dc:date>04-07-2014 10:33:09</dc:date></metadata>Wydaje mi się,że dzieci będą miały trochę kłopot z tym zadaniem bo jesli będą miały w swoim notesiku kilkadziesiąt kartek, a na każdej mają dorysować jeden promyk więcej to będą je liczyć i się pogubią.Może bezpieczej stworzyć jeden wspólny film,a pracę podzielić przy stolikach np.przy pierwszym stoliku dzieci dorysowują po dwa promyczki na każdej kartce, przy drugim stoliku dzieci rysują po pięć promyków,przy trzecim "mnóstwo","dużo"promyków.Jeśli dzieci jest więcej nauczyciel w czasie wykonywania prac dzieci, zbiera już gotowe kartki z dorysowanymi promykami i na bieżąco zanosi je do czwartego stolika gdzie rysowane są tylko buźki smutne lub wesołe.
+To ćwiczenie proszę zapisać jako punkt 3 scenariusza.Czas 10 min.</aside><aside class="comment"><metadata><dc:creator>izabelamach (machizabela@gmail.com)</dc:creator><dc:date>04-07-2014 10:34:47</dc:date></metadata>4.Zabawa  dźwiękonaśladowcza " Ciszej głośniej".Nauczyciel tworzy z dziećmi muzykę do filmu.W tym celu ćwiczy z dziećmi odgłosy znane dzieciom ze środowiska naturalnego np: wiatr (szszszszszszszsz),konik (tzw."języczki),pies (hau,hau) itp.W tym ćwiczeniu ważne jest,aby dzieci nie "przekrzykiwały się" oraz zwracały uwagę na dynamikę (głośniej ,ciszej) którą wskazuje nauczyciel dyrygując rękami.Czas 5 min.</aside><aside class="comment"><metadata><dc:creator>izabelamach (machizabela@gmail.com)</dc:creator><dc:date>04-07-2014 11:04:21</dc:date></metadata>Zapisać to ćwiczenie jako punkt 5 scenariusza.Wydaje mi się, że prościej będzie nakręcić jeden film z przygotowanych wczesniej "słoneczkowych" kartek ale, w różnych wersjach np:za pierwszym razem Janek kciukiem kartkuje rysunki,nauczyciel kręci film  dziewczynki imitują głosem podkład dźwiękowy 'wiatr",za drugim razem Piotrek kręci film ,Ania kartkuje kciukiem,a chłopcy robią podkład dźwiękowy "koniki"itd.Na koniec wspólnie wybieramy najlepszą wersję.Czas 15 min.</aside> </header><div class="p">Zabawa ruchowa ,,Słoneczko się budzi, słoneczko zasypia". W miejscu przeznaczonym do ćwiczeń ruchowych dzieci wraz z nauczycielem siedzą w dużym, wspólnym kole - siad skrzyżny, dłonie na kolanach, głowa opuszczona w dół. Na hasło nauczyciela ,,film" każde dziecko kolejno (zaczynając od pierwszego po prawej stronie nauczyciela) kładzie się na podłogę (,,przykleja" plecy do podłogi) i mocno naprężone i wyciągnięte ręce kładzie równolegle wzdłuż głowy (,,przykleja" ręce do podłogi), imitując tym samym promyk słońca. Kiedy wszystkie dzieci wykonały już swoje ruchy i całe ,,otwarte", duże słońce z promykami leży na podłodze, nauczyciel ponownie wypowiada hasło ,,film", a dzieci kolejno wracają do pozycji wyjściowej (słoneczko zasypia). UWAGA! Ćwiczenie należy wykonać bardzo płynnie, bez przerw, we wspólnym rytmie - chodzi tu o uzyskanie tzw. ,,efektu fali". Żeby doprowadzić do oczekiwanego rezultatu, powtórz ćwiczenie kilka razy. Jeśli masz czas, poproś wybrane dziecko o nakręcenie komórką dokumentującego zabawę filmiku.</div>
+        <div class="list.definitions">
+          <div class="item"><div class="defined">Czas</div>
+            10
+          </div>
+          <div class="item"><div class="defined">Metoda</div>
+            zabawa
+          </div>
+          <div class="item"><div class="defined">Pomoce</div>
+            <aside class="comment"><metadata><dc:creator>zuzannazasacka (zuzanna.zasacka@gmail.com)</dc:creator><dc:date>09-06-2014 00:59:59</dc:date></metadata>pytanie czy możemy zalecać dość spory zakup, jakim są notesiki, może to przekroczyć 20 zł i wiąże się w zaangażowaniem nauczyciela...</aside><aside class="comment"><metadata><dc:creator>zuzannazasacka (zuzanna.zasacka@gmail.com)</dc:creator><dc:date>09-06-2014 01:08:09</dc:date></metadata>rozwinięty komentarz na ten temat znajduje si przy rubryce "Materiały"</aside>
+          </div>
+        </div>
+        <div class="p"> - </div>
+      </section><section>
+        <header>3.  </header><div class="p">Rozdaj każdemu dziecku kartkę formatu A5 z narysowanym przez ciebie przedtem kółkiem na środku. Podziel dzieci na grupy stolikami. Przy pierwszym stoliku dzieci dorysowują po dwa promyczki na każdej kartce, przy drugim stoliku dzieci rysują po pięć promyków, przy trzecim ,,mnóstwo", ,,dużo" promyków. Jeśli dzieci jest więcej, nauczyciel, w czasie wykonywania przez dzieci prac, zbiera już gotowe kartki z dorysowanymi promykami i na bieżąco zanosi je do czwartego stolika, gdzie rysowane są tylko smutne lub wesołe buźki. Pod koniec zepnij wszystkie kartki spinaczem (typu czarny metalowy klips).</div>
+        <div class="list.definitions">
+          <div class="item"><div class="defined">Czas</div>
+            10
+          </div>
+          <div class="item"><div class="defined">Metoda</div>
+            zabawa
+          </div>
+          <div class="item"><div class="defined">Pomoce</div>
+            kartki A5 dla każdej uczestniczki/uczestnika, kredki
+          </div>
+        </div>
+        <div class="p"></div>
+      </section><section>
+        <header>4. </header><div class="p">Zabawa dźwiękonaśladowcza ,,Ciszej - głośniej". Nauczyciel tworzy z dziećmi muzykę do filmu. W tym celu ćwiczy z dziećmi odgłosy znane dzieciom ze środowiska naturalnego np: wiatr (szszszszszszszsz), konik (tzw. ,,języczki"), pies (hau,hau), kraczące wrony, szczekające psy na wsi, itp. W tym ćwiczeniu ważne jest, aby dzieci nie przekrzykiwały się nawzajem oraz zwracały uwagę na dynamikę (głośniej, ciszej), którą wskazuje nauczyciel, dyrygując rękami.</div>
+        <div class="list.definitions">
+          <div class="item"><div class="defined">Czas</div>
+            <div class="defined">5</div>
+          </div>
+          <div class="item"><div class="defined">Metoda</div>
+            zabawa
+          </div>
+          <div class="item"><div class="defined">Pomoce</div>
+            
+          </div>
+        </div>
+</section><section>
+        <header>5. </header><div class="p">Spróbuj nakręcić film z dziecięcych animacji. Będziesz potrzebował/a urządzenia z funkcją filmowania (aparatu lub komórki). Najlepiej uchwycić moment kartkowania. Każdy filmik będzie miał parę sekund. Nakręćcie różne wersje filmu. Np.: za pierwszym razem Janek kciukiem kartkuje rysunki, nauczyciel kręci film, dziewczynki imitują głosem podkład dźwiękowy ,,wiatr", za drugim razem Piotrek kręci film, Ania kartkuje kciukiem, a chłopcy robią podkład dźwiękowy ,,koniki" itd. Na koniec wspólnie wybierzcie najlepszą wersję.</div><header></header>
+        <div class="list.definitions">
+          <div class="item"><div class="defined">Czas</div>
+            <div class="defined">15</div>
+          </div>
+          <div class="item"><div class="defined">Metoda</div>
+            zabawa
+          </div>
+          <div class="item"><div class="defined">Pomoce</div>
+            komórka lub aparat z funkcją nagrywania
+          </div>
+        </div>
+        <div class="p"></div>
+</section>
+    </section>
+    <section>
+      <header>Ewaluacja<aside class="comment">Zapisz pytania, które pomogą osobie prowadzącej sprawdzić, czy cele zajęć zostały zrealizowane.</aside>
+      </header>
+<div class="p">Czy po przeprowadzeniu zajęć ich uczestnicy i uczestniczki:
+    <div class="list.itemized"><div class="item">umieją, przy wsparciu dorosłych, pokazać grupie efekty samodzielnego tworzenia i przetwarzania komunikatów?</div></div>
+    </div>
+    </section>
+    <section>
+      <header>Opcje dodatkowe<aside class="comment">Jak można rozwinąć lub zmodyfikować scenariusz? Jeśli w podstawowym pomyśle przewidujesz wykorzystanie sprzętu, opisz, jak można zrealizować zajęcia bez komputerów.</aside>
+</header>
+<div class="p">Jeśli masz więcej czasu, w pierwszym zadaniu możesz pokazać starszym przedszkolakom znaleziony w internecie przykładowy filmik o tym, jak powstaje film animowany. Najlepiej, gdy będzie to jakaś popularna wśród dzieci produkcja.</div><div class="p"></div>
+    </section>
+  </section>
+  <section>
+    <header>Słowniczek<aside class="comment">Wypisz wszystkie pojęcia, które pojawiają się w trakcie lekcji, a mogą nie być zrozumiałe dla uczestników. Jeśli pojęcie nie ma swojej definicji na http://edukacjamedialna.edu.pl/lekcje/slowniczek-sp napisz w nawiasie "brak definicji". Słowniczek tworzymy z myślą o osobie prowadzącej.</aside>
+    </header>
+<div class="list.definitions" src="http://edukacjamedialna.edu.pl/lekcje/slowniczek-sp/">
+      <div class="item">
+        <div class="defined">wiarygodność</div>
+        cecha tego, co wiarygodne, czyli rzetelne i godne zaufania
+      </div>
+      <div class="item">        
+      <div class="defined">źródło informacji</div>
+        każdy przedmiot z którego czerpie się wiadomości na interesujący nas temat
+      </div>
+    </div>
+  </section>
+  <section>
+    <header>Czytelnia<aside class="comment">Wpisz dodatkowe źródła, z których może skorzystać osoba prowadząca przygotowująca się do zajęć.</aside>
+    </header>
+<div class="list.bibliography">
+      <div class="item">"Animacja i jej rodzaje" w Samouczku na stronie Muzuem Animacji Semafor [dostęp: 21.01.2015], dostępny w internecie: <span class="link" href="http://muzeum.se-ma-for.com/samouczek/animacja-i-jej-rodzaje-pl">http://muzeum.se-ma-for.com/samouczek/animacja-i-jej-rodzaje-pl</span></div>
+      <div class="item">    " Jak to działa, czyli przygotuj własną animację" [dostęp: 21.01.2015], dostępny w internecie: <span class="link" href="http://www.nina.gov.pl/edukacja/pracownia/artyku%C5%82/2012/05/30/jak-to-dziala---czyli-przygotuj-wlasna-animacje_">http://www.nina.gov.pl/edukacja/pracownia/artyku%C5%82/2012/05/30/jak-to-dziala---czyli-przygotuj-wlasna-animacje_</span></div>
+    </div>
+  </section>
+</section>
diff --git a/milpdf/p.xml b/milpdf/p.xml
new file mode 100644 (file)
index 0000000..190fed2
--- /dev/null
@@ -0,0 +1,56 @@
+<section xmlns="http://nowoczesnapolska.org.pl/sst#" xmlns:dc="http://purl.org/dc/elements/1.1/"><metadata><dc:publisher></dc:publisher><dc:description></dc:description><dc:language>eng</dc:language><dc:rights></dc:rights><dc:audience>Children</dc:audience><dc:relation.coverimage.url>http://milpeer.mdrn.pl/media/dynamic/uploads/27/smartie.png</dc:relation.coverimage.url><dc:creator>An Author</dc:creator></metadata>
+
+<aside class="editorial">
+       <div class="p">This is the place where any editorial information can be put.</div>
+       <div class="p">It's just a piece of document.</div>
+</aside>
+
+                <header>The adventures of Smartie the Penguin</header>
+                
+                <section>
+                    <div class="p">It was late at night and Smartie the Penguin was 
+WIDE awake... He was supposed to be fast asleep 
+but tomorrow was his birthday. He was so 
+excited; all he wanted was a new computer! </div>
+                    <div class="img" src="/media/dynamic/uploads/27/2.png"></div>
+                </section>
+                
+                <section>
+                    <div class="p">The big day came and Smartie had really enjoyed 
+his birthday party. He had saved his biggest and 
+most exciting looking present until the very end, 
+“Oh please, please, please!” he thought as he 
+began to open it.</div>
+                    <div class="img" src="/media/dynamic/uploads/27/3.png"></div>
+                </section>
+                
+                <section>
+                    <div class="p">Smartie tore off the 
+wrapping paper in a hurry, 
+it was exactly what he 
+wanted, a brand new 
+laptop!</div>
+                    <div class="img" src="/media/dynamic/uploads/27/1.png"></div>
+                    <div class="p">“Oh! Thank 
+you, thank you, 
+thank you!” He 
+cried.</div>
+                    <div class="img" src="/media/dynamic/uploads/27/4.png"></div>
+                </section>
+                
+                <section>
+                    <div class="p">Daddy Penguin was 
+extremely clever and 
+knew all about 
+computers and how to 
+get on to the internet. 
+He helped Smartie to 
+find his favourite 
+website and soon 
+Smartie was happily 
+playing a game online.</div>
+                    <div class="img" src="/media/dynamic/uploads/27/5.png"></div>
+                </section>
+                
+
+                </section>