Explorar o código

Update build scheme

Caleb Fangmeier %!s(int64=4) %!d(string=hai) anos
pai
achega
e4a2a9738b

+ 26 - 57
Makefile

@@ -9,24 +9,11 @@ OUTPUTDIR=$(BASEDIR)/output
 CONFFILE=$(BASEDIR)/pelicanconf.py
 PUBLISHCONF=$(BASEDIR)/publishconf.py
 
-FTP_HOST=localhost
-FTP_USER=anonymous
-FTP_TARGET_DIR=/
-
 SSH_HOST=fangmeier.tech
 SSH_PORT=22
 SSH_USER=caleb
 SSH_TARGET_DIR=/var/www/thesis
 
-S3_BUCKET=my_s3_bucket
-
-CLOUDFILES_USERNAME=my_rackspace_username
-CLOUDFILES_API_KEY=my_rackspace_api_key
-CLOUDFILES_CONTAINER=my_cloudfiles_container
-
-DROPBOX_DIR=~/Dropbox/Public/
-
-GITHUB_PAGES_BRANCH=gh-pages
 
 DEBUG ?= 0
 ifeq ($(DEBUG), 1)
@@ -45,39 +32,47 @@ help:
 	@echo '   make html                           (re)generate the web site          '
 	@echo '   make pdf                            (re)generate the pdf               '
 	@echo '   make clean                          remove the generated files         '
-	@echo '   make regenerate                     regenerate files upon modification '
 	@echo '   make publish                        generate using production settings '
 	@echo '   make serve [PORT=8000]              serve site at http://localhost:8000'
-	@echo '   make serve-global [SERVER=0.0.0.0]  serve (as root) to $(SERVER):80    '
-	@echo '   make devserver [PORT=8000]          start/restart develop_server.sh    '
-	@echo '   make stopserver                     stop local server                  '
-	@echo '   make ssh_upload                     upload the web site via SSH        '
 	@echo '   make rsync_upload                   upload the web site via rsync+ssh  '
-	@echo '   make dropbox_upload                 upload the web site via Dropbox    '
-	@echo '   make ftp_upload                     upload the web site via FTP        '
-	@echo '   make s3_upload                      upload the web site via S3         '
-	@echo '   make cf_upload                      upload the web site via Cloud Files'
-	@echo '   make github                         upload the web site via gh-pages   '
 	@echo '                                                                          '
 	@echo 'Set the DEBUG variable to 1 to enable debugging, e.g. make DEBUG=1 html   '
 	@echo 'Set the RELATIVE variable to 1 to enable relative urls                    '
 	@echo '                                                                          '
 
-html:
-	./convert.py html
+build/%.html: content/%.md
+	@./convert.py $*.md html
+
+build/%.tex: content/%.md
+	@./convert.py $*.md tex
+
+00_html: build/00_abstract.html
+01_html: build/01_introduction.html
+02_html: build/02_standard_model.html
+03_html: build/03_lhc_and_cms_detector.html
+04_html: build/04_simulation_and_reconstruction.html
+05_html: build/05_tttt_measurement.html
+06_html: build/06_pixel_assembly.html
+
+00_tex: build/00_abstract.tex
+01_tex: build/01_introduction.tex
+02_tex: build/02_standard_model.tex
+03_tex: build/03_lhc_and_cms_detector.tex
+04_tex: build/04_simulation_and_reconstruction.tex
+05_tex: build/05_tttt_measurement.tex
+06_tex: build/06_pixel_assembly.tex
+
+
+html: 00_html 01_html 02_html 03_html 04_html 05_html 06_html
 	$(PELICAN) $(BUILDDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
 
-pdf:
-	./convert.py tex
+pdf: 00_tex 01_tex 02_tex 03_tex 04_tex 05_tex 06_tex
 	cd $(BUILDDIR); rubber thesis
 
 clean:
 	[ ! -d $(OUTPUTDIR) ] || rm -rf $(OUTPUTDIR)
 	cd $(BUILDDIR); git clean -f -X
 
-regenerate:
-	$(PELICAN) -r $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
-
 serve:
 ifdef PORT
 	cd $(OUTPUTDIR) && $(PY) -m pelican.server $(PORT)
@@ -85,38 +80,12 @@ else
 	cd $(OUTPUTDIR) && $(PY) -m pelican.server
 endif
 
-serve-global:
-ifdef SERVER
-	cd $(OUTPUTDIR) && $(PY) -m pelican.server 80 $(SERVER)
-else
-	cd $(OUTPUTDIR) && $(PY) -m pelican.server 80 0.0.0.0
-endif
-
-
-devserver:
-ifdef PORT
-	$(BASEDIR)/develop_server.sh restart $(PORT)
-else
-	$(BASEDIR)/develop_server.sh restart
-endif
-
-stopserver:
-	$(BASEDIR)/develop_server.sh stop
-	@echo 'Stopped Pelican and SimpleHTTPServer processes running in background.'
-
 publish: html pdf
 	$(PELICAN) $(BUILDDIR) -o $(OUTPUTDIR) -s $(PUBLISHCONF) $(PELICANOPTS)
 	[ -f $(BUILDDIR)/thesis.pdf ] && cp $(BUILDDIR)/thesis.pdf $(OUTPUTDIR)
 
-ssh_upload: publish
-	scp -P $(SSH_PORT) -r $(OUTPUTDIR)/* $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR)
-
 rsync_upload: publish
 	rsync -e "ssh -p $(SSH_PORT)" -P -rvzc --delete $(OUTPUTDIR)/ $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR) --cvs-exclude
 
 
-github: publish
-	ghp-import -m "Generate Pelican site" -b $(GITHUB_PAGES_BRANCH) $(OUTPUTDIR)
-	git push origin $(GITHUB_PAGES_BRANCH)
-
-.PHONY: html pdf help clean regenerate serve serve-global devserver stopserver publish ssh_upload rsync_upload dropbox_upload ftp_upload s3_upload cf_upload github
+.PHONY: html pdf help clean serve publish rsync_upload

+ 2 - 0
build/thesis.tex

@@ -23,6 +23,8 @@
 \usepackage[style=numeric]{biblatex}
 \addbibresource{references.bib}
 
+\usepackage{xcolor}
+
 \ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
   \usepackage[T1]{fontenc}
   \usepackage[utf8]{inputenc}

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 34 - 1
content/05_tttt_measurement.md


BIN=BIN
content/figures/isrfsr_correction.png


BIN=BIN
content/figures/isrfsr_correction.xcf


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 21 - 0
content/references.bib


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 33 - 0
content/references.referencer


+ 20 - 23
convert.py

@@ -1,16 +1,17 @@
 #!/usr/bin/env python3
 import os
 import sys
-from re import match
 from subprocess import run
-from os import listdir, rename
 from shutil import copyfile
 from os.path import splitext, join
 
 
 def make_tex(infilename):
     outfilename = splitext(infilename)[0]+'.tex'
-    run(('pandoc', '--biblatex', '-F', 'pandoc-crossref', '-s', infilename, '-o', outfilename,
+    run(('pandoc', '--biblatex',
+         '-F', 'pandoc-crossref',
+         '-F', '../filters/note_filter.py',
+         '-s', infilename, '-o', outfilename,
          '--metadata=bibliography:references.bib',
          '--template=chapter',
          ))
@@ -23,7 +24,10 @@ def make_tex(infilename):
 
 def make_html(infilename):
     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,
          '--mathjax',
          '--metadata=linkReferences:true',
          '--metadata=bibliography:references.bib',
@@ -32,27 +36,20 @@ def make_html(infilename):
          ))
 
 
-def main():
-    if len(sys.argv) != 2 or sys.argv[1] not in ('html', 'tex'):
-        print('usage: ./convert.py [html|tex]')
-        sys.exit(1)
-
-    for fname in listdir('content'):
-        if match(r'.*\.md', fname):
-            copyfile(join('content', fname), join('build', fname))
+def main(src, dest_fmt):
+    print(f'Converting {src} to {dest_fmt}...', end='', flush=True)
 
+    copyfile(join('content', src), join('build', src))
     os.chdir('build')
-    fmt = sys.argv[1]
-    for infilename in listdir('.'):
-        if not match(r'.*\.md', infilename):
-            continue
-        print(f'Converting {infilename} to {fmt}...', end='', flush=True)
-        if fmt == 'html':
-            make_html(infilename)
-        else:
-            make_tex(infilename)
-        print('Done')
+    if dest_fmt == 'html':
+        make_html(src)
+    else:
+        make_tex(src)
+    print('Done')
 
 
 if __name__ == '__main__':
-    main()
+    if len(sys.argv) < 3 or sys.argv[2] not in ('html', 'tex'):
+        print('usage: ./convert.py input_markdown [html|tex]')
+        sys.exit(1)
+    main(sys.argv[1], sys.argv[2])

BIN=BIN
docs/AN2018_062_v15.pdf


BIN=BIN
docs/TOP-18-003-paper-v18


+ 20 - 0
filters/note_filter.py

@@ -0,0 +1,20 @@
+#! /usr/bin/env python3
+import panflute as pf
+
+
+def handle_note(elem, doc):
+    if isinstance(elem, pf.RawInline) and elem.text == '<mark>':
+        elem.text = r'\colorbox{yellow}{'
+        elem.format = 'tex'
+    if isinstance(elem, pf.RawInline) and elem.text == '</mark>':
+        elem.text = '}'
+        elem.format = 'tex'
+    return elem
+
+
+def main(doc=None):
+    return pf.run_filter(handle_note, doc=doc)
+
+
+if __name__ == "__main__":
+    main()

+ 1 - 0
requirements.txt

@@ -10,3 +10,4 @@ python-dateutil==2.7.3
 pytz==2018.5
 six==1.11.0
 Unidecode==1.0.22
+panflute=1.11.2