Skip to content
Snippets Groups Projects
Commit f23bca8a authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

first

parents
No related branches found
No related tags found
No related merge requests found
build.py eol=lf
# Created by .ignore support plugin (hsz.mobi)
.idea/
dist/
build_all:
stage: build
before_script:
- vagrant up
after_script:
- vagrant destroy -f
script:
- mkdir dist
- vagrant ssh -c 'cd /vagrant; python build.py'
artifacts:
paths:
- dist/lab1/*.pdf
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "contrib/debian-jessie64"
config.vm.provision "shell", inline: <<-SHELL
apt-get install -y python pandoc texlive-latex-base texlive-fonts-recommended
chmod +x build.py
SHELL
end
build.py 0 → 100644
#! /usr/bin/env python
# coding=UTF-8
import os
import json
import codecs
if __name__ == '__main__':
# Dirs
try:
os.mkdir('dist')
except OSError:
pass
# Lab1
try:
os.mkdir('dist/lab1')
except OSError:
pass
with open('src/lab1.md', 'rb') as labin, open('src/lab1.json', 'rb') as datin:
data = json.load(datin)
lab = labin.read().decode('utf8')
for ex_no, d in enumerate(data, start=1):
plab = lab
d['lp'] = unicode(ex_no)
for k, v in d.iteritems():
print k, v
plab = plab.replace(u'$%s$' % (k, ), v)
with open('dist/lab1/%s.md' % (ex_no, ), 'wb') as labout:
labout.write(plab.encode('utf8'))
os.system('pandoc dist/lab1/%s.md -s -o dist/lab1/%s.pdf' % (ex_no, ex_no))
[
{
}
]
\ No newline at end of file
# Nr $lp$
Zażółć gęślą jaźń
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment