From d307c46aba26643719645210a0aaab29a7f053f5 Mon Sep 17 00:00:00 2001 From: orzih Date: Mon, 11 Jan 2021 11:21:13 +0900 Subject: [PATCH] Fixed run on Python 3.5. --- CHANGELOG | 4 + Pipfile | 3 +- Pipfile.lock | 286 ++++++++++-------- mkdocs_with_pdf/cover.py | 4 +- mkdocs_with_pdf/drivers/event_hook.py | 6 +- mkdocs_with_pdf/drivers/headless_chrome.py | 4 +- mkdocs_with_pdf/generator.py | 52 ++-- mkdocs_with_pdf/plugin.py | 9 +- .../preprocessor/links/transform.py | 8 +- mkdocs_with_pdf/styles/__init__.py | 22 +- mkdocs_with_pdf/templates/filters/qrcode.py | 3 +- mkdocs_with_pdf/templates/template.py | 4 +- mkdocs_with_pdf/toc.py | 19 +- mkdocs_with_pdf/utils/emoji_util.py | 6 +- mkdocs_with_pdf/utils/image_util.py | 10 +- setup.py | 2 +- tests/test_links.py | 2 +- 17 files changed, 241 insertions(+), 203 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index b0e54e3d..58a1168c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +mkdocs-with-pdf 0.8.3 (2021-01-11) + + * Fixed run on Python 3.5. + mkdocs-with-pdf 0.8.2 (2021-01-08) * Added a rendering hook module handler. diff --git a/Pipfile b/Pipfile index 028de4c6..4e680089 100644 --- a/Pipfile +++ b/Pipfile @@ -13,7 +13,6 @@ autopep8 = "*" mdx-gh-links = "*" mkdocs-redirects = "*" mkdocs-minify-plugin = "*" -python-barcode = "*" qrcode = "*" [packages] @@ -30,5 +29,5 @@ weasyprint = "*" [scripts] lint = "flake8 --show-source mkdocs_with_pdf" -format = "autopep8 -ivr mkdocs_with_pdf" +format = "autopep8 -ivaar mkdocs_with_pdf" test = "python -m unittest discover -v -s tests" diff --git a/Pipfile.lock b/Pipfile.lock index e5c9e9e6..9aa41c77 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "a6cea020178e4f24c31ece2f1f1d1a0ec99db0be213650ad929cc29fb9ce3ef4" + "sha256": "2fd1c35ed8fee048899f294ccdedd923e0841e339b995b2a27fe0b36cd5c1168" }, "pipfile-spec": 6, "requires": {}, @@ -25,10 +25,10 @@ }, "cairocffi": { "hashes": [ - "sha256:9a979b500c64c8179fec286f337e8fe644eca2f2cd05860ce0b62d25f22ea140" + "sha256:f1c0c5878f74ac9ccb5d48b2601fcc75390c881ce476e79f4cfedd288b1b05db" ], - "markers": "python_version >= '3.6'", - "version": "==1.2.0" + "markers": "python_version >= '3.5'", + "version": "==1.1.0" }, "cairosvg": { "hashes": [ @@ -89,11 +89,11 @@ }, "cssselect2": { "hashes": [ - "sha256:2f4a9f20965367bae459e3bb42561f7927e0cfe5b7ea1692757cf67ef5d7dace", - "sha256:93fbb9af860e95dd40bf18c3b2b6ed99189a07c0f29ba76f9c5be71344664ec8" + "sha256:5c2716f06b5de93f701d5755a9666f2ee22cbcd8b4da8adddfc30095ffea3abc", + "sha256:97d7d4234f846f9996d838964d38e13b45541c18143bc55cf00e4bc1281ace76" ], - "markers": "python_version >= '3.6'", - "version": "==0.4.1" + "markers": "python_version >= '3.5'", + "version": "==0.3.0" }, "defusedxml": { "hashes": [ @@ -107,7 +107,7 @@ "hashes": [ "sha256:b1bead90b70cf6ec3f0710ae53a525360fa360d306a86583adc6bf83a4db537d" ], - "markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'", + "markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2'", "version": "==0.18.2" }, "html5lib": { @@ -118,6 +118,14 @@ "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'", "version": "==1.1" }, + "importlib-metadata": { + "hashes": [ + "sha256:b8de9eff2b35fb037368f28a7df1df4e6436f578fa74423505b6c6a778d5b5dd", + "sha256:c2d6341ff566f609e89a2acb2db190e5e1d23d5409d6cc8d2fe34d72443876d4" + ], + "markers": "python_version < '3.8'", + "version": "==2.1.1" + }, "jinja2": { "hashes": [ "sha256:89aab215427ef59c34ad58735269eb58b1a5808103067f7bb9d5836c651b3bb0", @@ -128,11 +136,10 @@ }, "joblib": { "hashes": [ - "sha256:75ead23f13484a2a414874779d69ade40d4fa1abe62b222a23cd50d4bc822f6f", - "sha256:7ad866067ac1fdec27d51c8678ea760601b70e32ff1881d4dc8e1171f2b64b24" + "sha256:0630eea4f5664c463f23fbf5dcfc54a2bc6168902719fa8e19daf033022786c8", + "sha256:bdb4fd9b72915ffb49fde2229ce482dd7ae79d842ed8c2b4c932441495af1403" ], - "markers": "python_version >= '3.6'", - "version": "==1.0.0" + "version": "==0.14.1" }, "libsass": { "hashes": [ @@ -171,11 +178,11 @@ }, "markdown": { "hashes": [ - "sha256:5d9f2b5ca24bc4c7a390d22323ca4bad200368612b5aaa7796babf971d2b2f18", - "sha256:c109c15b7dc20a9ac454c9e6025927d44460b85bd039da028d85e2b6d0bcc328" + "sha256:1fafe3f1ecabfb514a5285fca634a53c1b32a81cb0feb154264d55bf2ff22c17", + "sha256:c467cd6233885534bf0fe96e62e3cf46cfc1605112356c4f9981512b8174de59" ], - "markers": "python_version >= '3.6'", - "version": "==3.3.3" + "markers": "python_version >= '3.5'", + "version": "==3.2.2" }, "markupsafe": { "hashes": [ @@ -232,37 +239,37 @@ }, "pillow": { "hashes": [ - "sha256:165c88bc9d8dba670110c689e3cc5c71dbe4bfb984ffa7cbebf1fac9554071d6", - "sha256:22d070ca2e60c99929ef274cfced04294d2368193e935c5d6febfd8b601bf865", - "sha256:2353834b2c49b95e1313fb34edf18fca4d57446675d05298bb694bca4b194174", - "sha256:39725acf2d2e9c17356e6835dccebe7a697db55f25a09207e38b835d5e1bc032", - "sha256:3de6b2ee4f78c6b3d89d184ade5d8fa68af0848f9b6b6da2b9ab7943ec46971a", - "sha256:47c0d93ee9c8b181f353dbead6530b26980fe4f5485aa18be8f1fd3c3cbc685e", - "sha256:5e2fe3bb2363b862671eba632537cd3a823847db4d98be95690b7e382f3d6378", - "sha256:604815c55fd92e735f9738f65dabf4edc3e79f88541c221d292faec1904a4b17", - "sha256:6c5275bd82711cd3dcd0af8ce0bb99113ae8911fc2952805f1d012de7d600a4c", - "sha256:731ca5aabe9085160cf68b2dbef95fc1991015bc0a3a6ea46a371ab88f3d0913", - "sha256:7612520e5e1a371d77e1d1ca3a3ee6227eef00d0a9cddb4ef7ecb0b7396eddf7", - "sha256:7916cbc94f1c6b1301ac04510d0881b9e9feb20ae34094d3615a8a7c3db0dcc0", - "sha256:81c3fa9a75d9f1afafdb916d5995633f319db09bd773cb56b8e39f1e98d90820", - "sha256:887668e792b7edbfb1d3c9d8b5d8c859269a0f0eba4dda562adb95500f60dbba", - "sha256:93a473b53cc6e0b3ce6bf51b1b95b7b1e7e6084be3a07e40f79b42e83503fbf2", - "sha256:96d4dc103d1a0fa6d47c6c55a47de5f5dafd5ef0114fa10c85a1fd8e0216284b", - "sha256:a3d3e086474ef12ef13d42e5f9b7bbf09d39cf6bd4940f982263d6954b13f6a9", - "sha256:b02a0b9f332086657852b1f7cb380f6a42403a6d9c42a4c34a561aa4530d5234", - "sha256:b09e10ec453de97f9a23a5aa5e30b334195e8d2ddd1ce76cc32e52ba63c8b31d", - "sha256:b6f00ad5ebe846cc91763b1d0c6d30a8042e02b2316e27b05de04fa6ec831ec5", - "sha256:bba80df38cfc17f490ec651c73bb37cd896bc2400cfba27d078c2135223c1206", - "sha256:c3d911614b008e8a576b8e5303e3db29224b455d3d66d1b2848ba6ca83f9ece9", - "sha256:ca20739e303254287138234485579b28cb0d524401f83d5129b5ff9d606cb0a8", - "sha256:cb192176b477d49b0a327b2a5a4979552b7a58cd42037034316b8018ac3ebb59", - "sha256:cdbbe7dff4a677fb555a54f9bc0450f2a21a93c5ba2b44e09e54fcb72d2bd13d", - "sha256:d355502dce85ade85a2511b40b4c61a128902f246504f7de29bbeec1ae27933a", - "sha256:dc577f4cfdda354db3ae37a572428a90ffdbe4e51eda7849bf442fb803f09c9b", - "sha256:dd9eef866c70d2cbbea1ae58134eaffda0d4bfea403025f4db6859724b18ab3d" - ], - "markers": "python_version >= '3.6'", - "version": "==8.1.0" + "sha256:0295442429645fa16d05bd567ef5cff178482439c9aad0411d3f0ce9b88b3a6f", + "sha256:06aba4169e78c439d528fdeb34762c3b61a70813527a2c57f0540541e9f433a8", + "sha256:09d7f9e64289cb40c2c8d7ad674b2ed6105f55dc3b09aa8e4918e20a0311e7ad", + "sha256:0a80dd307a5d8440b0a08bd7b81617e04d870e40a3e46a32d9c246e54705e86f", + "sha256:1ca594126d3c4def54babee699c055a913efb01e106c309fa6b04405d474d5ae", + "sha256:25930fadde8019f374400f7986e8404c8b781ce519da27792cbe46eabec00c4d", + "sha256:431b15cffbf949e89df2f7b48528be18b78bfa5177cb3036284a5508159492b5", + "sha256:52125833b070791fcb5710fabc640fc1df07d087fc0c0f02d3661f76c23c5b8b", + "sha256:5e51ee2b8114def244384eda1c82b10e307ad9778dac5c83fb0943775a653cd8", + "sha256:612cfda94e9c8346f239bf1a4b082fdd5c8143cf82d685ba2dba76e7adeeb233", + "sha256:6d7741e65835716ceea0fd13a7d0192961212fd59e741a46bbed7a473c634ed6", + "sha256:6edb5446f44d901e8683ffb25ebdfc26988ee813da3bf91e12252b57ac163727", + "sha256:725aa6cfc66ce2857d585f06e9519a1cc0ef6d13f186ff3447ab6dff0a09bc7f", + "sha256:8dad18b69f710bf3a001d2bf3afab7c432785d94fcf819c16b5207b1cfd17d38", + "sha256:94cf49723928eb6070a892cb39d6c156f7b5a2db4e8971cb958f7b6b104fb4c4", + "sha256:97f9e7953a77d5a70f49b9a48da7776dc51e9b738151b22dacf101641594a626", + "sha256:9ad7f865eebde135d526bb3163d0b23ffff365cf87e767c649550964ad72785d", + "sha256:9c87ef410a58dd54b92424ffd7e28fd2ec65d2f7fc02b76f5e9b2067e355ebf6", + "sha256:a060cf8aa332052df2158e5a119303965be92c3da6f2d93b6878f0ebca80b2f6", + "sha256:c79f9c5fb846285f943aafeafda3358992d64f0ef58566e23484132ecd8d7d63", + "sha256:c92302a33138409e8f1ad16731568c55c9053eee71bb05b6b744067e1b62380f", + "sha256:d08b23fdb388c0715990cbc06866db554e1822c4bdcf6d4166cf30ac82df8c41", + "sha256:d350f0f2c2421e65fbc62690f26b59b0bcda1b614beb318c81e38647e0f673a1", + "sha256:e901964262a56d9ea3c2693df68bc9860b8bdda2b04768821e4c44ae797de117", + "sha256:ec29604081f10f16a7aea809ad42e27764188fc258b02259a03a8ff7ded3808d", + "sha256:edf31f1150778abd4322444c393ab9c7bd2af271dd4dafb4208fb613b1f3cdc9", + "sha256:f7e30c27477dffc3e85c2463b3e649f751789e0f6c8456099eea7ddd53be4a8a", + "sha256:ffe538682dc19cc542ae7c3e504fdf54ca7f86fb8a135e59dd6bc8627eae6cce" + ], + "markers": "python_version >= '3.5'", + "version": "==7.2.0" }, "pycparser": { "hashes": [ @@ -348,7 +355,7 @@ "sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259", "sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced" ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2'", "version": "==1.15.0" }, "soupsieve": { @@ -361,11 +368,11 @@ }, "tinycss2": { "hashes": [ - "sha256:0353b5234bcaee7b1ac7ca3dea7e02cd338a9f8dcbb8f2dcd32a5795ec1e5f9a", - "sha256:fbdcac3044d60eb85fdb2aa840ece43cf7dbe798e373e6ee0be545d4d134e18a" + "sha256:6427d0e3faa0a5e0e8c9f6437e2de26148a7a197a8b0992789f23d9a802788cf", + "sha256:9fdacc0e22d344ddd2ca053837c133900fe820ae1222f63b79617490a498507a" ], - "markers": "python_version >= '3.6'", - "version": "==1.1.0" + "markers": "python_version >= '3.5'", + "version": "==1.0.2" }, "tornado": { "hashes": [ @@ -416,19 +423,19 @@ }, "tqdm": { "hashes": [ - "sha256:556c55b081bd9aa746d34125d024b73f0e2a0e62d5927ff0e400e20ee0a03b9a", - "sha256:b8b46036fd00176d0870307123ef06bb851096964fa7fc578d789f90ce82c3e4" + "sha256:54985cecd51071f3faa2a07a862c24be1426f925353d82b3dde03f7609d63248", + "sha256:86ca00c4942c3b3dc7ed31bae44cd2db38ef85ca05a7920f6a6c52ad7fcac904" ], "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==4.55.1" + "version": "==4.55.2" }, "weasyprint": { "hashes": [ - "sha256:21a1a9f11650ed14241817bf333a0ae0a42f6ae38cd7c2654845cb17352b7434", - "sha256:36b897d219e1944a1a0c97193a121fc175db326c660c50d937e874a995d9c716" + "sha256:469974f6e74b1eef71dc56a9b80cc17621f319234d2a4ab656ddd0fd9e66c27f", + "sha256:b3e971973a4f03c1430e6b838b75b5b57630415fcae8666d2be1347630ff6d6a" ], "index": "pypi", - "version": "==52.2" + "version": "==51" }, "webencodings": { "hashes": [ @@ -436,6 +443,14 @@ "sha256:b36a1c245f2d304965eb4e0a82848379241dc04b865afcc4aab16748587e1923" ], "version": "==0.5.1" + }, + "zipp": { + "hashes": [ + "sha256:c70410551488251b0fee67b460fb9a536af8d6f9f008ad10ac51f615b6a521b1", + "sha256:e0d9e63797e483a30d27e09fffd308c59a700d365ec34e93cc100844168bf921" + ], + "markers": "python_version >= '2.7'", + "version": "==1.2.0" } }, "develop": { @@ -457,10 +472,10 @@ }, "cairocffi": { "hashes": [ - "sha256:9a979b500c64c8179fec286f337e8fe644eca2f2cd05860ce0b62d25f22ea140" + "sha256:f1c0c5878f74ac9ccb5d48b2601fcc75390c881ce476e79f4cfedd288b1b05db" ], - "markers": "python_version >= '3.6'", - "version": "==1.2.0" + "markers": "python_version >= '3.5'", + "version": "==1.1.0" }, "cairosvg": { "hashes": [ @@ -521,11 +536,11 @@ }, "cssselect2": { "hashes": [ - "sha256:2f4a9f20965367bae459e3bb42561f7927e0cfe5b7ea1692757cf67ef5d7dace", - "sha256:93fbb9af860e95dd40bf18c3b2b6ed99189a07c0f29ba76f9c5be71344664ec8" + "sha256:5c2716f06b5de93f701d5755a9666f2ee22cbcd8b4da8adddfc30095ffea3abc", + "sha256:97d7d4234f846f9996d838964d38e13b45541c18143bc55cf00e4bc1281ace76" ], - "markers": "python_version >= '3.6'", - "version": "==0.4.1" + "markers": "python_version >= '3.5'", + "version": "==0.3.0" }, "defusedxml": { "hashes": [ @@ -547,7 +562,7 @@ "hashes": [ "sha256:b1bead90b70cf6ec3f0710ae53a525360fa360d306a86583adc6bf83a4db537d" ], - "markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'", + "markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2'", "version": "==0.18.2" }, "html5lib": { @@ -564,6 +579,14 @@ ], "version": "==0.1.12" }, + "importlib-metadata": { + "hashes": [ + "sha256:b8de9eff2b35fb037368f28a7df1df4e6436f578fa74423505b6c6a778d5b5dd", + "sha256:c2d6341ff566f609e89a2acb2db190e5e1d23d5409d6cc8d2fe34d72443876d4" + ], + "markers": "python_version < '3.8'", + "version": "==2.1.1" + }, "jinja2": { "hashes": [ "sha256:89aab215427ef59c34ad58735269eb58b1a5808103067f7bb9d5836c651b3bb0", @@ -574,11 +597,10 @@ }, "joblib": { "hashes": [ - "sha256:75ead23f13484a2a414874779d69ade40d4fa1abe62b222a23cd50d4bc822f6f", - "sha256:7ad866067ac1fdec27d51c8678ea760601b70e32ff1881d4dc8e1171f2b64b24" + "sha256:0630eea4f5664c463f23fbf5dcfc54a2bc6168902719fa8e19daf033022786c8", + "sha256:bdb4fd9b72915ffb49fde2229ce482dd7ae79d842ed8c2b4c932441495af1403" ], - "markers": "python_version >= '3.6'", - "version": "==1.0.0" + "version": "==0.14.1" }, "jsmin": { "hashes": [ @@ -623,11 +645,11 @@ }, "markdown": { "hashes": [ - "sha256:5d9f2b5ca24bc4c7a390d22323ca4bad200368612b5aaa7796babf971d2b2f18", - "sha256:c109c15b7dc20a9ac454c9e6025927d44460b85bd039da028d85e2b6d0bcc328" + "sha256:1fafe3f1ecabfb514a5285fca634a53c1b32a81cb0feb154264d55bf2ff22c17", + "sha256:c467cd6233885534bf0fe96e62e3cf46cfc1605112356c4f9981512b8174de59" ], - "markers": "python_version >= '3.6'", - "version": "==3.3.3" + "markers": "python_version >= '3.5'", + "version": "==3.2.2" }, "markupsafe": { "hashes": [ @@ -693,11 +715,11 @@ }, "mkdocs-material": { "hashes": [ - "sha256:3307d735b681f954eb1c89b64b1f4baa5a2b1a4e87a33c81244d55191c63c943", - "sha256:b79f1d8534e834de5823f463a036b505689a2130d68a510cdb3da70e18675e27" + "sha256:5bc6fb8c161818ec2507517e90c8df5827edc2c7cadfb8fe40716f8a7903f87a", + "sha256:ce602f7c712b217b18a5c1c413de38572856be13704d0b484c33c687ccbe6c3d" ], "index": "pypi", - "version": "==6.2.3" + "version": "==6.2.4" }, "mkdocs-material-extensions": { "hashes": [ @@ -734,37 +756,37 @@ }, "pillow": { "hashes": [ - "sha256:165c88bc9d8dba670110c689e3cc5c71dbe4bfb984ffa7cbebf1fac9554071d6", - "sha256:22d070ca2e60c99929ef274cfced04294d2368193e935c5d6febfd8b601bf865", - "sha256:2353834b2c49b95e1313fb34edf18fca4d57446675d05298bb694bca4b194174", - "sha256:39725acf2d2e9c17356e6835dccebe7a697db55f25a09207e38b835d5e1bc032", - "sha256:3de6b2ee4f78c6b3d89d184ade5d8fa68af0848f9b6b6da2b9ab7943ec46971a", - "sha256:47c0d93ee9c8b181f353dbead6530b26980fe4f5485aa18be8f1fd3c3cbc685e", - "sha256:5e2fe3bb2363b862671eba632537cd3a823847db4d98be95690b7e382f3d6378", - "sha256:604815c55fd92e735f9738f65dabf4edc3e79f88541c221d292faec1904a4b17", - "sha256:6c5275bd82711cd3dcd0af8ce0bb99113ae8911fc2952805f1d012de7d600a4c", - "sha256:731ca5aabe9085160cf68b2dbef95fc1991015bc0a3a6ea46a371ab88f3d0913", - "sha256:7612520e5e1a371d77e1d1ca3a3ee6227eef00d0a9cddb4ef7ecb0b7396eddf7", - "sha256:7916cbc94f1c6b1301ac04510d0881b9e9feb20ae34094d3615a8a7c3db0dcc0", - "sha256:81c3fa9a75d9f1afafdb916d5995633f319db09bd773cb56b8e39f1e98d90820", - "sha256:887668e792b7edbfb1d3c9d8b5d8c859269a0f0eba4dda562adb95500f60dbba", - "sha256:93a473b53cc6e0b3ce6bf51b1b95b7b1e7e6084be3a07e40f79b42e83503fbf2", - "sha256:96d4dc103d1a0fa6d47c6c55a47de5f5dafd5ef0114fa10c85a1fd8e0216284b", - "sha256:a3d3e086474ef12ef13d42e5f9b7bbf09d39cf6bd4940f982263d6954b13f6a9", - "sha256:b02a0b9f332086657852b1f7cb380f6a42403a6d9c42a4c34a561aa4530d5234", - "sha256:b09e10ec453de97f9a23a5aa5e30b334195e8d2ddd1ce76cc32e52ba63c8b31d", - "sha256:b6f00ad5ebe846cc91763b1d0c6d30a8042e02b2316e27b05de04fa6ec831ec5", - "sha256:bba80df38cfc17f490ec651c73bb37cd896bc2400cfba27d078c2135223c1206", - "sha256:c3d911614b008e8a576b8e5303e3db29224b455d3d66d1b2848ba6ca83f9ece9", - "sha256:ca20739e303254287138234485579b28cb0d524401f83d5129b5ff9d606cb0a8", - "sha256:cb192176b477d49b0a327b2a5a4979552b7a58cd42037034316b8018ac3ebb59", - "sha256:cdbbe7dff4a677fb555a54f9bc0450f2a21a93c5ba2b44e09e54fcb72d2bd13d", - "sha256:d355502dce85ade85a2511b40b4c61a128902f246504f7de29bbeec1ae27933a", - "sha256:dc577f4cfdda354db3ae37a572428a90ffdbe4e51eda7849bf442fb803f09c9b", - "sha256:dd9eef866c70d2cbbea1ae58134eaffda0d4bfea403025f4db6859724b18ab3d" - ], - "markers": "python_version >= '3.6'", - "version": "==8.1.0" + "sha256:0295442429645fa16d05bd567ef5cff178482439c9aad0411d3f0ce9b88b3a6f", + "sha256:06aba4169e78c439d528fdeb34762c3b61a70813527a2c57f0540541e9f433a8", + "sha256:09d7f9e64289cb40c2c8d7ad674b2ed6105f55dc3b09aa8e4918e20a0311e7ad", + "sha256:0a80dd307a5d8440b0a08bd7b81617e04d870e40a3e46a32d9c246e54705e86f", + "sha256:1ca594126d3c4def54babee699c055a913efb01e106c309fa6b04405d474d5ae", + "sha256:25930fadde8019f374400f7986e8404c8b781ce519da27792cbe46eabec00c4d", + "sha256:431b15cffbf949e89df2f7b48528be18b78bfa5177cb3036284a5508159492b5", + "sha256:52125833b070791fcb5710fabc640fc1df07d087fc0c0f02d3661f76c23c5b8b", + "sha256:5e51ee2b8114def244384eda1c82b10e307ad9778dac5c83fb0943775a653cd8", + "sha256:612cfda94e9c8346f239bf1a4b082fdd5c8143cf82d685ba2dba76e7adeeb233", + "sha256:6d7741e65835716ceea0fd13a7d0192961212fd59e741a46bbed7a473c634ed6", + "sha256:6edb5446f44d901e8683ffb25ebdfc26988ee813da3bf91e12252b57ac163727", + "sha256:725aa6cfc66ce2857d585f06e9519a1cc0ef6d13f186ff3447ab6dff0a09bc7f", + "sha256:8dad18b69f710bf3a001d2bf3afab7c432785d94fcf819c16b5207b1cfd17d38", + "sha256:94cf49723928eb6070a892cb39d6c156f7b5a2db4e8971cb958f7b6b104fb4c4", + "sha256:97f9e7953a77d5a70f49b9a48da7776dc51e9b738151b22dacf101641594a626", + "sha256:9ad7f865eebde135d526bb3163d0b23ffff365cf87e767c649550964ad72785d", + "sha256:9c87ef410a58dd54b92424ffd7e28fd2ec65d2f7fc02b76f5e9b2067e355ebf6", + "sha256:a060cf8aa332052df2158e5a119303965be92c3da6f2d93b6878f0ebca80b2f6", + "sha256:c79f9c5fb846285f943aafeafda3358992d64f0ef58566e23484132ecd8d7d63", + "sha256:c92302a33138409e8f1ad16731568c55c9053eee71bb05b6b744067e1b62380f", + "sha256:d08b23fdb388c0715990cbc06866db554e1822c4bdcf6d4166cf30ac82df8c41", + "sha256:d350f0f2c2421e65fbc62690f26b59b0bcda1b614beb318c81e38647e0f673a1", + "sha256:e901964262a56d9ea3c2693df68bc9860b8bdda2b04768821e4c44ae797de117", + "sha256:ec29604081f10f16a7aea809ad42e27764188fc258b02259a03a8ff7ded3808d", + "sha256:edf31f1150778abd4322444c393ab9c7bd2af271dd4dafb4208fb613b1f3cdc9", + "sha256:f7e30c27477dffc3e85c2463b3e649f751789e0f6c8456099eea7ddd53be4a8a", + "sha256:ffe538682dc19cc542ae7c3e504fdf54ca7f86fb8a135e59dd6bc8627eae6cce" + ], + "markers": "python_version >= '3.5'", + "version": "==7.2.0" }, "pycodestyle": { "hashes": [ @@ -800,11 +822,11 @@ }, "pymdown-extensions": { "hashes": [ - "sha256:565583c5964ac8253896ef4a7f14023075503ca6514d7d470b343290b96fc6da", - "sha256:c0b285fdd6e8438895b0c4422847af012f32a487ae083ffafa4c21a151b4983b" + "sha256:9ba704052d4bdc04a7cd63f7db4ef6add73bafcef22c0cf6b2e3386cf4ece51e", + "sha256:a3689c04f4cbddacd9d569425c571ae07e2673cc4df63a26cdbf1abc15229137" ], "index": "pypi", - "version": "==8.1" + "version": "==8.0.1" }, "pyphen": { "hashes": [ @@ -813,14 +835,6 @@ ], "version": "==0.10.0" }, - "python-barcode": { - "hashes": [ - "sha256:daa32fb999a843812fbb1c75ff909638811af7c465f0a991e9e41d26d2a44a24", - "sha256:fafba4aa24e9d969777be521c294ff18f6c2b36ad63b5fc2f2108d972e23b252" - ], - "index": "pypi", - "version": "==0.13.1" - }, "pyyaml": { "hashes": [ "sha256:06a0d7ba600ce0b2d2fe2e78453a470b5a6e000a985dd4a4e54e436cc36b0e97", @@ -898,7 +912,7 @@ "sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259", "sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced" ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2'", "version": "==1.15.0" }, "soupsieve": { @@ -911,18 +925,18 @@ }, "tinycss2": { "hashes": [ - "sha256:0353b5234bcaee7b1ac7ca3dea7e02cd338a9f8dcbb8f2dcd32a5795ec1e5f9a", - "sha256:fbdcac3044d60eb85fdb2aa840ece43cf7dbe798e373e6ee0be545d4d134e18a" + "sha256:6427d0e3faa0a5e0e8c9f6437e2de26148a7a197a8b0992789f23d9a802788cf", + "sha256:9fdacc0e22d344ddd2ca053837c133900fe820ae1222f63b79617490a498507a" ], - "markers": "python_version >= '3.6'", - "version": "==1.1.0" + "markers": "python_version >= '3.5'", + "version": "==1.0.2" }, "toml": { "hashes": [ "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b", "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f" ], - "markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'", + "markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2'", "version": "==0.10.2" }, "tornado": { @@ -974,19 +988,19 @@ }, "tqdm": { "hashes": [ - "sha256:556c55b081bd9aa746d34125d024b73f0e2a0e62d5927ff0e400e20ee0a03b9a", - "sha256:b8b46036fd00176d0870307123ef06bb851096964fa7fc578d789f90ce82c3e4" + "sha256:54985cecd51071f3faa2a07a862c24be1426f925353d82b3dde03f7609d63248", + "sha256:86ca00c4942c3b3dc7ed31bae44cd2db38ef85ca05a7920f6a6c52ad7fcac904" ], "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==4.55.1" + "version": "==4.55.2" }, "weasyprint": { "hashes": [ - "sha256:21a1a9f11650ed14241817bf333a0ae0a42f6ae38cd7c2654845cb17352b7434", - "sha256:36b897d219e1944a1a0c97193a121fc175db326c660c50d937e874a995d9c716" + "sha256:469974f6e74b1eef71dc56a9b80cc17621f319234d2a4ab656ddd0fd9e66c27f", + "sha256:b3e971973a4f03c1430e6b838b75b5b57630415fcae8666d2be1347630ff6d6a" ], "index": "pypi", - "version": "==52.2" + "version": "==51" }, "webencodings": { "hashes": [ @@ -994,6 +1008,14 @@ "sha256:b36a1c245f2d304965eb4e0a82848379241dc04b865afcc4aab16748587e1923" ], "version": "==0.5.1" + }, + "zipp": { + "hashes": [ + "sha256:c70410551488251b0fee67b460fb9a536af8d6f9f008ad10ac51f615b6a521b1", + "sha256:e0d9e63797e483a30d27e09fffd308c59a700d365ec34e93cc100844168bf921" + ], + "markers": "python_version >= '2.7'", + "version": "==1.2.0" } } } diff --git a/mkdocs_with_pdf/cover.py b/mkdocs_with_pdf/cover.py index 10608378..ceb4b33d 100644 --- a/mkdocs_with_pdf/cover.py +++ b/mkdocs_with_pdf/cover.py @@ -23,7 +23,7 @@ def _make_cover(soup: PageElement, options: Options): keywords = options.template.keywords template = options.template.select(['cover', 'default_cover']) - options.logger.info(f'Generate a cover page with "{template.name}".') + options.logger.info('Generate a cover page with "%s".', template.name) soup_template = BeautifulSoup(template.render(keywords), 'html.parser') soup.body.insert(0, soup_template) @@ -38,7 +38,7 @@ def _make_back_cover(soup: PageElement, options: Options): ['back_cover', 'default_back_cover']) options.logger.info( - f'Generate a back cover page with "{template.name}".') + 'Generate a back cover page with "%s".', template.name) soup_template = BeautifulSoup(template.render(keywords), 'html.parser') soup.body.append(soup_template) diff --git a/mkdocs_with_pdf/drivers/event_hook.py b/mkdocs_with_pdf/drivers/event_hook.py index 99e8b169..69264343 100644 --- a/mkdocs_with_pdf/drivers/event_hook.py +++ b/mkdocs_with_pdf/drivers/event_hook.py @@ -16,9 +16,9 @@ class EventHookHandler(object): @classmethod def on_serve(cls, server, builder, logger: logging): - path = f'./{cls._module_name}.py' + path = './' + cls._module_name + '.py' if os.path.isfile(path): - logger.warn(f'watch {path}') + logger.warn('watch %s', path) server.watch(path, builder) def __init__(self, options: object, config: Config, logger: logging): @@ -37,7 +37,7 @@ def _load_module(self): module = __import__(self.__class__._module_name) importlib.reload(module) self._logger.info('Found PDF rendering event hook module.') - except ModuleNotFoundError: + except ImportError: module = None return module diff --git a/mkdocs_with_pdf/drivers/headless_chrome.py b/mkdocs_with_pdf/drivers/headless_chrome.py index 14afed10..af611a02 100644 --- a/mkdocs_with_pdf/drivers/headless_chrome.py +++ b/mkdocs_with_pdf/drivers/headless_chrome.py @@ -13,7 +13,7 @@ def setup(self, program_path: str, logger: Logger): if not which(program_path): raise RuntimeError( 'No such `Headless Chrome` program or not executable' - + f': "{program_path}".') + + ': ' + program_path + '.') return self(program_path, logger) def __init__(self, program_path: str, logger: Logger): @@ -41,7 +41,7 @@ def render(self, html: str) -> str: return chrome.stdout.read().decode('utf-8') except Exception as e: - self._logger.error(f'Failed to render by JS: {e}') + self._logger.error('Failed to render by JS: %s', e) finally: os.unlink(temp.name) diff --git a/mkdocs_with_pdf/generator.py b/mkdocs_with_pdf/generator.py index 2ee81845..aa2ee87f 100644 --- a/mkdocs_with_pdf/generator.py +++ b/mkdocs_with_pdf/generator.py @@ -38,7 +38,7 @@ def on_nav(self, nav): """ on_nav """ self._nav = nav if nav: - self._options.logger.debug(f'theme: {self._theme}') + self._options.logger.debug('theme: %s', self._theme) def on_post_page(self, output_content: str, page, pdf_path: str) -> str: """ on_post_page """ @@ -47,10 +47,10 @@ def is_excluded(url: str) -> bool: return url in self._options.exclude_pages if is_excluded(page.url): - self.logger.info(f'Page skipped: [{page.title}]({page.url})') - return f"" + self.logger.info('Page skipped: [%s](%s)', page.title, page.url) + return "".format(page) else: - self.logger.debug(f' (post: [{page.title}]({page.url})') + self.logger.debug(' (post: [%s](%s)', page.title, page.url) soup = self._soup_from_content(output_content, page) @@ -58,7 +58,7 @@ def is_excluded(url: str) -> bool: if not self._head: self._head = soup.find('head') - # self.logger.debug(f'{self._head}') + # self.logger.debug('%s', self._head) # for 'material' article = soup.find('article') @@ -83,7 +83,8 @@ def is_excluded(url: str) -> bool: setattr(page, 'pdf-article', article) self._scrap_scripts(soup) else: - self.logger.warning(f'Missing article: [{page.title}]({page.url})') + self.logger.warning( + 'Missing article: [%s](%s)', page.title, page.url) return self._options.hook.inject_link( output_content, pdf_path, page, self._theme) @@ -128,7 +129,7 @@ def add_stylesheet(stylesheet: str): html_string = self._options.hook.pre_pdf_render(html_string) if self._options.debug_html: - print(f'{html_string}') + print(html_string) self.logger.info("Rendering for PDF.") html = HTML(string=html_string) @@ -137,7 +138,7 @@ def add_stylesheet(stylesheet: str): abs_pdf_path = os.path.join(config['site_dir'], output_path) os.makedirs(os.path.dirname(abs_pdf_path), exist_ok=True) - self.logger.info(f'Output a PDF to "{abs_pdf_path}".') + self.logger.info('Output a PDF to "%s".', abs_pdf_path) render.write_pdf(abs_pdf_path) # ------------------------ @@ -156,7 +157,7 @@ def is_blank(el): hit = False for x in soup.find_all(): if x.name in includes and is_blank(x): - # self.logger.debug(f'Strip: {x}') + # self.logger.debug('Strip: %s'%(x)) x.extract() hit = True if not hit: @@ -199,13 +200,13 @@ def _get_content(self, soup: PageElement, page): def shift_heading(elem, page): for i in range(7, 0, -1): while True: - h = elem.find(f'h{i}') + h = elem.find('h%d' % (i)) if not h: break - h.name = f'h{i + 1}' + h.name = 'h%d' % (i + 1) page_path = self._page_path_for_id(page) - h1 = soup.new_tag('h1', id=f'{page_path}') + h1 = soup.new_tag('h1', id=str(page_path)) h1.append(page.title) elem.insert(0, h1) return elem @@ -220,8 +221,8 @@ def cleanup_class(classes: []): if article: page_path = self._page_path_for_id(page) - article['id'] = f'{page_path}:' # anchor for each page. - article['data-url'] = f'/{page_path}' + article['id'] = '{}:'.format(page_path) # anchor for each page. + article['data-url'] = '/{}'.format(page_path) return article elif page.children: @@ -246,8 +247,9 @@ def cleanup_class(classes: []): child_article['class'] = cleanup_class(classes) page_path = self._page_path_for_id(page) - new_article['id'] = f'{page_path}:' # anchor for each page. - new_article['data-url'] = f'/{page_path}' + # anchor for each page. + new_article['id'] = '{}:'.format(page_path) + new_article['data-url'] = '/{}'.format(page_path) if child_classes: new_article['class'] = child_classes @@ -282,14 +284,15 @@ def _load_theme_handler(self): return mod except FileNotFoundError as e: self.logger.error( - f'Could not load theme handler {theme}' - f' from custom directory "{custom_handler_path}": {e}') + 'Could not load theme handler %s' + ' from custom directory "%s": %s', + theme, custom_handler_path, e) pass try: return import_module(module_name, 'mkdocs_with_pdf.themes') except ImportError as e: - self.logger.error(f'Could not load theme handler {theme}: {e}') + self.logger.error('Could not load theme handler %s: %s', theme, e) return generic_theme # ------------------------------------------------------------- @@ -319,7 +322,7 @@ def normalize_anchor_chars(anchor: str): if not (self._options.strict or self._options.debug_html): self.logger.info('Anchor points provided:') for anchor in sorted(anchors): - self.logger.info(f'| {anchor}') + self.logger.info('| %s', anchor) return missing = set() @@ -335,15 +338,15 @@ def normalize_anchor_chars(anchor: str): missing.add(href) if len(missing): - self.logger.error(f'Missing {len(missing)} link(s):') + self.logger.error('Missing %d link(s):', len(missing)) for link in sorted(missing): - self.logger.warning(f' | {link}') + self.logger.warning(' | %s', link) if (self._options.show_anchors or self._options.verbose or self._options.debug_html): self.logger.info(' | --- found anchors:') for anchor in sorted(anchors): - self.logger.info(f' | {anchor}') + self.logger.info(' | %s', anchor) # ------------------------------------------------------------- @@ -365,7 +368,8 @@ def _render_js(self, soup): tag.text = self._mixed_script body.append(tag) for src in scripts: - body.append(soup.new_tag('script', src=f'file://{src}')) + body.append(soup.new_tag( + 'script', src='file://%s' % (src))) return self._options.js_renderer.render(str(soup)) diff --git a/mkdocs_with_pdf/plugin.py b/mkdocs_with_pdf/plugin.py index 87550bad..85969293 100644 --- a/mkdocs_with_pdf/plugin.py +++ b/mkdocs_with_pdf/plugin.py @@ -71,7 +71,8 @@ def on_config(self, config): if not self.enabled: self._logger.warning( 'without generate PDF' - f'(set environment variable {env_name} to 1 to enable)' + '(set environment variable %s to 1 to enable)', + env_name ) return else: @@ -135,15 +136,15 @@ def on_post_build(self, config): end = timer() self._total_time += (end - start) self._logger.info( - f'Converting {self._num_pages} articles to PDF' - f' took {self._total_time:.1f}s' + 'Converting {} articles to PDF' + ' took {:.1f}s'.format(self._num_pages, self._total_time) ) if self._error_counter: errors, warns = self._error_counter.counts() if errors > 0 or warns > 0: raise RuntimeError( - f'{errors} error(s) and/or {warns} warning(s)' + '{} error(s) and/or {} warning(s)'.format(errors, warns) + ' occurred while generating PDF.') def _get_path_to_pdf_from(self, start): diff --git a/mkdocs_with_pdf/preprocessor/links/transform.py b/mkdocs_with_pdf/preprocessor/links/transform.py index 6b8d63ce..23a57019 100644 --- a/mkdocs_with_pdf/preprocessor/links/transform.py +++ b/mkdocs_with_pdf/preprocessor/links/transform.py @@ -27,7 +27,7 @@ def transform(): target = urljoin(rel_url, target_url.path) if target in ['/', '.', 'index.html']: - return f'#.:{hash}' + return '#.:{}'.format(hash) if target.endswith('.png'): return href @@ -39,7 +39,7 @@ def transform(): if not target.endswith('/'): target += '/' - return f'#{quote(target)}:{hash}' + return '#{}:{}'.format(quote(target), hash) x_href = transform() @@ -63,7 +63,7 @@ def transform_id(id: str, rel_url: str): """normalize id to foo/bar/section:id""" if rel_url in ['.', 'index.html']: - return f'.:{id}' + return '.:{}'.format(id) head, tail = os.path.split(rel_url) section, _ = os.path.splitext(tail) @@ -77,4 +77,4 @@ def normalize(path): head = normalize(head) section = normalize(section) - return f'{head}{section}:{id}' + return '{}{}:{}'.format(head, section, id) diff --git a/mkdocs_with_pdf/styles/__init__.py b/mkdocs_with_pdf/styles/__init__.py index 97b51915..ca4086ca 100644 --- a/mkdocs_with_pdf/styles/__init__.py +++ b/mkdocs_with_pdf/styles/__init__.py @@ -21,16 +21,20 @@ def _css_escape(text: str) -> str: def style_for_print(options: Options) -> str: - scss = f""" - :root {{ - string-set: author '{_css_escape(options.author)}', - copyright '{_css_escape(options.copyright)}', - title '{_css_escape(options.cover_title)}'; - }} - h1, h2, h3 {{ + scss = """ + :root { + string-set: author '%s', + copyright '%s', + title '%s'; + } + h1, h2, h3 { string-set: chapter content(); - }} - """ + } + """ % ( + _css_escape(options.author), + _css_escape(options.copyright), + _css_escape(options.cover_title) + ) css = sass.compile(string=scss) base_path = os.path.abspath(os.path.dirname(__file__)) diff --git a/mkdocs_with_pdf/templates/filters/qrcode.py b/mkdocs_with_pdf/templates/filters/qrcode.py index 523ecf52..faac4c72 100644 --- a/mkdocs_with_pdf/templates/filters/qrcode.py +++ b/mkdocs_with_pdf/templates/filters/qrcode.py @@ -78,4 +78,5 @@ def __call__(self, content: str, format='SVG', with io.BytesIO() as stream: img.save(stream, kind=_save_kind(fmt)) data = base64.b64encode(stream.getvalue()) - return f'data:{_content_type(fmt)};base64,' + data.decode("ascii") + return 'data:{};base64,'.format( + _content_type(fmt)) + data.decode("ascii") diff --git a/mkdocs_with_pdf/templates/template.py b/mkdocs_with_pdf/templates/template.py index 43d14e08..787eac60 100644 --- a/mkdocs_with_pdf/templates/template.py +++ b/mkdocs_with_pdf/templates/template.py @@ -9,11 +9,11 @@ try: from .filters.barcode import Barcode -except ModuleNotFoundError: +except ImportError: Barcode = None try: from .filters.qrcode import QRCode -except ModuleNotFoundError: +except ImportError: QRCode = None diff --git a/mkdocs_with_pdf/toc.py b/mkdocs_with_pdf/toc.py index 5ac863b2..ccd72739 100644 --- a/mkdocs_with_pdf/toc.py +++ b/mkdocs_with_pdf/toc.py @@ -21,7 +21,7 @@ def make_indexes(soup: PageElement, options: Options) -> None: return options.logger.info( - f'Generate a table of contents up to heading level {level}.') + 'Generate a table of contents up to heading level %d.', level) h1li = None h2ul = h2li = h3ul = None @@ -30,14 +30,14 @@ def make_indexes(soup: PageElement, options: Options) -> None: def makeLink(h: Tag) -> Tag: li = soup.new_tag('li') ref = h.get('id', '') - a = soup.new_tag('a', href=f'#{ref}') + a = soup.new_tag('a', href='#{}'.format(ref)) for el in h.contents: if el.name == 'a': a.append(el.contents[0]) else: a.append(clone_element(el)) li.append(a) - options.logger.debug(f"| [{h.get_text(separator=' ')}]({ref})") + options.logger.debug("| [%s](%s)", h.get_text(separator=' '), ref) return li toc = soup.new_tag('article', id='doc-toc') @@ -94,7 +94,7 @@ def _inject_heading_order(soup: Tag, options: Options): if level < 1 or level > 3: return - options.logger.info(f'Number headings up to level {level}.') + options.logger.info('Number headings up to level %d.', level) h1n = h2n = h3n = 0 exclude_lv2 = exclude_lv3 = False @@ -106,7 +106,7 @@ def _inject_heading_order(soup: Tag, options: Options): h1n += 1 h2n = h3n = 0 - prefix = f'{h1n}. ' + prefix = '{}. '.format(h1n) exclude_lv2 = _is_exclude(h.get('id', None), options) @@ -114,7 +114,7 @@ def _inject_heading_order(soup: Tag, options: Options): h2n += 1 h3n = 0 - prefix = f'{h1n}.{h2n} ' + prefix = '{}.{} '.format(h1n, h2n) exclude_lv3 = _is_exclude(h.get('id', None), options) @@ -122,12 +122,13 @@ def _inject_heading_order(soup: Tag, options: Options): and h.name == 'h3' and level >= 3: h3n += 1 - prefix = f'{h1n}.{h2n}.{h3n} ' + prefix = '{}.{}.{} '.format(h1n, h2n, h3n) else: continue - options.logger.debug(f"| [{prefix} {h.text}]({h.get('id', '(none)')})") + options.logger.debug('| [%s %s](%s)', prefix, + h.text, h.get('id', '(none)')) nm_tag = soup.new_tag('span', **{'class': 'pdf-order'}) nm_tag.append(prefix) @@ -139,7 +140,7 @@ def _is_exclude(url: str, options: Options) -> bool: return False if url in options.excludes_children: - options.logger.info(f"| (exclude '{url}')") + options.logger.info("| (exclude '%s')", url) return True return False diff --git a/mkdocs_with_pdf/utils/emoji_util.py b/mkdocs_with_pdf/utils/emoji_util.py index 7ae869ba..97165899 100644 --- a/mkdocs_with_pdf/utils/emoji_util.py +++ b/mkdocs_with_pdf/utils/emoji_util.py @@ -40,12 +40,12 @@ def fix_size(svg): svg.replace_with(img) if logger: - logger.debug(f'> svg: {svg}') - logger.debug(f'< img: {img}') + logger.debug('> svg: {}'.format(svg)) + logger.debug('< img: {}'.format(img)) except Exception as e: if logger: - logger.warning(f'Failed to convert SVG: {e}') + logger.warning('Failed to convert SVG: %s', e) pass diff --git a/mkdocs_with_pdf/utils/image_util.py b/mkdocs_with_pdf/utils/image_util.py index 3e73506d..cb816696 100644 --- a/mkdocs_with_pdf/utils/image_util.py +++ b/mkdocs_with_pdf/utils/image_util.py @@ -17,7 +17,7 @@ def fix_image_alignment(soup: PageElement, logger: Logger = None): styles = _parse_style(getattr(img, 'style', '')) - logger.debug(f' | {img}') + logger.debug(' | {}'.format(img)) if img.has_attr('align'): if img['align'] == 'left': styles['float'] = 'left' @@ -37,10 +37,11 @@ def fix_image_alignment(soup: PageElement, logger: Logger = None): styles['height'] = _convert_dimension(img['height']) img.attrs.pop('height') - img['style'] = " ".join(f'{k}: {v};' for k, v in styles.items()) + img['style'] = " ".join('{}: {};'.format(k, v) + for k, v in styles.items()) except Exception as e: if logger: - logger.warning(f'Failed to convert img align: {e}') + logger.warning('Failed to convert img align: %s', e) pass @@ -65,7 +66,8 @@ def _split(s): if key in styles: (dim, u) = _split(styles[key]) styles[key] = str(int(dim) / 2) + u - img['style'] = " ".join(f'{k}: {v};' for k, v in styles.items()) + img['style'] = " ".join('{}: {};'.format(k, v) + for k, v in styles.items()) def _parse_style(style_string: str) -> dict: diff --git a/setup.py b/setup.py index bb8d3a86..9ef9ee0d 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ setup( name='mkdocs-with-pdf', - version='0.8.2', + version='0.8.3', description='Generate a single PDF file from MkDocs repository', # noqa E501 long_description=io.open('README.md', encoding='utf8').read(), long_description_content_type='text/markdown', diff --git a/tests/test_links.py b/tests/test_links.py index 57770272..e6094f5d 100644 --- a/tests/test_links.py +++ b/tests/test_links.py @@ -21,7 +21,7 @@ def run_test(scene: str, patterns: []): continue r = transform_href(href, rel_url) - self.assertEqual(r, x_href, f'"{scene}" at {index}') + self.assertEqual(r, x_href, '"{}" at {}'.format(scene, index)) run_test('on TOP(level 0)', [ # [[href, rel_url], x_href]