Class: MarkdownIt::RulesInline::Text
- Inherits:
-
Object
- Object
- MarkdownIt::RulesInline::Text
- Defined in:
- lib/motion-markdown-it/rules_inline/text.rb
Class Method Summary collapse
-
.isTerminatorChar(ch) ⇒ Object
!!!! Don’t confuse with “Markdown ASCII Punctuation” chars spec.commonmark.org/0.15/#ascii-punctuation-character ——————————————————————————.
-
.text(state, silent) ⇒ Object
——————————————————————————.
Class Method Details
.isTerminatorChar(ch) ⇒ Object
!!!! Don’t confuse with “Markdown ASCII Punctuation” chars spec.commonmark.org/0.15/#ascii-punctuation-character
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/motion-markdown-it/rules_inline/text.rb', line 16 def self.isTerminatorChar(ch) case ch when 0x0A, # \n 0x21, # ! 0x23, # # 0x24, # $ 0x25, # % 0x26, # & 0x2A, # * 0x2B, # + 0x2D, # - 0x3A, # : 0x3C, # < 0x3D, # = 0x3E, # > 0x40, # @ 0x5B, # [ 0x5C, # \ 0x5D, # ] 0x5E, # ^ 0x5F, # _ 0x60, # ` 0x7B, # { 0x7D, # } 0x7E # ~ return true else return false end end |
.text(state, silent) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/motion-markdown-it/rules_inline/text.rb', line 48 def self.text(state, silent) pos = state.pos while pos < state.posMax && !self.isTerminatorChar(state.src.charCodeAt(pos)) pos += 1 end return false if pos == state.pos state.pending += state.src.slice(state.pos...pos) if !silent state.pos = pos return true end |