Remove old implementation of strip_markers

This commit is contained in:
maddiebaka 2023-08-03 13:43:29 -04:00
parent 26cbb6d345
commit 1e2dba2630

View File

@ -101,43 +101,6 @@ module Skeksis
end end
def strip_markers(gemtext)
gemtext.map do |line|
type = line[:type]
content = line[:content]
text = content[0]
case type
when :blank
#{ type: type, content: nil }
{ type: type }
when :header
m = /^(#+)(\s*)(.*)/.match(text)
level = m[1].count("#")
{ type: type, level: level, content: [m[3]] }
when :list
{ type: type, content: content.map { |t| t.sub(/^\*\s*/, "") } }
when :quote
{ type: type, content: content.map { |t| t.sub(/^\>\s?/, "") } }
when :uri
a = text.sub(/^=>\s*/, "").split(" ", 2)
link = a[0]
text = a[1]
{ 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
else
{ type: type, content: content }
end
end.compact
end
def get_type(l) def get_type(l)
case l case l
when "" when ""