Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
155b28cb46
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,5 +1,6 @@
|
|||||||
.idea
|
.idea
|
||||||
csvmarp
|
csvmarp
|
||||||
|
csvconvertervenv
|
||||||
|
|
||||||
# ---> Python
|
# ---> Python
|
||||||
# Byte-compiled / optimized / DLL files
|
# Byte-compiled / optimized / DLL files
|
||||||
|
48
README.md
48
README.md
@ -13,8 +13,13 @@ Strings surrounded with quotation marks
|
|||||||
|
|
||||||
The [marp-cli](https://github.com/marp-team/marp-cli) can be used to convert the md to pdf:
|
The [marp-cli](https://github.com/marp-team/marp-cli) can be used to convert the md to pdf:
|
||||||
- Stand alone linux package https://github.com/marp-team/marp-cli/releases
|
- Stand alone linux package https://github.com/marp-team/marp-cli/releases
|
||||||
|
- run as server with PORT=5000 marp -s ./slides
|
||||||
|
- requires wget for download
|
||||||
|
- requires chrome to convert to pdf
|
||||||
- docker container https://hub.docker.com/r/marpteam/marp-cli/
|
- docker container https://hub.docker.com/r/marpteam/marp-cli/
|
||||||
`docker run --rm --init -v $PWD:/home/marp/app/ -e LANG=$LANG marpteam/marp-cli slide-deck.md --pdf`
|
`docker run --rm --init -v $PWD:/home/marp/app/ -e LANG=$LANG marpteam/marp-cli slide-deck.md --pdf`
|
||||||
|
- Run marp cli in its own docker container in server mode!!!
|
||||||
|
- output folder as volumne, so that marp container can assess it
|
||||||
|
|
||||||
powerpoint export is also possible with --pptx
|
powerpoint export is also possible with --pptx
|
||||||
|
|
||||||
@ -32,5 +37,48 @@ https://pythonise.com/series/learning-flask/flask-uploading-files
|
|||||||
python docker wait for container
|
python docker wait for container
|
||||||
|
|
||||||
|
|
||||||
|
CLI binary:
|
||||||
|
|
||||||
|
convert file
|
||||||
|
./marp --pdf ./slides/slide-deck.md
|
||||||
|
./marp --pdf ./slides/slide-deck.md
|
||||||
|
/opt/marp --pdf /code/csv-to-marp-converter/
|
||||||
|
|
||||||
|
start server
|
||||||
|
./marp --pdf --server ./slides/
|
||||||
|
PORT=4100 /opt/marp-cli --server ./
|
||||||
|
|
||||||
|
|
||||||
|
use marp server:
|
||||||
|
- link or embed marp server path (http://localhost:8080/) from result html
|
||||||
|
- Dockerfile
|
||||||
|
- download latest marp binary
|
||||||
|
- start server (on correct port)
|
||||||
|
|
||||||
|
wget -O marp-cli.tar.gz https://github.com/marp-team/marp-cli/releases/download/v1.1.1/marp-cli-v1.1.1-linux.tar.gz
|
||||||
|
|
||||||
|
|
||||||
|
when running release version from
|
||||||
|
|
||||||
|
[ WARN ] The environment variable CHROME_PATH must be set to executable of a build of Chromium version 54.0 or later.
|
||||||
|
[ ERROR ] Failed converting Markdown. (You have to install Google Chrome, Chromium, or Microsoft Edge to convert slide deck with current options.)
|
||||||
|
|
||||||
|
|
||||||
|
when running cli with docker
|
||||||
|
docker run -v $PWD:/home/marp/app/ -e LANG=$LANG marpteam/marp-cli quiz-slides-template.md --pdf
|
||||||
|
|
||||||
|
[ ERROR ] Failed converting Markdown. (EACCES: permission denied, open
|
||||||
|
'/home/marp/app/quiz-slides-template.pdf')
|
||||||
|
|
||||||
|
chmod -R 0777 output/
|
||||||
|
|
||||||
|
docker run -v $PWD:/home/marp/app/ -e LANG=$LANG -e PORT=4100 -p 4100:4100 marpteam/marp-cli --server ./ -d
|
||||||
|
|
||||||
|
docker run -d -v /home/marcelo/git/docker-python-multi-service/csv-to-marp-converter/output:/home/marp/app/ -e LANG=$LANG -e PORT=4100 -p 4100:4100 marpteam/marp-cli --server ./
|
||||||
|
|
||||||
|
run on NAS:
|
||||||
|
sudo docker run -d -v /volume1/docker/dockerpython/docker-python-multi-service/csv-marp-converter-output:/home/marp/app/ -e LANG=$LANG -e PORT=4100 -p 4100:4100 --name marp marpteam/marp-cli --server -I ./
|
||||||
|
- Folder that is mounted should not be empty!!
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -61,7 +61,10 @@ def upload_image():
|
|||||||
csv_file.save(output_file_path)
|
csv_file.save(output_file_path)
|
||||||
|
|
||||||
# run converter
|
# run converter
|
||||||
converter.convert(output_file_path, True)
|
if config_parser.prod_mode:
|
||||||
|
converter.convert(output_file_path, False)
|
||||||
|
else:
|
||||||
|
converter.convert(output_file_path, True)
|
||||||
|
|
||||||
return render_template("return_result.html")
|
return render_template("return_result.html")
|
||||||
# return redirect(request.url)
|
# return redirect(request.url)
|
||||||
@ -112,6 +115,17 @@ def valid_csv(filename):
|
|||||||
# # return "bla"
|
# # return "bla"
|
||||||
# return render_template("tagebuch_output.html", markdown_result=data, markdown_filename=filename)
|
# return render_template("tagebuch_output.html", markdown_result=data, markdown_filename=filename)
|
||||||
|
|
||||||
|
def get_marp_url():
|
||||||
|
if config_parser.prod_mode:
|
||||||
|
return "https://marp.swaghausen.de"
|
||||||
|
else:
|
||||||
|
return "http://localhost:4100"
|
||||||
|
|
||||||
|
@app.route('/marp')
|
||||||
|
def redirect_to_marp():
|
||||||
|
return redirect(get_marp_url(), code=302)
|
||||||
|
# return get_marp_url()
|
||||||
|
|
||||||
|
|
||||||
@app.route(URL_BASE_PATH + 'download', methods=['GET'])
|
@app.route(URL_BASE_PATH + 'download', methods=['GET'])
|
||||||
# @auth.login_required
|
# @auth.login_required
|
||||||
|
@ -11,5 +11,6 @@
|
|||||||
<!-- will call e.g. route /tagebuch/download/2021-02 -->
|
<!-- will call e.g. route /tagebuch/download/2021-02 -->
|
||||||
<a class="btn btn-primary" href="{{url_for('download_file')}}">Download Markdown File</a>
|
<a class="btn btn-primary" href="{{url_for('download_file')}}">Download Markdown File</a>
|
||||||
<a class="btn btn-primary" href="{{url_for('download_pdf_file')}}">Download PDF File</a>
|
<a class="btn btn-primary" href="{{url_for('download_pdf_file')}}">Download PDF File</a>
|
||||||
|
<a class="btn btn-primary" href="{{url_for('redirect_to_marp')}}">Go To Marp Server</a>
|
||||||
</p>
|
</p>
|
||||||
{% endblock %}
|
{% endblock %}
|
Loading…
x
Reference in New Issue
Block a user