summaryrefslogtreecommitdiff
path: root/doc/usage/restructuredtext
diff options
context:
space:
mode:
authorYoshiki Shibukawa <yoshiki@shibu.jp>2020-07-23 11:43:41 +0900
committerYoshiki Shibukawa <yoshiki@shibu.jp>2020-07-25 22:36:06 +0900
commit70aa913bb24aa756872f4eafa378f8a1911b0d9b (patch)
tree5bcbc0095843624876f131b304e553f7c13f836a /doc/usage/restructuredtext
parentd8064a8b8fe2b6b921a5409eeb636418b480981a (diff)
downloadsphinx-git-70aa913bb24aa756872f4eafa378f8a1911b0d9b.tar.gz
fix 6863: add description literalinclude option (start/end have same string)
Diffstat (limited to 'doc/usage/restructuredtext')
-rw-r--r--doc/usage/restructuredtext/directives.rst40
1 files changed, 37 insertions, 3 deletions
diff --git a/doc/usage/restructuredtext/directives.rst b/doc/usage/restructuredtext/directives.rst
index 7b9bd2f80..fcdbc3f16 100644
--- a/doc/usage/restructuredtext/directives.rst
+++ b/doc/usage/restructuredtext/directives.rst
@@ -656,9 +656,43 @@ __ http://pygments.org/docs/lexers
string are included. The ``start-at`` and ``end-at`` options behave in a
similar way, but the lines containing the matched string are included.
- With lines selected using ``start-after`` it is still possible to use
- ``lines``, the first allowed line having by convention the line number
- ``1``.
+ ``start-after``/``start-at`` and ``end-before``/``end-at`` can have same string.
+ ``start-after``/``start-at`` filter lines before the line that contains
+ option string (``start-at`` will keep the line). Then ``end-before``/``end-at``
+ filter lines after the line that contains option string (``end-at`` will keep
+ the line and ``end-before`` skip the first line).
+
+ .. note::
+
+ If you want to select only ``[second-section]`` of ini file like the
+ following, you can use ``:start-at: [second-section]`` and
+ ``:end-before: [third-section]``:
+
+ .. code-block:: ini
+
+ [first-section]
+
+ var_in_first=true
+
+ [second-section]
+
+ var_in_second=true
+
+ [third-section]
+
+ var_in_third=true
+
+ Useful cases of these option is working with tag comments.
+ ``:start-after: [initialized]`` and ``:end-before: [initialized]`` options
+ keep lines between comments:
+
+ .. code-block:: py
+
+ if __name__ == "__main__":
+ # [initialize]
+ app.start(":8000")
+ # [initialize]
+
When lines have been selected in any of the ways described above, the line
numbers in ``emphasize-lines`` refer to those selected lines, counted