"""Represents a WL URI. Extracts slug from it."""
slug = None
- example = 'http://edukacjamedialna.edu.pl/'
- _re_wl_uri = re.compile(r'http://(www\.)?edukacjamedialna.edu.pl/(lekcje/)?'
+ example = 'http://edukacjamedialna.edu.pl/lekcje/template'
+ _re_wl_uri = re.compile(r'http://(www\.)?edukacjamedialna.edu.pl/lekcje/'
'(?P<slug>[-a-z0-9]+)/?$')
def __init__(self, uri):
"""Contructs an URI from slug.
>>> WLURI.from_slug('a-slug').uri
- u'http://wolnelektury.pl/katalog/lektura/a-slug/'
+ u'http://edukacjamedialna.edu.pl/lekcje/a-slug/'
"""
- uri = 'http://prawokultury.pl/publikacje/%s/' % slug
+ uri = 'http://edukacjamedialna.edu.pl/lekcje/%s/' % slug
return cls(uri)
def __unicode__(self):
def __str__(self):
return self.uri
+ def canonical(self):
+ return type(self).from_slug(self.slug)
+
def __eq__(self, other):
return self.slug == other.slug
\ifenablewlfont
\setmainfont [
%ExternalLocation,
-UprightFont = JunicodeWL-Regular,
-ItalicFont = JunicodeWL-Italic,
-BoldFont = JunicodeWL-Regular,
-BoldItalicFont = JunicodeWL-Italic,
-SmallCapsFont = JunicodeWL-Regular,
+UprightFont = Dosis-Regular,
+ItalicFont = Dosis-SemiBold,
+BoldFont = Dosis-Bold,
+BoldItalicFont = Dosis-Bold,
+SmallCapsFont = Dosis-Regular,
SmallCapsFeatures = {Letters={SmallCaps,UppercaseSmallCaps}},
Numbers=OldStyle,
Scale=1.04,
LetterSpace=-1.0
-] {JunicodeWL}
+] {Dosis}
\newfontfamily\alien[
SmallCapsFeatures = {Letters={SmallCaps,UppercaseSmallCaps}},
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
-\lfoot{{\footnotesize \textsc{\@author} \emph{\@title}}}
+\lfoot{{\footnotesize \@author{} \emph{\@title}}}
\cfoot{}
\rfoot{{\footnotesize \thepage}}
}%
\fi
}
-
-%% EDUMED SPECIFIC
-
-\newcommand{\activitycounter}[1]{\vspace{1em}\par{\huge{#1}}}
-
-\newcommand{\activityinfo}[1]{\begin{flushright}\parbox[t]{2in}{#1}\end{flushright}}
-\newcommand{\activitytime}[1]{Czas: #1 min \\}
-\newcommand{\activityform}[1]{Forma: #1 \\}
-\newcommand{\activitytools}[1]{#1 \\}
-
-\newcommand*\checkbox{\item[\Square]}
-\newcommand*\radio{\item[\Circle]}
-
-
-\renewcommand{\naglowekrozdzial}[1]{%
-\subsection*{\typosubsection{#1}}%
-}
-
-\renewcommand{\naglowekpodrozdzial}[1]{%
-\subsubsection*{\typosubsubsection{#1}}%
-}
-
-\newcommand{\obraz}[1]{
-\includegraphics[width=8cm]{#1}
-}
-
-\newcommand{\video}[2]{
-\includegraphics[width=8cm]{#1}\\
-\href{#2}{(Otwórz wideo w serwisie YouTube)}
-}
u'</cmd>'
@escape(True)
- def get_authors(self, element):
- authors = self.get_dc(element, 'creator.expert') + \
- self.get_dc(element, 'creator.scenario') + \
- self.get_dc(element, 'creator.textbook')
- return u', '.join(authors)
+ def get_authors(self, element, which=None):
+ dc = self.options['wldoc'].book_info
+ if which is None:
+ authors = dc.authors_textbook + \
+ dc.authors_scenario + \
+ dc.authors_expert
+ else:
+ authors = getattr(dc, "authors_%s" % which)
+ return u', '.join(author.readable() for author in authors)
@escape(1)
def get_title(self, element):
\\usepackage{morefloats}
}{}'''),
u'''\\def\\authors{%s}''' % self.get_authors(element),
+ u'''\\def\\authorsexpert{%s}''' % self.get_authors(element, 'expert'),
+ u'''\\def\\authorsscenario{%s}''' % self.get_authors(element, 'scenario'),
+ u'''\\def\\authorstextbook{%s}''' % self.get_authors(element, 'textbook'),
+
u'''\\author{\\authors}''',
u'''\\title{%s}''' % self.get_title(element),
- u'''\\def\\bookurl{%s}''' % self.get_dc(element, 'identifier.url', True),
+ u'''\\def\\bookurl{%s}''' % self.options['wldoc'].book_info.url.canonical(),
u'''\\def\\rightsinfo{%s}''' % self.get_rightsinfo(element),
u'</TeXML>']
return u"""
<env name="document">
<cmd name="maketitle"/>
- """, """</env>"""
+ """, """<cmd name="editorialsection" /></env>"""
@escape(1)
def handle_texcommand(self, element):
counter = self.activity_counter
return u"""
-
+<cmd name="noindent" />
<cmd name="activitycounter"><parm>%(counter)d.</parm></cmd>
<cmd name="activityinfo"><parm>
<cmd name="activitytime"><parm>%(czas)s</parm></cmd>
surl = 'http://edukacjamedialna.edu.pl/slowniczek'
sxml = None
if surl:
- sxml = etree.fromstring(self.options['provider'].by_uri(surl).get_string())
+ sxml = etree.fromstring(self.options['wldoc'].provider.by_uri(surl).get_string())
self.options = {'slowniczek': True, 'slowniczek_xml': sxml }
listcmd = {'num': 'enumerate',
else:
return cmd('href', parms=[element.attrib['url']])(self, element)
else:
- return cmd('em')(self, element)
+ return cmd('emph')(self, element)
def handle_obraz(self, element):
frmt = self.options['format']
class EduModulePDFFormat(PDFFormat):
+ style = get_resource('res/styles/edumed/pdf/edumed.sty')
+
def get_texml(self):
self.attachments = {}
edumod = EduModule({
- 'provider': self.wldoc.provider,
+ "wldoc": self.wldoc,
"format": self,
"teacher": self.customization.get('teacher'),
})
def get_tex_dir(self):
temp = super(EduModulePDFFormat, self).get_tex_dir()
+ shutil.copy(get_resource('res/styles/edumed/logo.png'), temp)
for name, iofile in self.attachments.items():
iofile.save_as(os.path.join(temp, name))
return temp
--- /dev/null
+
+\newcommand{\activitycounter}[1]{\vspace{1em}\par{\huge{#1}}}
+
+\newcommand{\activityinfo}[1]{\begin{flushright}\parbox[t]{2in}{#1}\end{flushright}}
+\newcommand{\activitytime}[1]{Czas: #1 min \\}
+\newcommand{\activityform}[1]{Forma: #1 \\}
+\newcommand{\activitytools}[1]{#1 \\}
+
+\newcommand*\checkbox{\item[\Square]}
+\newcommand*\radio{\item[\Circle]}
+
+
+\renewcommand{\naglowekrozdzial}[1]{%
+\subsection*{\typosubsection{#1}}%
+}
+
+\renewcommand{\naglowekpodrozdzial}[1]{%
+\subsubsection*{\typosubsubsection{#1}}%
+}
+
+\newcommand{\obraz}[1]{
+\includegraphics[width=8cm]{#1}
+}
+
+\newcommand{\video}[2]{
+\includegraphics[width=8cm]{#1}\\
+\href{#2}{(Otwórz wideo w serwisie YouTube)}
+}
+
+\renewcommand{\maketitle}{
+ {
+ \thispagestyle{empty}
+ \footnotesize
+ \color{theme}
+
+ \noindent \begin{minipage}[t]{.35\textwidth}\vspace{0pt}
+ \href{http://edukacjamedialna.edu.pl}{\xbox{\includegraphics[width=\textwidth]{logo.png}}}
+ \end{minipage}
+
+ \vspace{.6em}
+ \color{black}
+ }
+}
+
+\newcommand{\rightsinfostr}[2][] {
+ \ifx&%
+ #2
+ \else
+ Udostępniono na licencji \href{#1}{#2}.
+ \fi
+}
+
+\newcommand{\editorialsection}{
+ \begin{figure}[b!]
+ {
+ \footnotesize
+ \color{theme}
+ \noindent \rule{\linewidth}{0.4pt}
+
+ \rightsinfo
+ \vspace{.6em}
+
+
+Tekst: \authorstextbook, scenariusz: \authorsscenario, konsultacja merytoryczna: \authorsexpert.
+Materiał pochodzi z serwisu \href{http://edukacjamedialna.edu.pl}{edukacjamedialna.edu.pl} prowadzonego przez
+\href{http://nowoczesnapolska.org.pl}{Fundację Nowoczesna Polska}.
+
+\vspace{.6em}
+\rightsinfo
+
+\vspace{.6em}
+Źródło: \href{\bookurl}{\bookurl}.
+
+ \color{black}
+ }
+ \end{figure}
+}