Browse Source

Updates and fixes to build system

Caleb Fangmeier 6 years ago
parent
commit
43977e62c5

+ 9 - 0
content/.gitignore

@@ -2,3 +2,12 @@
 *.html
 *.html
 *_*.tex
 *_*.tex
 *.aux
 *.aux
+*.bbl
+*.bcf
+*.blg
+*.dvi
+*.log
+*.out
+*.run.xml
+*.toc
+*.bak

File diff suppressed because it is too large
+ 4 - 0
content/00_abstract.md


File diff suppressed because it is too large
+ 9 - 1
content/01_introduction.md


File diff suppressed because it is too large
+ 3 - 1
content/02_theory.md


+ 12 - 0
content/chapter.html

@@ -0,0 +1,12 @@
+<html>
+    <head>
+        <title>$title$</title>
+        $if(modified)$
+        <meta name="modified" content="$modified$" />
+        <meta name="category" content="thesis" />
+        $endif$
+    </head>
+    <body>
+$body$
+    </body>
+</html>

+ 4 - 0
content/chapter.latex

@@ -0,0 +1,4 @@
+\chapter{$title$}
+
+$body$
+

File diff suppressed because it is too large
+ 15 - 0
content/references.bib


+ 226 - 0
content/stuttgart-media-university.csl

@@ -0,0 +1,226 @@
+<?xml version="1.0" encoding="utf-8"?>
+<style xmlns="http://purl.org/net/xbiblio/csl" class="note" default-locale="de-DE" version="1.0" demote-non-dropping-particle="sort-only">
+  <info>
+    <title>Hochschule der Medien Stuttgart (German)</title>
+    <title-short>HdM Stuttgart</title-short>
+    <id>http://www.zotero.org/styles/stuttgart-media-university</id>
+    <link href="http://www.zotero.org/styles/stuttgart-media-university" rel="self"/>
+    <link href="http://www.zotero.org/styles/technische-universitat-wien" rel="template"/>
+    <link href="https://github.com/citation-style-language/styles/issues/175" rel="documentation"/>
+    <link href="http://www.hdm-stuttgart.de/" rel="documentation"/>
+    <author>
+      <name>Julian Koegel</name>
+      <email>ju.koegel@googlemail.com</email>
+    </author>
+    <category citation-format="note"/>
+    <category field="social_science"/>
+    <updated>2012-09-27T22:06:38+00:00</updated>
+    <rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>
+  </info>
+  <locale xml:lang="de">
+    <terms>
+      <term name="et-al">u.a.</term>
+      <term name="and">und</term>
+      <term name="retrieved">zugegriffen am</term>
+      <term name="accessed">Zugriff:</term>
+      <term name="ibid">ebenda</term>
+      <term name="page" form="short">S.</term>
+      <term name="section" form="short">Abs.</term>
+    </terms>
+  </locale>
+  <!--
+       macro definitions
+       author
+       editor
+       accessed
+       date
+       year-date
+       pages
+       point-locators
+       point-locators-subsequent
+       hasUrl
+  -->
+  <macro name="author">
+    <names variable="author">
+      <name name-as-sort-order="all" sort-separator=", " delimiter="; " delimiter-precedes-last="never"/>
+      <label form="short" prefix=" (" suffix=")"/>
+      <substitute>
+        <names variable="editor"/>
+        <text variable="title"/>
+      </substitute>
+    </names>
+    <text macro="anon"/>
+  </macro>
+  <macro name="author-short">
+    <names variable="author" delimiter="; ">
+      <name form="short" delimiter="; " initialize-with=". " delimiter-precedes-last="never" sort-separator=","/>
+      <substitute>
+        <names variable="editor"/>
+        <text variable="title"/>
+      </substitute>
+    </names>
+    <text macro="anon"/>
+  </macro>
+  <macro name="editor">
+    <names variable="editor" delimiter="; ">
+      <name name-as-sort-order="all" sort-separator=", " delimiter="; " delimiter-precedes-last="never" form="long"/>
+      <label form="short" prefix=" (" suffix=")"/>
+    </names>
+  </macro>
+  <macro name="anon">
+    <choose>
+      <if variable="author editor translator" match="none">
+        <text term="anonymous" form="short" suffix="&#160;" strip-periods="true"/>
+      </if>
+    </choose>
+  </macro>
+  <macro name="accessed">
+    <text term="accessed"/>
+    <date variable="accessed" prefix=" ">
+      <date-part form="numeric" name="day" suffix="."/>
+      <date-part form="numeric" name="month" suffix="."/>
+      <date-part form="long" name="year"/>
+    </date>
+  </macro>
+  <macro name="date">
+    <choose>
+      <if variable="issued">
+        <date variable="issued">
+          <date-part form="numeric" name="day" suffix="."/>
+          <date-part form="numeric" name="month" suffix="."/>
+          <date-part form="long" name="year"/>
+        </date>
+      </if>
+      <else>
+        <date variable="accessed">
+          <date-part form="numeric" name="day" suffix="."/>
+          <date-part form="numeric" name="month" suffix="."/>
+          <date-part form="long" name="year"/>
+        </date>
+      </else>
+    </choose>
+  </macro>
+  <macro name="year-date">
+    <choose>
+      <if type="webpage">
+        <choose>
+          <if variable="issued">
+            <date variable="issued">
+              <date-part name="year"/>
+            </date>
+          </if>
+          <else>
+            <date variable="accessed">
+              <date-part name="year"/>
+            </date>
+          </else>
+        </choose>
+      </if>
+      <else>
+        <date variable="issued">
+          <date-part name="year"/>
+        </date>
+      </else>
+    </choose>
+  </macro>
+  <macro name="pages">
+    <label variable="locator" form="short" prefix=", " suffix=".&#160;" strip-periods="true"/>
+    <text variable="page"/>
+  </macro>
+  <macro name="point-locators-subsequent">
+    <group>
+      <choose>
+        <if locator="page" match="none">
+          <choose>
+            <if type="bill book graphic legal_case legislation motion_picture report song" match="any">
+              <choose>
+                <if variable="volume">
+                  <group>
+                    <text term="volume" form="short" text-case="lowercase" suffix=" "/>
+                    <number variable="volume" form="numeric"/>
+                    <label variable="locator" form="short" prefix=", "/>
+                  </group>
+                </if>
+                <else>
+                  <label variable="locator" form="short" suffix=" "/>
+                </else>
+              </choose>
+            </if>
+          </choose>
+        </if>
+        <else-if type="bill book graphic legal_case legislation motion_picture report song" match="any">
+          <number variable="volume" form="numeric" suffix=":"/>
+        </else-if>
+      </choose>
+      <label variable="locator" form="short" suffix=" "/>
+      <text variable="locator"/>
+    </group>
+  </macro>
+  <citation et-al-min="3" et-al-use-first="1" disambiguate-add-year-suffix="true">
+    <layout delimiter="; ">
+      <choose>
+        <if position="ibid">
+          <text term="ibid"/>
+          <text macro="point-locators-subsequent" prefix=", "/>
+        </if>
+        <else>
+          <text macro="author-short"/>
+          <text macro="year-date" prefix=" (" suffix=")"/>
+        </else>
+      </choose>
+    </layout>
+  </citation>
+  <bibliography hanging-indent="true">
+    <sort>
+      <key macro="author"/>
+      <key macro="date"/>
+    </sort>
+    <layout>
+      <group font-weight="bold">
+        <text macro="author"/>
+        <text macro="year-date" prefix=" (" suffix="):"/>
+      </group>
+      <text variable="title" prefix=" "/>
+      <choose>
+        <if type="webpage">
+          <text macro="date" prefix=". "/>
+        </if>
+        <else-if type="speech" match="any">
+          <text variable="publisher-place" prefix=", "/>
+          <text macro="date" prefix=", "/>
+          <text macro="accessed" prefix=", "/>
+        </else-if>
+        <else-if type="article-newspaper article-magazine article-journal" match="any">
+          <text value=". In: "/>
+          <text variable="container-title" font-style="italic"/>
+          <text variable="collection-title" prefix=", Reihe "/>
+          <text variable="volume" prefix=", Band "/>
+          <text variable="issue" prefix=", Ausgabe "/>
+          <text macro="date" prefix=", "/>
+          <text macro="pages"/>
+        </else-if>
+        <else-if type="chapter" match="any">
+          <text macro="editor" prefix=". In: " suffix=": "/>
+          <text variable="container-title" font-style="italic"/>
+          <text value=". "/>
+          <text variable="publisher-place" suffix=": "/>
+          <text variable="publisher"/>
+          <text macro="pages"/>
+        </else-if>
+        <else>
+          <text value=". "/>
+          <text variable="publisher-place" suffix=": "/>
+          <text variable="publisher"/>
+        </else>
+      </choose>
+      <choose>
+        <if variable="URL">
+          <text value="URL:&#160;" prefix=", "/>
+          <text variable="URL"/>
+          <text macro="accessed" prefix=" [" suffix="]"/>
+        </if>
+      </choose>
+      <text variable="note" prefix=", "/>
+    </layout>
+  </bibliography>
+</style>

BIN
content/thesis.pdf


+ 9 - 5
content/thesis.tex

@@ -20,6 +20,9 @@
 \usepackage{amssymb,amsmath}
 \usepackage{amssymb,amsmath}
 \usepackage{ifxetex,ifluatex}
 \usepackage{ifxetex,ifluatex}
 \usepackage{fixltx2e} % provides \textsubscript
 \usepackage{fixltx2e} % provides \textsubscript
+\usepackage[]{biblatex}
+\addbibresource{references.bib}
+
 \ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
 \ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
   \usepackage[T1]{fontenc}
   \usepackage[T1]{fontenc}
   \usepackage[utf8]{inputenc}
   \usepackage[utf8]{inputenc}
@@ -42,7 +45,7 @@
 \setlength{\parskip}{6pt plus 2pt minus 1pt}
 \setlength{\parskip}{6pt plus 2pt minus 1pt}
 }
 }
 \usepackage{hyperref}
 \usepackage{hyperref}
-\hypersetup{
+\hypersetup{%
             pdfborder={0 0 0},
             pdfborder={0 0 0},
             breaklinks=true}
             breaklinks=true}
 \urlstyle{same}  % don't use monospace font for urls
 \urlstyle{same}  % don't use monospace font for urls
@@ -61,11 +64,11 @@
 \setcounter{secnumdepth}{0}
 \setcounter{secnumdepth}{0}
 % Redefines (sub)paragraphs to behave more like sections
 % Redefines (sub)paragraphs to behave more like sections
 \ifx\paragraph\undefined\else
 \ifx\paragraph\undefined\else
-\let\oldparagraph\paragraph
+\let\oldparagraph\paragraph%
 \renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
 \renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
 \fi
 \fi
 \ifx\subparagraph\undefined\else
 \ifx\subparagraph\undefined\else
-\let\oldsubparagraph\subparagraph
+\let\oldsubparagraph\subparagraph%
 \renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
 \renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
 \fi
 \fi
 
 
@@ -162,7 +165,7 @@
 %% mainmatter is needed to set the page numbering correctly
 %% mainmatter is needed to set the page numbering correctly
 %%   mainmatter is needed after the ToC, (LoF, and LoT) to set the
 %%   mainmatter is needed after the ToC, (LoF, and LoT) to set the
 %%   page numbering correctly for the main body
 %%   page numbering correctly for the main body
-\mainmatter
+\mainmatter%
 
 
 %% Thesis goes here
 %% Thesis goes here
 
 
@@ -171,7 +174,7 @@
 
 
 %% backmatter is needed at the end of the main body of your thesis to
 %% backmatter is needed at the end of the main body of your thesis to
 %% set up page numbering correctly for the remainder of the thesis
 %% set up page numbering correctly for the remainder of the thesis
-\backmatter
+\backmatter%
 
 
 %% Start the correct formatting for the appendices
 %% Start the correct formatting for the appendices
 \appendix
 \appendix
@@ -180,6 +183,7 @@
 
 
 %% Bibliography goes here (You better have one)
 %% Bibliography goes here (You better have one)
 %% BibTeX is your friend
 %% BibTeX is your friend
+\printbibliography%
 
 
 %% Index go here (if you have one)
 %% Index go here (if you have one)
 \end{document}
 \end{document}

+ 21 - 9
convert.py

@@ -1,12 +1,13 @@
 #!/usr/bin/env python3
 #!/usr/bin/env python3
+import os
 import sys
 import sys
 import re
 import re
 from subprocess import run
 from subprocess import run
 from os.path import splitext
 from os.path import splitext
 from glob import glob
 from glob import glob
 
 
-title_re = re.compile(r'^# (.*)$', re.MULTILINE)
-tex_re = re.compile(r'\\begin{document}(.*)\\end{document}', re.MULTILINE | re.DOTALL)
+# title_re = re.compile(r'^# (.*)$', re.MULTILINE)
+# tex_re = re.compile(r'\\begin{document}(.*)\\end{document}', re.MULTILINE | re.DOTALL)
 
 
 
 
 def parse_title(infilename):
 def parse_title(infilename):
@@ -20,29 +21,40 @@ def parse_title(infilename):
 
 
 
 
 def make_tex(infilename):
 def make_tex(infilename):
-    title = parse_title(infilename)
+    # title = parse_title(infilename)
     outfilename = splitext(infilename)[0]+'.tex'
     outfilename = splitext(infilename)[0]+'.tex'
-    run(('pandoc', '-F', 'pandoc-crossref', '-F', 'pandoc-citeproc', '-s', infilename, '-o', outfilename,))
+    run(('pandoc', '--biblatex', '-F', 'pandoc-crossref', '-s', infilename, '-o', outfilename,
+         '--metadata=bibliography:references.bib',
+         '--template=chapter',
+         ))
     with open(outfilename, 'r') as f:
     with open(outfilename, 'r') as f:
         full = f.read()
         full = f.read()
-        body = tex_re.findall(full)[0]
-        body = body.replace('section{'+title+'}', 'chapter{'+title+'}')
+        # body = tex_re.findall(full)[0]
+        body = full
+        # body = body.replace('section{'+title+'}', 'chapter{'+title+'}')
+        body = body.replace(r'\printbibliography', '')
     with open(outfilename, 'w') as f:
     with open(outfilename, 'w') as f:
         f.write(body)
         f.write(body)
 
 
 
 
 def make_html(infilename):
 def make_html(infilename):
-    title = parse_title(infilename)
+    # title = parse_title(infilename)
     outfilename = splitext(infilename)[0]+'.html'
     outfilename = splitext(infilename)[0]+'.html'
     run(('pandoc', '-F', 'pandoc-crossref', '-F', 'pandoc-citeproc', '-s', infilename, '-o', outfilename,
     run(('pandoc', '-F', 'pandoc-crossref', '-F', 'pandoc-citeproc', '-s', infilename, '-o', outfilename,
-         '--metadata=linkReferences:true', f'--metadata=pagetitle:{title}'))
+         '--metadata=linkReferences:true',
+         # f'--metadata=pagetitle:{title}',
+         '--metadata=bibliography:references.bib',
+         '--metadata=citation-style:stuttgart-media-university.csl',
+         '--template=chapter',
+         ))
 
 
 
 
 def main():
 def main():
     if len(sys.argv) != 2 or sys.argv[1] not in ('html', 'tex'):
     if len(sys.argv) != 2 or sys.argv[1] not in ('html', 'tex'):
         print('usage: ./convert.py [html|tex]')
         print('usage: ./convert.py [html|tex]')
         sys.exit(1)
         sys.exit(1)
-    for infilename in glob('content/*_*.md'):
+    os.chdir('content')
+    for infilename in glob('*_*.md'):
         if sys.argv[1] == 'html':
         if sys.argv[1] == 'html':
             make_html(infilename)
             make_html(infilename)
         else:
         else:

+ 1 - 1
elegant

@@ -1 +1 @@
-Subproject commit a6253e37ce22f51552382368672bc2dc07695bb5
+Subproject commit 588b8e5badf59b4a7ae87e352b25b85a59dd1d42

+ 2 - 2
pelicanconf.py

@@ -16,12 +16,12 @@ PLUGIN_PATHS = ['plugins']
 PLUGINS = ['sitemap', 'extract_toc', 'tipue_search']
 PLUGINS = ['sitemap', 'extract_toc', 'tipue_search']
 
 
 # MD_EXTENSIONS = ['codehilite(css_class=highlight)', 'extra', 'headerid', 'toc']
 # MD_EXTENSIONS = ['codehilite(css_class=highlight)', 'extra', 'headerid', 'toc']
-DIRECT_TEMPLATES = (('index', 'tags', 'categories','archives', 'search', '404'))
+DIRECT_TEMPLATES = (('index', 'tags', 'categories', 'archives', 'search', '404'))
 STATIC_PATHS = ['theme/images', 'images', 'figures']
 STATIC_PATHS = ['theme/images', 'images', 'figures']
 TAG_SAVE_AS = ''
 TAG_SAVE_AS = ''
 CATEGORY_SAVE_AS = ''
 CATEGORY_SAVE_AS = ''
 AUTHOR_SAVE_AS = ''
 AUTHOR_SAVE_AS = ''
-IGNORE_FILES = ['.#*', '*.md']
+IGNORE_FILES = ['.#*', '*.md', 'chapter.html']
 
 
 SITEMAP = {'format': 'txt'}
 SITEMAP = {'format': 'txt'}
 DEFAULT_DATE = 'fs'  # filesystem date
 DEFAULT_DATE = 'fs'  # filesystem date