Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
kwant
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Joseph Weston
kwant
Commits
d45acdb7
There was a problem fetching the pipeline summary.
Commit
d45acdb7
authored
7 years ago
by
Pablo Piskunow
Browse files
Options
Downloads
Patches
Plain Diff
add links in the documentation to the source code
parent
d236de82
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+1
-1
1 addition, 1 deletion
.gitlab-ci.yml
doc/source/conf.py
+30
-2
30 additions, 2 deletions
doc/source/conf.py
with
31 additions
and
3 deletions
.gitlab-ci.yml
+
1
−
1
View file @
d45acdb7
...
@@ -58,7 +58,7 @@ build documentation:
...
@@ -58,7 +58,7 @@ build documentation:
stage
:
test
stage
:
test
script
:
script
:
-
pip3 install sympy
-
pip3 install sympy
-
make -C doc realclean; make -C doc html SPHINXOPTS='-A website_deploy=True -n -W'
-
make -C doc realclean; make -C doc html SPHINXOPTS='-A website_deploy=True -n -W'
REFNAME="${CI_COMMIT_TAG:-$CI_COMMIT_SHA}" SOURCE_URL="$CI_PROJECT_URL"/blob
artifacts
:
artifacts
:
paths
:
paths
:
-
doc/build/html/
-
doc/build/html/
...
...
This diff is collapsed.
Click to expand it.
doc/source/conf.py
+
30
−
2
View file @
d45acdb7
...
@@ -27,7 +27,7 @@ sys.path.insert(0, os.path.abspath('../sphinxext'))
...
@@ -27,7 +27,7 @@ sys.path.insert(0, os.path.abspath('../sphinxext'))
extensions
=
[
'
sphinx.ext.autodoc
'
,
'
sphinx.ext.autosummary
'
,
extensions
=
[
'
sphinx.ext.autodoc
'
,
'
sphinx.ext.autosummary
'
,
'
sphinx.ext.todo
'
,
'
sphinx.ext.mathjax
'
,
'
numpydoc
'
,
'
sphinx.ext.todo
'
,
'
sphinx.ext.mathjax
'
,
'
numpydoc
'
,
'
kwantdoc
'
]
'
kwantdoc
'
,
'
sphinx.ext.linkcode
'
]
# Add any paths that contain templates here, relative to this directory.
# Add any paths that contain templates here, relative to this directory.
templates_path
=
[
'
../templates
'
]
templates_path
=
[
'
../templates
'
]
...
@@ -43,7 +43,7 @@ master_doc = 'index'
...
@@ -43,7 +43,7 @@ master_doc = 'index'
# General information about the project.
# General information about the project.
project
=
'
Kwant
'
project
=
'
Kwant
'
copyright
=
'
2011-201
5
, C. W. Groth (CEA), M. Wimmer, A. R. Akhmerov, X. Waintal (CEA), and others
'
copyright
=
'
2011-201
7
, C. W. Groth (CEA), M. Wimmer, A. R. Akhmerov, X. Waintal (CEA), and others
'
# The version info for the project you're documenting, acts as replacement for
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# |version| and |release|, also used in various other places throughout the
...
@@ -231,6 +231,7 @@ autosummary_generate = True
...
@@ -231,6 +231,7 @@ autosummary_generate = True
autoclass_content
=
"
both
"
autoclass_content
=
"
both
"
autodoc_default_flags
=
[
'
show-inheritance
'
]
autodoc_default_flags
=
[
'
show-inheritance
'
]
# -- Teach Sphinx to document bound methods like functions ---------------------
# -- Teach Sphinx to document bound methods like functions ---------------------
import
types
import
types
from
sphinx.ext
import
autodoc
from
sphinx.ext
import
autodoc
...
@@ -271,3 +272,30 @@ nitpick_ignore = [('py:class', 'Warning'), ('py:class', 'Exception'),
...
@@ -271,3 +272,30 @@ nitpick_ignore = [('py:class', 'Warning'), ('py:class', 'Exception'),
# Use custom MathJax CDN, as cdn.mathjax.org will soon shut down
# Use custom MathJax CDN, as cdn.mathjax.org will soon shut down
mathjax_path
=
"
https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML
"
mathjax_path
=
"
https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML
"
# -- Make Sphinx insert source code links --------------------------------------
def
linkcode_resolve
(
domain
,
info
):
def
find_source
():
# try to find the file and line number, based on code from numpy:
# https://github.com/numpy/numpy/blob/master/doc/source/conf.py#L286
obj
=
sys
.
modules
[
info
[
'
module
'
]]
for
part
in
info
[
'
fullname
'
].
split
(
'
.
'
):
obj
=
getattr
(
obj
,
part
)
import
inspect
fn
=
inspect
.
getsourcefile
(
obj
)
fn
=
os
.
path
.
relpath
(
fn
,
start
=
os
.
path
.
dirname
(
kwant
.
__file__
))
source
,
lineno
=
inspect
.
getsourcelines
(
obj
)
return
fn
,
lineno
,
lineno
+
len
(
source
)
-
1
if
domain
!=
'
py
'
or
not
info
[
'
module
'
]:
return
None
try
:
filename
=
'
kwant/%s#L%d-%d
'
%
find_source
()
except
Exception
:
filename
=
info
[
'
module
'
].
replace
(
'
.
'
,
'
/
'
)
+
'
.py
'
source_branch
=
os
.
environ
.
get
(
'
REFNAME
'
,
'
master
'
)
url
=
os
.
environ
.
get
(
'
SOURCE_URL
'
,
"
https://gitlab.kwant-project.org/kwant/kwant/blob
"
)
return
"
{}/{}/{}
"
.
format
(
url
,
source_branch
,
filename
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment