Class: RuVim::Lang::Markdown::FenceState
- Inherits:
-
Object
- Object
- RuVim::Lang::Markdown::FenceState
- Defined in:
- lib/ruvim/lang/markdown.rb
Overview
--- FenceState: tracks code fence open/close across lines ---
Instance Attribute Summary collapse
-
#fence_marker ⇒ Object
readonly
Returns the value of attribute fence_marker.
-
#in_code_block ⇒ Object
readonly
Returns the value of attribute in_code_block.
Instance Method Summary collapse
-
#initialize ⇒ FenceState
constructor
A new instance of FenceState.
- #scan_line(line) ⇒ Object
Constructor Details
#initialize ⇒ FenceState
Returns a new instance of FenceState.
38 39 40 41 |
# File 'lib/ruvim/lang/markdown.rb', line 38 def initialize @in_code_block = false @fence_marker = nil end |
Instance Attribute Details
#fence_marker ⇒ Object (readonly)
Returns the value of attribute fence_marker.
36 37 38 |
# File 'lib/ruvim/lang/markdown.rb', line 36 def fence_marker @fence_marker end |
#in_code_block ⇒ Object (readonly)
Returns the value of attribute in_code_block.
36 37 38 |
# File 'lib/ruvim/lang/markdown.rb', line 36 def in_code_block @in_code_block end |
Instance Method Details
#scan_line(line) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/ruvim/lang/markdown.rb', line 43 def scan_line(line) stripped = line.to_s.strip if @in_code_block if fence_close?(stripped) @in_code_block = false @fence_marker = nil end else marker = fence_open(stripped) if marker @in_code_block = true @fence_marker = marker end end end |