comparison mupdf-source/docs/conf.py @ 2:b50eed0cc0ef upstream

ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4. The directory name has changed: no version number in the expanded directory now.
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 15 Sep 2025 11:43:07 +0200
parents
children
comparison
equal deleted inserted replaced
1:1d09e1dec1d9 2:b50eed0cc0ef
1 # see https://www.sphinx-doc.org/en/master/usage/configuration.html
2
3 import os
4 import datetime
5 import re
6
7 def get_mupdf_version_from_header():
8 major = minor = patch = None
9 _path = os.path.abspath(f'{__file__}/../../include/mupdf/fitz/version.h')
10 with open(_path) as f:
11 for line in f:
12 if not major:
13 major = re.search('#define FZ_VERSION_MAJOR ([0-9]+$)', line)
14 if not minor:
15 minor = re.search('#define FZ_VERSION_MINOR ([0-9]+$)', line)
16 if not patch:
17 patch = re.search('#define FZ_VERSION_PATCH ([0-9]+$)', line)
18 if major and minor and patch:
19 release = major.group(1) + "." + minor.group(1) + "." + patch.group(1)
20 else:
21 raise Exception(f'Failed to find MuPDF version in {_path}')
22 return release
23
24 def get_mupdf_version_from_git():
25 return os.popen("git describe --all").read().strip().replace("tags/", "").replace("heads/", "")
26
27 def get_mupdf_version():
28 return get_mupdf_version_from_git() or get_mupdf_version_from_header()
29
30 project = "MuPDF"
31 copyright = "2004-" + str(datetime.date.today().year) + " Artifex"
32 release = version = get_mupdf_version()
33
34 extensions = [
35 "myst_parser",
36 "sphinx.ext.graphviz",
37 "sphinxcontrib.imagesvg",
38 "sphinxcontrib.googleanalytics",
39 ]
40
41 toc_object_entries_show_parents = "hide"
42 highlight_language = "none"
43 default_role = "any"
44 add_function_parentheses = False
45 add_module_names = False
46 show_authors = False
47 keep_warnings = False
48
49 myst_heading_anchors = 2
50 myst_enable_extensions = [
51 "deflist",
52 "html_image",
53 "linkify",
54 "replacements",
55 "smartquotes",
56 "strikethrough",
57 "tasklist",
58 ]
59
60 googleanalytics_id = "G-JZTN4VTL9M"
61
62 rst_prolog = """
63
64 .. |no_new| replace:: *You cannot create instances of this class with the new operator!*
65
66 .. |interface_type| replace:: *This is an interface, not a concrete class!*
67
68 .. |only_mutool| raw:: html
69
70 <span class="only_mutool">only&nbsp;mutool&nbsp;run</span>
71
72 .. |only_mupdfjs| raw:: html
73
74 <span class="only_mupdfjs">only&nbsp;mupdf.js</span>
75
76 """
77
78 # -- Options for HTML output ----------------------------------------------
79
80 html_theme = "furo"
81
82 html_title = "MuPDF " + version
83
84 html_use_smartypants = True
85
86 html_domain_indices = False
87 html_use_index = False
88 html_split_index = False
89
90 html_copy_source = False
91 html_show_sourcelink = False
92 html_show_sphinx = False
93 html_show_copyright = True
94
95 html_static_path = [ "_static" ]
96 html_css_files = [ "custom.css" ]
97 html_logo = "_static/mupdf-sidebar-logo.webp"
98 html_favicon = "_static/favicon.ico"
99
100 html_theme_options = {
101 "footer_icons": [
102 {
103 "name": "Discord",
104 "url": "https://discord.gg/DQjvZ6ERqH",
105 "class": "discord-link",
106 "html": """Find <b>#mupdf</b> on Discord <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 127.14 96.36"><path fill="#5865f2" d="M107.7,8.07A105.15,105.15,0,0,0,81.47,0a72.06,72.06,0,0,0-3.36,6.83A97.68,97.68,0,0,0,49,6.83,72.37,72.37,0,0,0,45.64,0,105.89,105.89,0,0,0,19.39,8.09C2.79,32.65-1.71,56.6.54,80.21h0A105.73,105.73,0,0,0,32.71,96.36,77.7,77.7,0,0,0,39.6,85.25a68.42,68.42,0,0,1-10.85-5.18c.91-.66,1.8-1.34,2.66-2a75.57,75.57,0,0,0,64.32,0c.87.71,1.76,1.39,2.66,2a68.68,68.68,0,0,1-10.87,5.19,77,77,0,0,0,6.89,11.1A105.25,105.25,0,0,0,126.6,80.22h0C129.24,52.84,122.09,29.11,107.7,8.07ZM42.45,65.69C36.18,65.69,31,60,31,53s5-12.74,11.43-12.74S54,46,53.89,53,48.84,65.69,42.45,65.69Zm42.24,0C78.41,65.69,73.25,60,73.25,53s5-12.74,11.44-12.74S96.23,46,96.12,53,91.08,65.69,84.69,65.69Z"/></svg>""",
107 },
108 ],
109 }
110
111 # -- Options for PDF output --------------------------------------------------
112
113 # (source start file, target name, title, author).
114 pdf_documents = [ ("index", "MuPDF", "MuPDF Manual", "Artifex") ]
115 pdf_compressed = True
116 pdf_language = "en_US"
117 pdf_use_index = True
118 pdf_use_modindex = True
119 pdf_use_coverpage = True
120 pdf_break_level = 2
121 pdf_verbosity = 0
122 pdf_invariant = True