diff options
| -rw-r--r-- | documentation/conf.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/documentation/conf.py b/documentation/conf.py index 2aceeb8e79..ad60d91139 100644 --- a/documentation/conf.py +++ b/documentation/conf.py | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | # documentation root, use os.path.abspath to make it absolute, like shown here. | 13 | # documentation root, use os.path.abspath to make it absolute, like shown here. |
| 14 | # | 14 | # |
| 15 | import os | 15 | import os |
| 16 | import re | ||
| 16 | import sys | 17 | import sys |
| 17 | import datetime | 18 | import datetime |
| 18 | try: | 19 | try: |
| @@ -173,6 +174,24 @@ latex_elements = { | |||
| 173 | 'preamble': '\\usepackage[UTF8]{ctex}\n\\setcounter{tocdepth}{2}', | 174 | 'preamble': '\\usepackage[UTF8]{ctex}\n\\setcounter{tocdepth}{2}', |
| 174 | } | 175 | } |
| 175 | 176 | ||
| 177 | |||
| 178 | from sphinx.search import SearchEnglish | ||
| 179 | from sphinx.search import languages | ||
| 180 | class DashFriendlySearchEnglish(SearchEnglish): | ||
| 181 | |||
| 182 | # Accept words that can include hyphens | ||
| 183 | _word_re = re.compile(r'[\w\-]+') | ||
| 184 | |||
| 185 | js_splitter_code = """ | ||
| 186 | function splitQuery(query) { | ||
| 187 | return query | ||
| 188 | .split(/[^\p{Letter}\p{Number}_\p{Emoji_Presentation}-]+/gu) | ||
| 189 | .filter(term => term.length > 0); | ||
| 190 | } | ||
| 191 | """ | ||
| 192 | |||
| 193 | languages['en'] = DashFriendlySearchEnglish | ||
| 194 | |||
| 176 | # Make the EPUB builder prefer PNG to SVG because of issues rendering Inkscape SVG | 195 | # Make the EPUB builder prefer PNG to SVG because of issues rendering Inkscape SVG |
| 177 | from sphinx.builders.epub3 import Epub3Builder | 196 | from sphinx.builders.epub3 import Epub3Builder |
| 178 | Epub3Builder.supported_image_types = ['image/png', 'image/gif', 'image/jpeg'] | 197 | Epub3Builder.supported_image_types = ['image/png', 'image/gif', 'image/jpeg'] |
