Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/markdown_it/rules_inline/text.py: 100%
13 statements
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-07 06:15 +0000
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-07 06:15 +0000
1# Skip text characters for text token, place those to pending buffer
2# and increment current pos
3from .state_inline import StateInline
5# Rule to skip pure text
6# '{}$%@~+=:' reserved for extensions
8# !!!! Don't confuse with "Markdown ASCII Punctuation" chars
9# http://spec.commonmark.org/0.15/#ascii-punctuation-character
12_TerminatorChars = {
13 "\n",
14 "!",
15 "#",
16 "$",
17 "%",
18 "&",
19 "*",
20 "+",
21 "-",
22 ":",
23 "<",
24 "=",
25 ">",
26 "@",
27 "[",
28 "\\",
29 "]",
30 "^",
31 "_",
32 "`",
33 "{",
34 "}",
35 "~",
36}
39def text(state: StateInline, silent: bool) -> bool:
40 pos = state.pos
41 posMax = state.posMax
42 while (pos < posMax) and state.src[pos] not in _TerminatorChars:
43 pos += 1
45 if pos == state.pos:
46 return False
48 if not silent:
49 state.pending += state.src[state.pos : pos]
51 state.pos = pos
53 return True