From 9c99732c24c09922f49c9201ddc6f0fd5766d533 Mon Sep 17 00:00:00 2001 From: maddiebaka Date: Wed, 2 Aug 2023 11:28:59 -0400 Subject: [PATCH] Fix strip_markers step --- lib/skeksis/parser.rb | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/lib/skeksis/parser.rb b/lib/skeksis/parser.rb index 81f475a..ffef653 100644 --- a/lib/skeksis/parser.rb +++ b/lib/skeksis/parser.rb @@ -4,16 +4,6 @@ module Skeksis class IR < Array - def collapse_verbatim_blocks! - last_block = nil - self.each do |line| - type = get_type(line) - - # Last thing - last_block = type - end - end - def strip_markers! self.map! do |line| type = line[:type] @@ -39,12 +29,15 @@ module Skeksis { type: type, link: link, text: text } when :verbatim # TODO: Match with syntax highlighting, maybe - m = /^```(.*)/.match(text) - unless m.nil? - nil - else - { type: type, content: content } - end + content.map! do |line| + m = /^```(.*)/.match(line) + unless m.nil? + nil + else + line + end + end.compact! + { type: type, content: content } else { type: type, content: content } end @@ -151,10 +144,5 @@ module Skeksis :text end end - - def parse_line(line) - - end - end end