Skip to content

Commit 510ead5

Browse files
committed
Merge branch 'master' of https://github.com/rk700/PyMuPDF
2 parents 913ea5e + 1f51b6f commit 510ead5

File tree

9 files changed

+1166
-2
lines changed

9 files changed

+1166
-2
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ On **[PyPI](https://pypi.org/project/PyMuPDF)** since August 2016: [![Downloads]
1515

1616
# Introduction
1717

18-
PyMuPDF (current version 1.18.9) is a Python binding with support for [MuPDF](https://mupdf.com/) (current version 1.18.*), a lightweight PDF, XPS, and E-book viewer, renderer and toolkit, which is maintained and developed by Artifex Software, Inc.
18+
PyMuPDF (current version 1.18.9) is a Python binding with support for [MuPDF](https://mupdf.com/) (current version 1.18.*), a lightweight PDF, XPS, and E-book viewer, renderer, and toolkit, which is maintained and developed by Artifex Software, Inc.
1919

2020
MuPDF can access files in PDF, XPS, OpenXPS, CBZ, EPUB and FB2 (e-books) formats, and it is known for its top performance and high rendering quality.
2121

@@ -58,7 +58,8 @@ Have a look at the basic [demos](https://github.com/pymupdf/PyMuPDF-Utilities/tr
5858

5959
Our **documentation**, written using Sphinx, is available in various formats from the following sources. It currently is a combination of a reference guide and a user manual. For a **quick start** look at the [tutorial](https://pymupdf.readthedocs.io/en/latest/tutorial/) and the [recipes](https://pymupdf.readthedocs.io/en/latest/faq/) chapters.
6060

61-
* You can view it online at [Read the Docs](https://readthedocs.org/projects/pymupdf/). This site also provides download options for zipped HTML and PDF.
61+
* You can view it online at [Read the Docs](https://readthedocs.org/projects/pymupdf/). This site also provides download options for PDF.
62+
* The search function on Read the Docs does not work for me currently. If you want a working searchable local version, please download a zipped HTML for [here](https://github.com/pymupdf/PyMuPDF-optional-material/tree/master/doc/pymupdf.zip).
6263
* Find a Windows help file [here](https://github.com/pymupdf/PyMuPDF-optional-material/tree/master/doc/PyMuPDF.chm).
6364

6465

demo/pymupdf.jpg

26.6 KB
Loading

docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
# extensions = ["sphinx.ext.autodoc", "sphinx.ext.coverage", "sphinx.ext.ifconfig"]
2020
extensions = [
2121
"extensions.searchrepair",
22+
"extensions.extension",
2223
]
2324
# Add any paths that contain templates here, relative to this directory.
2425
templates_path = ["_templates"]

docs/extensions/extension.py

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import os
2+
3+
from sphinx.errors import ExtensionError
4+
from sphinx.util.fileutil import copy_asset
5+
6+
7+
ASSETS_FILES = {
8+
'minified': [
9+
os.path.join('js', 'rtd_sphinx_search.min.js'),
10+
os.path.join('css', 'rtd_sphinx_search.min.css'),
11+
],
12+
'un-minified': [
13+
os.path.join('js', 'rtd_sphinx_search.js'),
14+
os.path.join('css', 'rtd_sphinx_search.css'),
15+
]
16+
}
17+
18+
19+
def copy_asset_files(app, exception):
20+
if exception is None: # build succeeded
21+
files = ASSETS_FILES['minified'] + ASSETS_FILES['un-minified']
22+
for file in files:
23+
path = os.path.join(os.path.dirname(__file__), 'static', file)
24+
copy_asset(path, os.path.join(app.outdir, '_static', file.split('.')[-1]))
25+
26+
27+
def inject_static_files(app):
28+
"""Inject correct CSS and JS files based on the value of ``rtd_sphinx_search_file_type``."""
29+
30+
file_type = app.config.rtd_sphinx_search_file_type
31+
expected_file_type = ASSETS_FILES.keys()
32+
33+
if file_type not in expected_file_type:
34+
raise ExtensionError(f'"{file_type}" file type is not supported')
35+
36+
files = ASSETS_FILES[file_type]
37+
38+
for file in files:
39+
if file.endswith('.js'):
40+
app.add_js_file(file)
41+
elif file.endswith('.css'):
42+
app.add_css_file(file)
43+
44+
45+
def setup(app):
46+
47+
app.add_config_value('rtd_sphinx_search_file_type', 'minified', 'html')
48+
49+
app.connect('builder-inited', inject_static_files)
50+
app.connect('build-finished', copy_asset_files)

docs/extensions/searchrepair.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ def modify_search_index(app, exception):
1717
searchfile = open(filename, "w")
1818
searchfile.write(data2)
1919
searchfile.close()
20+
else:
21+
print("INFO: No file", filename)
2022

2123

2224
def setup(app):

0 commit comments

Comments
 (0)