|
@@ -13,6 +13,7 @@
|
|
|
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
|
|
#
|
|
|
import os
|
|
|
+import re
|
|
|
import sys
|
|
|
import datetime
|
|
|
try:
|
|
@@ -173,6 +174,24 @@ latex_elements = {
|
|
|
'preamble': '\\usepackage[UTF8]{ctex}\n\\setcounter{tocdepth}{2}',
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+from sphinx.search import SearchEnglish
|
|
|
+from sphinx.search import languages
|
|
|
+class DashFriendlySearchEnglish(SearchEnglish):
|
|
|
+
|
|
|
+ # Accept words that can include hyphens
|
|
|
+ _word_re = re.compile(r'[\w\-]+')
|
|
|
+
|
|
|
+ js_splitter_code = """
|
|
|
+function splitQuery(query) {
|
|
|
+ return query
|
|
|
+ .split(/[^\p{Letter}\p{Number}_\p{Emoji_Presentation}-]+/gu)
|
|
|
+ .filter(term => term.length > 0);
|
|
|
+}
|
|
|
+"""
|
|
|
+
|
|
|
+languages['en'] = DashFriendlySearchEnglish
|
|
|
+
|
|
|
# Make the EPUB builder prefer PNG to SVG because of issues rendering Inkscape SVG
|
|
|
from sphinx.builders.epub3 import Epub3Builder
|
|
|
Epub3Builder.supported_image_types = ['image/png', 'image/gif', 'image/jpeg']
|