9
9
from sphinx .application import Sphinx
10
10
11
11
12
- __version__ = "0.0.1b5 "
12
+ __version__ = "0.0.1b6 "
13
13
__author__ = 'Adam Korn <hello@dailykitten.net>'
14
14
15
15
@@ -25,20 +25,17 @@ def setup(app: Sphinx) -> Dict[str, Any]:
25
25
pkg = pkg_resources .require (modname )[0 ]
26
26
pkg_name = pkg .get_metadata ('top_level.txt' ).strip ()
27
27
28
- app .setup_extension ( 'sphinx.ext.linkcode ' )
28
+ app .add_config_value ( 'pkg_name' , pkg_name , 'html ' )
29
29
app .connect ("builder-inited" , get_static_path )
30
- app .connect ('doctree-resolved' , add_linkcode_node_class )
31
30
# app.connect('build-finished', save_generated_rst_files)
32
31
33
- app .add_config_value ('pkg_name' , pkg_name , 'html' )
34
- app .add_config_value ('linkcode_link_text' , '[source]' , 'html' )
32
+ app .setup_extension ('sphinx.ext.linkcode' )
33
+ app .setup_extension ('sphinx_github_style.add_linkcode_class' )
34
+ app .setup_extension ('sphinx_github_style.github_style' )
35
+ app .setup_extension ('sphinx_github_style.meth_lexer' )
36
+
35
37
app .add_config_value ('linkcode_default_blob' , 'master' , 'html' )
36
- app .config .pygments_style = 'sphinx_github_style.TDKStyle'
37
38
app .config .html_context ['github_version' ] = get_linkcode_revision (app )
38
-
39
- app .add_css_file ('github_linkcode.css' )
40
- app .add_lexer ('python' , TDKMethLexer .get_pkg_lexer (pkg_name ))
41
-
42
39
linkcode_url = get_linkcode_url (app )
43
40
44
41
def linkcode_resolve (domain , info ):
@@ -101,6 +98,7 @@ def get_static_path(app):
101
98
str (Path (__file__ ).parent .joinpath ("_static" ).absolute ())
102
99
)
103
100
101
+
104
102
def get_linkcode_revision (app : Sphinx ):
105
103
# Get the blob to link to on GitHub
106
104
linkcode_revision = "master"
@@ -122,7 +120,6 @@ def get_linkcode_revision(app: Sphinx):
122
120
tag = subprocess .check_output (cmd .split (" " )).strip ().decode ('utf-8' )
123
121
linkcode_revision = tag
124
122
125
-
126
123
except subprocess .CalledProcessError :
127
124
if app .config ._raw_config .get ('linkcode_default_blob' ) == 'last_tag' :
128
125
# Get the most recent tag to link to on GitHub
0 commit comments