Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/markdown_it/rules_inline/text.py: 100%
14 statements
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-07 06:07 +0000
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-07 06:07 +0000
1# Skip text characters for text token, place those to pending buffer
2# and increment current pos
4from .state_inline import StateInline
6# Rule to skip pure text
7# '{}$%@~+=:' reserved for extensions
9# !, ", #, $, %, &, ', (, ), *, +, ,, -, ., /, :, ;, <, =, >, ?, @, [, \, ], ^, _, `, {, |, }, or ~
11# !!!! Don't confuse with "Markdown ASCII Punctuation" chars
12# http://spec.commonmark.org/0.15/#ascii-punctuation-character
15def isTerminatorChar(ch):
16 return ch in {
17 0x0A, # /* \n */:
18 0x21, # /* ! */:
19 0x23, # /* # */:
20 0x24, # /* $ */:
21 0x25, # /* % */:
22 0x26, # /* & */:
23 0x2A, # /* * */:
24 0x2B, # /* + */:
25 0x2D, # /* - */:
26 0x3A, # /* : */:
27 0x3C, # /* < */:
28 0x3D, # /* = */:
29 0x3E, # /* > */:
30 0x40, # /* @ */:
31 0x5B, # /* [ */:
32 0x5C, # /* \ */:
33 0x5D, # /* ] */:
34 0x5E, # /* ^ */:
35 0x5F, # /* _ */:
36 0x60, # /* ` */:
37 0x7B, # /* { */:
38 0x7D, # /* } */:
39 0x7E, # /* ~ */:
40 }
43def text(state: StateInline, silent: bool, **args):
44 pos = state.pos
45 posMax = state.posMax
46 while (pos < posMax) and not isTerminatorChar(state.srcCharCode[pos]):
47 pos += 1
49 if pos == state.pos:
50 return False
52 if not silent:
53 state.pending += state.src[state.pos : pos]
55 state.pos = pos
57 return True