mirror of
https://github.com/ralsina/tartrazine.git
synced 2024-11-10 05:22:23 +00:00
Reorg
This commit is contained in:
parent
444db0abda
commit
7d7a4294ed
@ -12,14 +12,6 @@ module Tartrazine
|
||||
priority: 0,
|
||||
}
|
||||
|
||||
macro xml_to_s(node, name)
|
||||
{{node}}.children.find{|n| n.name == "{{name}}".lstrip("_")}.as(XML::Node).content.to_s
|
||||
end
|
||||
|
||||
macro xml_to_a(node, name)
|
||||
{{node}}.children.select{|n| n.name == "{{name}}".lstrip("_")}.map {|n| n.content.to_s}
|
||||
end
|
||||
|
||||
def self.from_xml(xml : String) : Lexer
|
||||
l = Lexer.new
|
||||
lexer = XML.parse(xml).first_element_child
|
||||
@ -40,5 +32,14 @@ module Tartrazine
|
||||
end
|
||||
end
|
||||
|
||||
l = Tartrazine::Lexer.from_xml(File.read("chroma/lexers/embedded/plaintext.xml"))
|
||||
l = Tartrazine::Lexer.from_xml(File.read("lexers/plaintext.xml"))
|
||||
p! l.config
|
||||
|
||||
# Convenience macros to parse XML
|
||||
macro xml_to_s(node, name)
|
||||
{{node}}.children.find{|n| n.name == "{{name}}".lstrip("_")}.as(XML::Node).content.to_s
|
||||
end
|
||||
|
||||
macro xml_to_a(node, name)
|
||||
{{node}}.children.select{|n| n.name == "{{name}}".lstrip("_")}.map {|n| n.content.to_s}
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user