Skip to content

Commit

Permalink
PDF Support updates
Browse files Browse the repository at this point in the history
  • Loading branch information
timlinux committed Dec 6, 2023
1 parent d456fdd commit de93f33
Show file tree
Hide file tree
Showing 9 changed files with 90 additions and 64 deletions.
2 changes: 1 addition & 1 deletion animation_workbench/metadata.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description=A plugin to let you build animations in QGIS
about=QGIS Animation Bench exists because we wanted to use all the awesome cartography features in QGIS and make cool, animated maps! QGIS already includes the Temporal Manager which allows you to produce animations for time-based data. But what if you want to make animations where you travel around the map, zooming in and out, and perhaps making features on the map wiggle and jiggle as the animation progresses? That is what the animation workbench tries to solve...
version=1.2
qgisMinimumVersion=3.0
author=Tim Sutton, Nyall Dawson,
author=Tim Sutton, Nyall Dawson, Jeremy Prior
email=tim@kartoza.com
repository=https://github.com/timlinux/QGISAnimationPlugin
license=GPLv2
1 change: 1 addition & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
site
templates/styles.scss
12 changes: 10 additions & 2 deletions docs/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ in pkgs.mkShell rec {
pythonPackages.numpy
pythonPackages.requests
pythonPackages.pygobject3
# Doesnt work properly
#python311Packages.cffi

# In this particular example, in order to compile any binary extensions they may
# require, the Python modules listed in the hypothetical requirements.txt need
Expand All @@ -41,15 +43,21 @@ in pkgs.mkShell rec {
libzip
zlib
gnused
httplz # for serving up the static site while testing
rpl
];

# Run this command, only after creating the virtual environment
postVenvCreation = ''
unset SOURCE_DATE_EPOCH
pip install -r requirements.txt
pip install -r requirements.txt
# Need to manually install this because of https://github.com/comwes/mkpdfs-mkdocs-plugin/pull/15
pip install -e git+https://github.com/jwaschkau/mkpdfs-mkdocs-plugin.git#egg=mkpdfs-mkdocs
rpl -R "from weasyprint.fonts import FontConfiguration" "from weasyprint.text.fonts import FontConfiguration" .venv/src/mkpdfs-mkdocs/mkpdfs_mkdocs/mkpdfs.py
rpl -R "from weasyprint.fonts import FontConfiguration" "from weasyprint.text.fonts import FontConfiguration" .venv/lib/python3.11/site-packages/mkpdfs_mkdocs/generator.py
'';

shellHook = ''
'';
# Now we can execute any commands within the virtual environment.
# This is optional and can be left out to run pip manually.
postShellHook = ''
Expand Down
112 changes: 57 additions & 55 deletions docs/mkdocs-pdf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,60 +2,62 @@
# scripts for how this is used

plugins:
- mkpdfs:
company: Kartoza
author: Tim Sutton and Nyall Dawson
#- mkpdfs:
# company: Kartoza
# author: Tim Sutton, Nyall Dawson and Jeremy Prior
# output_path: ../pdfs/QGISAnimationWorkbench.pdf
# design: templates/styles.scss
# Alternative PDF creation system but no longer works
#
#- with-pdf:
# # Generate the whole site as a single PDF
# # Full details on this plugin here:
# # https://github.com/orzih/mkdocs-with-pdf
# # And don't get it confused with https://github.com/zhaoterryy/mkdocs-pdf-export-plugin
# # which is intended to export a single page at a time
# output_path: ../pdfs/QGISAnimationWorkbench.pdf
# author: Tim Sutton, Nyall Dawson
# # copyright will draw in page.bottom-right
# # do it manually in templates/styles.scss
# # for more control
# # if you comment out here or use an empty string,
# # the copyright text from mkdocs-base.yml will be
# # used instead
# copyright: ' '
# cover: true # see templates/cover.html
# back_cover: true
# cover_title: The QGIS Animation Workbench
# cover_subtitle: Bring your QGIS maps to life!
# cover_logo: ../resources/img/logo/animation-workbench-logo.svg
# # Print css is defined in templates/styles.scss
# #custom_template_path: TEMPLATES PATH
# #
# toc_title: Contents
# #heading_shift: false
# # Set to 0 so that it does not generate chapter numbering
# # we do the numbering in styles.css rather
# toc_level: 0
# ordered_chapter_level: 0
# #excludes_children:
# # - 'release-notes/:upgrading'
# # - 'release-notes/:changelog'
# #
# #exclude_pages:
# # - 'bugs/'
# # - 'appendix/contribute/'
# #convert_iframe:
# # - src: IFRAME SRC
# # img: POSTER IMAGE URL
# # text: ALTERNATE TEXT
# # - src: ...
# #two_columns_level: 3
# #
# #render_js: true
# #headless_chrome_path: headless-chromium
# #
# #enabled_if_env: ENABLE_PDF_EXPORT
# # See notes at the top of templates/styles.scss
# # for debugging workflow details.
# debug_html: true
# #show_anchors: true
- with-pdf:
# Generate the whole site as a single PDF
# Full details on this plugin here:
# https://github.com/orzih/mkdocs-with-pdf
# And don't get it confused with https://github.com/zhaoterryy/mkdocs-pdf-export-plugin
# which is intended to export a single page at a time
output_path: ../pdfs/QGISAnimationWorkbench.pdf
author: Tim Sutton, Nyall Dawson
# copyright will draw in page.bottom-right
# do it manually in templates/styles.scss
# for more control
# if you comment out here or use an empty string,
# the copyright text from mkdocs-base.yml will be
# used instead
copyright: ' '
cover: true # see templates/cover.html
back_cover: true
cover_title: The QGIS Animation Workbench
cover_subtitle: Bring your QGIS maps to life!
cover_logo: ../resources/img/logo/animation-workbench-logo.svg
# Print css is defined in templates/styles.scss
#custom_template_path: TEMPLATES PATH
#
toc_title: Contents
#heading_shift: false
# Set to 0 so that it does not generate chapter numbering
# we do the numbering in styles.css rather
toc_level: 0
ordered_chapter_level: 0
#excludes_children:
# - 'release-notes/:upgrading'
# - 'release-notes/:changelog'
#
#exclude_pages:
# - 'bugs/'
# - 'appendix/contribute/'
#convert_iframe:
# - src: IFRAME SRC
# img: POSTER IMAGE URL
# text: ALTERNATE TEXT
# - src: ...
#two_columns_level: 3
#
#render_js: true
#headless_chrome_path: headless-chromium
#

#enabled_if_env: ENABLE_PDF_EXPORT
# See notes at the top of templates/styles.scss
# for debugging workflow details.
debug_html: true
#show_anchors: true
Binary file modified docs/pdfs/QGISAnimationWorkbench.pdf
Binary file not shown.
8 changes: 5 additions & 3 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#Alternative for pdf creation - broken on nixos and lately ubuntu
#mkdocs-with-pdf
mkdocs-with-pdf
# Export to pdf - see https://comwes.github.io/mkpdfs-mkdocs-plugin/index.html
mkpdfs-mkdocs

#mkpdfs-mkdocs
# Rather do
# pip install -e git+https://github.com/jwaschkau/mkpdfs-mkdocs-plugin.git#egg=mkpdfs-mkdocs
mkdocs-material
mdx_gh_links
mkdocs-pdf-export-plugin
Expand All @@ -15,3 +16,4 @@ mkdocs-git-revision-date-localized-plugin
shortuuid
# Needed for mkdocstrings python documentation generator
black
cffi
5 changes: 4 additions & 1 deletion docs/src/tutorials/tutorial5.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,10 @@ if (

## Final Render

There are still a few details that would need to be taken care of to reach a final solution - in particular taking care of datelines and the like. Buhere is a little example of what we managed to make thus far (without any debugging text).
There are still a few details that would need to be taken care of to reach a
final solution - in particular taking care of datelines and the like. But here is
a little example of what we managed to make thus far (without any debugging
text).


![](img/tut_5/planar_map_final.gif)
Expand Down
7 changes: 6 additions & 1 deletion docs/templates/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -412,4 +412,9 @@ ul,
ol,
dl {
page-break-before: avoid;
}
}

.external-link::after {
content: " (" attr(href) ")";
font-style: italic;
}
7 changes: 6 additions & 1 deletion docs/templates/styles.scss.templ
Original file line number Diff line number Diff line change
Expand Up @@ -412,4 +412,9 @@ ul,
ol,
dl {
page-break-before: avoid;
}
}

.external-link::after {
content: " (" attr(href) ")";
font-style: italic;
}

0 comments on commit de93f33

Please sign in to comment.