Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
openmm
Commits
a885a6ae
Unverified
Commit
a885a6ae
authored
May 23, 2018
by
peastman
Committed by
GitHub
May 23, 2018
Browse files
Merge pull request #2080 from peastman/sphinx
Changes to work correctly with latest version of Sphinx
parents
65a1f936
428fb836
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
13 deletions
+12
-13
.travis.yml
.travis.yml
+1
-1
docs-source/sphinx/autonumber.py
docs-source/sphinx/autonumber.py
+11
-12
No files found.
.travis.yml
View file @
a885a6ae
...
@@ -182,7 +182,7 @@ script:
...
@@ -182,7 +182,7 @@ script:
-
python devtools/run-ctest.py --start-time $START_TIME
-
python devtools/run-ctest.py --start-time $START_TIME
-
if [[ ! -z "${DOCS_DEPLOY}" && "${DOCS_DEPLOY}" = "true" ]]; then
-
if [[ ! -z "${DOCS_DEPLOY}" && "${DOCS_DEPLOY}" = "true" ]]; then
pip install sphinx
==1.5.6
sphinxcontrib-bibtex sphinxcontrib-lunrsearch sphinxcontrib-autodoc_doxygen;
pip install sphinx sphinxcontrib-bibtex sphinxcontrib-lunrsearch sphinxcontrib-autodoc_doxygen;
make sphinxhtml;
make sphinxhtml;
make sphinxpdf;
make sphinxpdf;
make C++ApiDocs PythonApiDocs;
make C++ApiDocs PythonApiDocs;
...
...
docs-source/sphinx/autonumber.py
View file @
a885a6ae
from
docutils.parsers.rst
import
roles
from
docutils.parsers.rst
import
roles
from
docutils.nodes
import
Text
,
reference
,
section
from
docutils.nodes
import
Text
,
reference
,
section
,
label
from
sphinx.roles
import
XRefRole
from
sphinx.roles
import
XRefRole
class
autonumber
(
Text
):
class
autonumber
(
label
):
pass
pass
class
autonumber_ref
(
reference
):
class
autonumber_ref
(
reference
):
pass
pass
def
autonumber_role
(
name
,
rawtext
,
text
,
lineno
,
inliner
,
options
=
{},
content
=
[]):
def
autonumber_role
(
name
,
rawtext
,
text
,
lineno
,
inliner
,
options
=
{},
content
=
[]):
return
([
autonumber
(
text
)],
[])
return
([
autonumber
(
text
=
text
)],
[])
def
doctree_resolved
(
app
,
doctree
,
docname
):
def
doctree_resolved
(
app
,
doctree
,
docname
):
index
=
{};
index
=
{};
refTable
=
{}
refTable
=
{}
if
app
.
config
.
autonumber_by_chapter
:
if
app
.
config
.
autonumber_by_chapter
:
# Record the number of each chapter
# Record the number of each chapter
env
=
app
.
builder
.
env
env
=
app
.
builder
.
env
sectionNumbers
=
{}
sectionNumbers
=
{}
for
doc
in
env
.
toc_secnumbers
:
for
doc
in
env
.
toc_secnumbers
:
...
@@ -24,9 +24,9 @@ def doctree_resolved(app, doctree, docname):
...
@@ -24,9 +24,9 @@ def doctree_resolved(app, doctree, docname):
for
sectionId
in
sections
:
for
sectionId
in
sections
:
sectionNumbers
[
sectionId
[
1
:]]
=
sections
[
sectionId
]
sectionNumbers
[
sectionId
[
1
:]]
=
sections
[
sectionId
]
lastChapter
=
-
1
lastChapter
=
-
1
# Assign numbers to all the autonumbered objects.
# Assign numbers to all the autonumbered objects.
for
node
in
doctree
.
traverse
(
autonumber
):
for
node
in
doctree
.
traverse
(
autonumber
):
category
=
node
.
astext
().
split
(
','
)[
0
]
category
=
node
.
astext
().
split
(
','
)[
0
]
if
category
in
index
:
if
category
in
index
:
...
@@ -47,13 +47,13 @@ def doctree_resolved(app, doctree, docname):
...
@@ -47,13 +47,13 @@ def doctree_resolved(app, doctree, docname):
newNode
=
Text
(
'%s %d-%d'
%
(
category
,
chapter
,
nextNumber
))
newNode
=
Text
(
'%s %d-%d'
%
(
category
,
chapter
,
nextNumber
))
lastChapter
=
chapter
lastChapter
=
chapter
else
:
else
:
newNode
=
Text
(
'%s %d'
%
(
category
,
nextNumber
))
newNode
=
Text
(
'%s %d'
%
(
category
,
nextNumber
))
index
[
category
]
=
nextNumber
index
[
category
]
=
nextNumber
refTable
[
node
.
astext
()]
=
newNode
refTable
[
node
.
astext
()]
=
newNode
node
.
parent
.
replace
(
node
,
newNode
)
node
.
parent
.
replace
(
node
,
newNode
)
# Replace references with the name of the referenced object
# Replace references with the name of the referenced object
for
ref_info
in
doctree
.
traverse
(
autonumber_ref
):
for
ref_info
in
doctree
.
traverse
(
autonumber_ref
):
target
=
ref_info
[
'reftarget'
]
target
=
ref_info
[
'reftarget'
]
if
target
not
in
refTable
:
if
target
not
in
refTable
:
...
@@ -68,4 +68,3 @@ def setup(app):
...
@@ -68,4 +68,3 @@ def setup(app):
app
.
add_role
(
'autonumref'
,
XRefRole
(
nodeclass
=
autonumber_ref
))
app
.
add_role
(
'autonumref'
,
XRefRole
(
nodeclass
=
autonumber_ref
))
app
.
connect
(
'doctree-resolved'
,
doctree_resolved
)
app
.
connect
(
'doctree-resolved'
,
doctree_resolved
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment