Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
slider
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tuhe
slider
Commits
f4b9ccb2
Commit
f4b9ccb2
authored
11 months ago
by
tuhe
Browse files
Options
Downloads
Patches
Plain Diff
updates
parent
dd8f2587
No related branches found
No related tags found
No related merge requests found
Pipeline
#33096
passed
11 months ago
Stage: test
Stage: deploy
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/slider/latexutils.py
+8
-8
8 additions, 8 deletions
src/slider/latexutils.py
with
8 additions
and
8 deletions
src/slider/latexutils.py
+
8
−
8
View file @
f4b9ccb2
...
...
@@ -5,7 +5,7 @@ import subprocess
import
glob
import
asyncio
def
latexmk
(
texfile
,
pdf_out
=
None
,
shell
=
True
,
cleanup
=
False
,
Linux
=
False
):
def
latexmk
(
texfile
,
pdf_out
=
None
,
shell
=
True
,
cleanup
=
False
,
Linux
=
False
,
compress_pdf
=
False
):
cdir
=
os
.
getcwd
()
texfile
=
os
.
path
.
abspath
(
texfile
)
dname
=
os
.
path
.
dirname
(
texfile
)
...
...
@@ -37,19 +37,19 @@ def latexmk(texfile,pdf_out=None,shell=True,cleanup=False, Linux=False):
fl
=
glob
.
glob
(
dname
+
"
/*.
"
+
ex
)
for
f
in
fl
:
os
.
remove
(
f
)
if
compress_pdf
:
cmd
=
f
"""
gs -sDEVICE=pdfwrite -dPDFSETTINGS=/ebook -e -o _
{
pdf_out
}
{
pdf_out
}
"""
# cmds = [ f"""gs -sDEVICE=pdfwrite -dPDFSETTINGS=/ebook -e -o""", f"{dname}/{pdf_out}", f"{dname}/{pdf_out}"]
print
(
"
Compressing PDF file using command
"
,
cmd
)
subprocess
.
run
(
cmd
,
shell
=
True
)
shutil
.
move
(
f
"
_
{
pdf_out
}
"
,
pdf_out
)
print
(
"
[done]
"
)
os
.
chdir
(
cdir
)
return
pdf_out
async
def
latexmk_async
(
texfile
,
pdf_out
=
None
,
cleanup
=
False
):
cdir
=
os
.
getcwd
()
texfile
=
os
.
path
.
abspath
(
texfile
)
import
tempfile
# with tempfile.TemporaryDirectory() as tmp:
# print('created temporary directory', tmpdirname)
# shutil.rmtree(tmp)
# shutil.copytree(os.path.dirname(texfile), tmp)
# tmp_texfile = tmp + "/" + os.path.basename(texfile)
tmp_texfile
=
texfile
compiled_pdf
=
tmp_texfile
[:
-
4
]
+
"
.pdf
"
if
os
.
path
.
isfile
(
compiled_pdf
):
...
...
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