Commits

Peter Ward committed 7ec5d65

Removing useless stuff, merging pango.py and text.py.

  • Participants
  • Parent commits 72f3567

Comments (0)

Files changed (4)

File shinypress/hacks.py

-import os.path
-
-def background(filename):
-    if filename:
-        f = open(filename, 'rb')
-        filename = os.path.basename(f.name)
-        source = r'\setbackground{%s}' % (filename,)
-        return (source, [f])
-    return (r'\setbackground{}', [])
-

File shinypress/images.py

-import os.path
-from shinypress.jinja import env
-from glob import glob
-
-template = env.from_string(r"""
-%% for filename in images %%
-\begin{frame}
-\begin{list}{}{%
-\setlength{\leftmargin}{-1.5em}%
-\setlength{\rightmargin}{-1.5em}%
-}%
-\item[]{\begin{center}
-\includegraphics[width=\linewidth,height=\textheight-.25em,keepaspectratio]{<filename>}
-\end{center}}
-\end{list}
-\end{frame}
-%% endfor %%
-""")
-
-def render(directory):
-    directory = os.path.abspath(directory)
-    images = sorted(glob(os.path.join(directory, "*.jpg")))
-    return (template.render(images=images), [])
-

File shinypress/pango.py

+import codecs
+
+from shinypress.utils import group_paragraphs
+
 def replace_all(s, o, n):
     while o in s:
         s = s.replace(o, n)
 
     return content
 
+def render(filename):
+    source = codecs.open(filename, 'rU', 'utf-8')
+    source = (line[:-1] for line in source)
+    paragraphs = ('\n'.join(para) for para in group_paragraphs(source))
+    title = paragraphs.next()
+    return (template.render(title=title, text=paragraphs), [])
+
+def title(title):
+    return (r'\frame[plain]{\frametitle{%s}}' % title, [])
+

File shinypress/text.py

-from shinypress.jinja import env
-from shinypress.utils import group_paragraphs
-import codecs
-
-template = env.from_string(r"""
-%% for para in text %%
-\begin{frame}
-%% if loop.first and title %%
-\frametitle{< title | latexify >}
-%% endif %%
-
-< para | latexify >
-\end{frame}
-%% endfor %%
-""")
-
-def render(filename):
-    source = codecs.open(filename, 'rU', 'utf-8')
-    source = (line[:-1] for line in source)
-    paragraphs = ('\n'.join(para) for para in group_paragraphs(source))
-    title = paragraphs.next()
-    return (template.render(title=title, text=paragraphs), [])
-
-def title(title):
-    return (r'\frame[plain]{\frametitle{%s}}' % title, [])
-