Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
schildergenerator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
schilder
schildergenerator
Commits
b5b990b8
Commit
b5b990b8
authored
9 years ago
by
Dave Kliczbor
Browse files
Options
Downloads
Patches
Plain Diff
Added --recreate-cache command line to rebuild all caches after a template modification.
parent
2d9c7ec5
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+15
-2
15 additions, 2 deletions
README.md
data/GenericEvent42-1331353749.schild
+1
-1
1 addition, 1 deletion
data/GenericEvent42-1331353749.schild
schilder.py
+45
-10
45 additions, 10 deletions
schilder.py
with
61 additions
and
13 deletions
README.md
+
15
−
2
View file @
b5b990b8
...
...
@@ -50,8 +50,21 @@ Download
Config
------
*
for all uses: copy config.py.example to config.py and edit it to your needs.
*
for production use: copy schildergen.wsgi.example to schildergen.wsgi and edit it.
*
*for all uses*
: copy config.py.example to config.py and edit it to your needs.
*
*for production use*
: copy schildergen.wsgi.example to schildergen.wsgi and edit it.
Modify the templates
--------------------
In most cases, you just need to edit tex/support/header.tex and add your logo
in tex/support . After you changed it, you might want to run
$ python schilder.py --recreate-cache
to delete all cached pdf and image thumbnails, then re-run pdflatex on all
saved signs. Accessing the webinterface will recreate the rest of the cached
image thumbnails.
Running in test/debug mode
...
...
This diff is collapsed.
Click to expand it.
data/GenericEvent42-1331353749.schild
+
1
−
1
View file @
b5b990b8
{"pdfname": "GenericEvent42-1331353749.schild.pdf", "img": "pictograms-nps-misc-camera.png", "headline": "Generic\r\nEvent42", "text": "Man kann Wiki-Syntax benutzen.\r\n\r\n* Zum Beispiel f\u00fcr\r\n* Bullet Lists\r\n", "markup": "rst", "reusefilename": "on", "textemplate": "image-left_bothtext-right.tex", "filename": "GenericEvent42-1331353749.schild"}
\ No newline at end of file
{"pdfname": "GenericEvent42-1331353749.schild.pdf", "img": "pictograms-nps-misc-camera.png", "headline": "Generic\r\nEvent42", "text": "Man kann Wiki-Syntax benutzen.\r\n\r\n* Zum Beispiel f\u00fcr\r\n* Bullet Lists\r\n", "markup": "latex", "reusefilename": "on", "textemplate": "image-left_bothtext-right.tex", "filename": "GenericEvent42-1331353749.schild"}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
schilder.py
+
45
−
10
View file @
b5b990b8
...
...
@@ -114,12 +114,18 @@ def run_pdflatex(context, outputfilename, overwrite=True):
[
'
pdflatex
'
,
'
--halt-on-error
'
,
tmptexfile
],
stderr
=
STDOUT
)
except
CalledProcessError
as
e
:
if
overwrite
:
try
:
flash
(
Markup
(
"
<p>PDFLaTeX Output:</p><pre>%s</pre>
"
%
e
.
output
),
'
log
'
)
except
:
print
(
e
.
output
)
raise
SyntaxWarning
(
"
PDFLaTeX bailed out
"
)
finally
:
os
.
chdir
(
cwd
)
if
overwrite
:
try
:
flash
(
Markup
(
"
<p>PDFLaTeX Output:</p><pre>%s</pre>
"
%
texlog
),
'
log
'
)
except
:
print
(
texlog
)
shutil
.
copy
(
tmppdffile
,
outputfilename
)
shutil
.
rmtree
(
tmpdir
)
...
...
@@ -197,22 +203,34 @@ def create():
formdata
[
'
pdfname
'
]
=
outpdfname
save_data
(
formdata
,
outfilename
)
run_pdflatex
(
formdata
,
os
.
path
.
join
(
config
.
pdfdir
,
outpdfname
))
try
:
flash
(
Markup
(
u
"""
PDF created and data saved. You might create another one. Here
'
s a preview. Click to print.<br/>
<a href=
"
%s
"
><img src=
"
%s
"
/></a>
"""
%
(
url_for
(
'
schild
'
,
filename
=
outfilename
),
url_for
(
'
pdfthumbnail
'
,
pdfname
=
outpdfname
,
maxgeometry
=
200
))
))
except
:
print
(
"
%s created
"
%
outpdfname
)
except
Exception
as
e
:
try
:
flash
(
u
"
Could not create pdf or save data: %s
"
%
str
(
e
),
'
error
'
)
except
:
print
(
"
Could not create pdf or save data: %s
"
%
str
(
e
))
data
=
{
'
form
'
:
formdata
}
imagelist
=
glob
.
glob
(
config
.
imagedir
+
'
/*.png
'
)
data
[
'
images
'
]
=
[
os
.
path
.
basename
(
f
)
for
f
in
imagelist
]
templatelist
=
glob
.
glob
(
config
.
textemplatedir
+
'
/*.tex
'
)
data
[
'
templates
'
]
=
[
os
.
path
.
basename
(
f
)
for
f
in
sorted
(
templatelist
)]
try
:
return
redirect
(
url_for
(
'
edit_one
'
,
filename
=
outfilename
))
except
:
pass
try
:
flash
(
"
No POST data. You
'
ve been redirected to the edit page.
"
,
'
warning
'
)
return
redirect
(
url_for
(
'
edit
'
))
except
:
pass
@app.route
(
'
/schild/<filename>
'
)
...
...
@@ -313,7 +331,24 @@ def pdfdownload(pdfname):
return
Response
(
pdffile
.
read
(),
mimetype
=
"
application/pdf
"
)
def
recreate_cache
():
for
filename
in
(
glob
.
glob
(
os
.
path
.
join
(
config
.
pdfdir
,
'
*.pdf*
'
))
+
glob
.
glob
(
os
.
path
.
join
(
config
.
cachedir
,
'
*.pdf*
'
))
+
glob
.
glob
(
os
.
path
.
join
(
config
.
imagedir
,
'
*.png.*
'
))):
try
:
os
.
unlink
(
filename
)
print
(
"
Deleted %s
"
%
filename
)
except
Exception
as
e
:
print
(
"
Could not delete %s: %s
"
%
(
filename
,
str
(
e
)))
for
filename
in
glob
.
glob
(
os
.
path
.
join
(
config
.
datadir
,
'
*.schild
'
)):
data
=
load_data
(
filename
)
pdfname
=
os
.
path
.
join
(
config
.
pdfdir
,
data
[
'
pdfname
'
])
print
(
"
Recreating %s
"
%
pdfname
)
run_pdflatex
(
data
,
pdfname
)
if
__name__
==
'
__main__
'
:
if
len
(
sys
.
argv
)
>
1
and
sys
.
argv
[
1
]
==
'
--recreate-cache
'
:
recreate_cache
()
else
:
app
.
debug
=
True
app
.
run
(
host
=
config
.
listen
,
port
=
config
.
port
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment