summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2020-09-16 14:56:59 -0600
committerGitHub <noreply@github.com>2020-09-16 14:56:59 -0600
commite731e8676118c48770368eb470fed2d77fe82847 (patch)
tree3b3431077a7d3eb51b4d16dd5f3ffa73c5b02ab3
parent08690a9e394406562f636f90bcc899430bf3cdee (diff)
parent26a407f701782f45d3165f92861bd6555d042596 (diff)
downloadnumpy-e731e8676118c48770368eb470fed2d77fe82847.tar.gz
Merge pull request #17332 from mattip/sphinx3
DOC, BLD: update lexer highlighting and make numpydocs a regular dependency.
-rw-r--r--.gitmodules3
-rw-r--r--doc/source/conf.py16
-rw-r--r--doc/source/docs/howto_document.rst26
m---------doc/sphinxext0
-rw-r--r--doc_requirements.txt2
5 files changed, 11 insertions, 36 deletions
diff --git a/.gitmodules b/.gitmodules
index b1e13c3bc..e69de29bb 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +0,0 @@
-[submodule "doc/sphinxext"]
- path = doc/sphinxext
- url = https://github.com/numpy/numpydoc.git
diff --git a/doc/source/conf.py b/doc/source/conf.py
index e34be7f5c..fe7ea0967 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -367,15 +367,15 @@ def linkcode_resolve(domain, info):
numpy.__version__, fn, linespec)
from pygments.lexers import CLexer
-import copy
+from pygments.lexer import inherit, bygroups
+from pygments.token import Comment
class NumPyLexer(CLexer):
name = 'NUMPYLEXER'
- tokens = copy.deepcopy(CLexer.tokens)
- # Extend the regex for valid identifiers with @
- for k, val in tokens.items():
- for i, v in enumerate(val):
- if isinstance(v, tuple):
- if isinstance(v[0], str):
- val[i] = (v[0].replace('a-zA-Z', 'a-zA-Z@'),) + v[1:]
+ tokens = {
+ 'statements': [
+ (r'@[a-zA-Z_]*@', Comment.Preproc, 'macro'),
+ inherit,
+ ],
+ }
diff --git a/doc/source/docs/howto_document.rst b/doc/source/docs/howto_document.rst
index cf86b7e99..9f9068ab3 100644
--- a/doc/source/docs/howto_document.rst
+++ b/doc/source/docs/howto_document.rst
@@ -40,29 +40,7 @@ after which you may use it::
np.fft.fft2(...)
-.. rubric::
- **For convenience the** `formatting standard`_ **is included below with an
- example**
-
-.. include:: ../../sphinxext/doc/format.rst
-
-.. _example:
-
-Example Source
-==============
-
-.. literalinclude:: ../../sphinxext/doc/example.py
-
-
-
-Example Rendered
-================
-
-.. ifconfig:: python_version_major < '3'
-
- The example is rendered only when sphinx is run with python3 and above
-
-.. automodule:: doc.example
- :members:
+Please use the numpydoc `formatting standard`_ as shown in their example_
.. _`formatting standard`: https://numpydoc.readthedocs.io/en/latest/format.html
+.. _example: https://numpydoc.readthedocs.io/en/latest/example.html
diff --git a/doc/sphinxext b/doc/sphinxext
deleted file mode 160000
-Subproject b4c5fd17e2b85c2416a5e586933eee353b58bf7
diff --git a/doc_requirements.txt b/doc_requirements.txt
index 815aac307..36b651c64 100644
--- a/doc_requirements.txt
+++ b/doc_requirements.txt
@@ -1,5 +1,5 @@
-pygments==2.6.1
sphinx>=2.2.0,<3.0
+numpydoc==1.1.0
ipython
scipy
matplotlib