Skip to content

Commit e6f39e7

Browse files
committed
Add new semantic markup support to ansible-doc text output.
1 parent 594b11d commit e6f39e7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/ansible/cli/doc.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,10 +349,14 @@ class DocCLI(CLI, RoleMixin):
349349
_ITALIC = re.compile(r"\bI\(([^)]+)\)")
350350
_BOLD = re.compile(r"\bB\(([^)]+)\)")
351351
_MODULE = re.compile(r"\bM\(([^)]+)\)")
352+
_PLUGIN = re.compile(r"\bP\(([^#)]+)#([a-z]+)\)")
352353
_LINK = re.compile(r"\bL\(([^)]+), *([^)]+)\)")
353354
_URL = re.compile(r"\bU\(([^)]+)\)")
354355
_REF = re.compile(r"\bR\(([^)]+), *([^)]+)\)")
355356
_CONST = re.compile(r"\bC\(([^)]+)\)")
357+
_SEM_OPTION_NAME = re.compile(r"\bO\(([^)]+)\)")
358+
_SEM_OPTION_VALUE = re.compile(r"\bV\(([^)]+)\)")
359+
_SEM_ENV_VARIABLE = re.compile(r"\bE\(([^)]+)\)")
356360
_RULER = re.compile(r"\bHORIZONTALLINE\b")
357361

358362
# rst specific
@@ -375,8 +379,12 @@ def tty_ify(cls, text):
375379
t = cls._MODULE.sub("[" + r"\1" + "]", t) # M(word) => [word]
376380
t = cls._URL.sub(r"\1", t) # U(word) => word
377381
t = cls._LINK.sub(r"\1 <\2>", t) # L(word, url) => word <url>
382+
t = cls._PLUGIN.sub("[" + r"\1" + "]", t) # P(word#type) => [word]
378383
t = cls._REF.sub(r"\1", t) # R(word, sphinx-ref) => word
379384
t = cls._CONST.sub(r"`\1'", t) # C(word) => `word'
385+
t = cls._SEM_OPTION_NAME.sub(r"`\1'", t) # O(word) => `word'
386+
t = cls._SEM_OPTION_VALUE.sub(r"`\1'", t) # V(word) => `word'
387+
t = cls._SEM_ENV_VARIABLE.sub(r"`\1'", t) # E(word) => `word'
380388
t = cls._RULER.sub("\n{0}\n".format("-" * 13), t) # HORIZONTALLINE => -------
381389

382390
# remove rst

0 commit comments

Comments
 (0)