Skip to content

Commit c6eaf61

Browse files
committed
doc: add regex pattern examples
1 parent 28804ed commit c6eaf61

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

libraries/website_adoc.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,13 @@
1818

1919
logger = structlog.get_logger()
2020

21+
# Section anchor, e.g. "[#about]" -> "about"
2122
_ANCHOR_RE = re.compile(r"^\[#([a-z0-9-]+)\]\s*$")
23+
# Attribute line, e.g. ":library-key: beast" -> ("library-key", "beast")
2224
_ATTR_RE = re.compile(r"^:([a-z0-9-]+):\s*(.*)$")
25+
# Source block header, e.g. "[source,cpp]" or "[source%linenums,c++]" -> "cpp" / "c++"
2326
_SOURCE_RE = re.compile(r"^\[source(?:%[^\],]*)?(?:,\s*([a-z0-9+#-]+))?.*\]\s*$")
27+
# Section heading, e.g. "== Description" -> "Description"
2428
_HEADING_RE = re.compile(r"^=+\s+(.*\S)\s*$")
2529

2630

0 commit comments

Comments
 (0)