mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Add more tests for markup.
This commit is contained in:
@@ -260,7 +260,7 @@ class SeeAlso(Directive):
|
||||
return ret
|
||||
|
||||
|
||||
token_re = re.compile('`([a-z_]+)`')
|
||||
token_re = re.compile('`([a-z_][a-z0-9_]*)`')
|
||||
|
||||
def token_xrefs(text, env):
|
||||
retnodes = []
|
||||
|
||||
@@ -29,7 +29,7 @@ generic_docroles = {
|
||||
'manpage' : addnodes.literal_emphasis,
|
||||
'mimetype' : addnodes.literal_emphasis,
|
||||
'newsgroup' : addnodes.literal_emphasis,
|
||||
'program' : nodes.strong,
|
||||
'program' : nodes.strong, # XXX should be an x-ref
|
||||
'regexp' : nodes.literal,
|
||||
}
|
||||
|
||||
|
||||
@@ -54,6 +54,12 @@ C items
|
||||
.. c:var:: sphinx_global
|
||||
|
||||
|
||||
References
|
||||
==========
|
||||
|
||||
:c:func:`CFunction`. :c:func:`!malloc`.
|
||||
|
||||
|
||||
Others
|
||||
======
|
||||
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
Testing various markup
|
||||
======================
|
||||
|
||||
Meta markup
|
||||
-----------
|
||||
|
||||
.. sectionauthor:: Georg Brandl
|
||||
|
||||
.. contents:: TOC
|
||||
@@ -13,7 +16,11 @@ Testing various markup
|
||||
:author: Me
|
||||
:keywords: docs, sphinx
|
||||
|
||||
A |subst|.
|
||||
|
||||
Generic reST
|
||||
------------
|
||||
|
||||
A |subst| (the definition is in rst_epilog).
|
||||
|
||||
.. _label:
|
||||
|
||||
@@ -21,31 +28,14 @@ A |subst|.
|
||||
|
||||
some code
|
||||
|
||||
Inline
|
||||
------
|
||||
Option list:
|
||||
|
||||
Inline markup:
|
||||
|
||||
* :pep:`8`
|
||||
* :rfc:`1`
|
||||
* :envvar:`HOME`
|
||||
|
||||
Admonitions
|
||||
-----------
|
||||
|
||||
.. note:: Note
|
||||
Note text.
|
||||
|
||||
.. warning:: Warning
|
||||
|
||||
Warning text.
|
||||
|
||||
.. tip::
|
||||
Tip text.
|
||||
-h help
|
||||
--help also help
|
||||
|
||||
|
||||
Body directives
|
||||
---------------
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
.. topic:: Title
|
||||
|
||||
@@ -78,7 +68,51 @@ Body directives
|
||||
|
||||
b
|
||||
|
||||
|
||||
|
||||
Admonitions
|
||||
^^^^^^^^^^^
|
||||
|
||||
.. admonition:: My Admonition
|
||||
|
||||
Admonition text.
|
||||
|
||||
.. note::
|
||||
Note text.
|
||||
|
||||
.. warning::
|
||||
|
||||
Warning text.
|
||||
|
||||
.. tip::
|
||||
Tip text.
|
||||
|
||||
|
||||
Inline markup
|
||||
-------------
|
||||
|
||||
*Generic inline markup*
|
||||
|
||||
* :command:`command`
|
||||
* :dfn:`dfn`
|
||||
* :guilabel:`guilabel`
|
||||
* :kbd:`kbd`
|
||||
* :mailheader:`mailheader`
|
||||
* :makevar:`makevar`
|
||||
* :manpage:`manpage`
|
||||
* :mimetype:`mimetype`
|
||||
* :newsgroup:`newsgroup`
|
||||
* :program:`program`
|
||||
* :regexp:`regexp`
|
||||
|
||||
*Linking inline markup*
|
||||
|
||||
* :pep:`8`
|
||||
* :rfc:`1`
|
||||
* :envvar:`HOME`
|
||||
|
||||
Test :abbr:`abbr (abbreviation)` and another :abbr:`abbr (abbreviation)`.
|
||||
|
||||
|
||||
Tables
|
||||
------
|
||||
|
||||
@@ -133,11 +167,6 @@ This is a side note.
|
||||
|
||||
This tests :CLASS:`role names in uppercase`.
|
||||
|
||||
Option list:
|
||||
|
||||
-h help
|
||||
--help also help
|
||||
|
||||
.. centered:: LICENSE AGREEMENT
|
||||
|
||||
.. acks::
|
||||
@@ -155,7 +184,7 @@ Option list:
|
||||
Particle with half-integer spin.
|
||||
|
||||
.. productionlist::
|
||||
try_stmt: try1_stmt | try2_stmt
|
||||
try_stmt: `try1_stmt` | `try2_stmt`
|
||||
try1_stmt: "try" ":" `suite`
|
||||
: ("except" [`expression` ["," `target`]] ":" `suite`)+
|
||||
: ["else" ":" `suite`]
|
||||
@@ -163,7 +192,6 @@ Option list:
|
||||
try2_stmt: "try" ":" `suite`
|
||||
: "finally" ":" `suite`
|
||||
|
||||
Test :abbr:`abbr (abbreviation)` and another :abbr:`abbr (abbreviation)`.
|
||||
|
||||
Index markup
|
||||
------------
|
||||
@@ -188,12 +216,6 @@ Invalid index markup...
|
||||
Testing öäü...
|
||||
|
||||
|
||||
Object markup
|
||||
-------------
|
||||
|
||||
:c:func:`CFunction`. :c:func:`!malloc`.
|
||||
|
||||
|
||||
Only directive
|
||||
--------------
|
||||
|
||||
|
||||
@@ -84,20 +84,50 @@ HTML_XPATH = {
|
||||
".//dd": r'Return spam\.',
|
||||
},
|
||||
'markup.html': {
|
||||
".//title": 'set by title directive',
|
||||
# created by the meta directive
|
||||
".//meta[@name='author'][@content='Me']": '',
|
||||
".//meta[@name='keywords'][@content='docs, sphinx']": '',
|
||||
".//a[@href='contents.html#ref1']": '',
|
||||
# a label created by ``.. _label:``
|
||||
".//div[@id='label']": '',
|
||||
# code with standard code blocks
|
||||
".//pre": '^some code$',
|
||||
# an option list
|
||||
".//span[@class='option']": '--help',
|
||||
# admonitions
|
||||
".//p[@class='first admonition-title']": 'My Admonition',
|
||||
".//p[@class='last']": 'Note text.',
|
||||
".//p[@class='last']": 'Warning text.',
|
||||
# inline markup
|
||||
".//li/strong": '^command$',
|
||||
".//li/strong": '^program$',
|
||||
".//li/em": '^dfn$',
|
||||
".//li/tt/span[@class='pre']": '^kbd$',
|
||||
".//a[@href='desc.html#envvar-HOME']/tt/span[@class='pre']": 'HOME',
|
||||
".//a[@href='http://www.python.org/dev/peps/pep-0008']/strong": 'PEP 8',
|
||||
".//a[@href='http://tools.ietf.org/html/rfc1.html']/strong": 'RFC 1',
|
||||
# abbreviations
|
||||
".//abbr[@title='abbreviation']": '^abbr$',
|
||||
# version stuff
|
||||
".//span[@class='versionmodified']": 'New in version 0.6',
|
||||
# footnote reference
|
||||
".//a[@class='footnote-reference']": r'\[1\]',
|
||||
# created by reference lookup
|
||||
".//a[@href='contents.html#ref1']": '',
|
||||
# a ``hlist`` directive
|
||||
".//table[@class='hlist']/tr/td/ul/li": '^This$',
|
||||
# a ``centered`` directive
|
||||
".//p[@class='centered']/strong": 'LICENSE',
|
||||
# a glossary
|
||||
".//dl/dt[@id='term-boson']": 'boson',
|
||||
# a production list
|
||||
".//pre/strong": 'try_stmt',
|
||||
".//pre/a[@href='grammar-token-try1_stmt']/tt/span": 'try1_stmt',
|
||||
# tests for ``only`` directive
|
||||
".//p": 'A global substitution.',
|
||||
".//p": 'In HTML.',
|
||||
".//p": 'In both.',
|
||||
".//p": 'Always present',
|
||||
".//title": 'set by title directive',
|
||||
".//span[@class='pre']": 'CFunction()',
|
||||
".//a[@href='desc.html#envvar-HOME']/tt/span[@class='pre']": 'HOME',
|
||||
".//a[@href='http://www.python.org/dev/peps/pep-0008']/strong": 'PEP 8',
|
||||
".//a[@href='http://tools.ietf.org/html/rfc1.html']/strong": 'RFC 1',
|
||||
},
|
||||
'desc.html': {
|
||||
".//dt[@id='mod.Cls.meth1']": '',
|
||||
@@ -106,6 +136,7 @@ HTML_XPATH = {
|
||||
".//dl[@class='userdesc']": '',
|
||||
".//dt[@id='userdescrole-myobj']": '',
|
||||
".//a[@href='#userdescrole-myobj']": '',
|
||||
".//span[@class='pre']": 'CFunction()',
|
||||
},
|
||||
'contents.html': {
|
||||
".//meta[@name='hc'][@content='hcval']": '',
|
||||
@@ -113,7 +144,7 @@ HTML_XPATH = {
|
||||
#".//td[@class='label']": r'\[Ref1\]', # docutils 0.5 only
|
||||
".//td[@class='label']": '',
|
||||
".//li[@class='toctree-l1']/a": 'Testing various markup',
|
||||
".//li[@class='toctree-l2']/a": 'Admonitions',
|
||||
".//li[@class='toctree-l2']/a": 'Inline markup',
|
||||
".//title": 'Sphinx <Tests>',
|
||||
".//div[@class='footer']": 'Georg Brandl & Team',
|
||||
".//a[@href='http://python.org/']": '',
|
||||
|
||||
Reference in New Issue
Block a user