tartrazine/src/tartrazine.cr

32 lines
733 B
Crystal
Raw Normal View History

2024-08-07 20:47:11 +00:00
require "./actions"
require "./formatter"
require "./formatters/**"
2024-08-07 20:47:11 +00:00
require "./rules"
require "./styles"
require "./tartrazine"
2024-08-07 19:42:38 +00:00
require "baked_file_system"
2024-08-03 22:25:09 +00:00
require "base58"
2024-08-03 21:46:45 +00:00
require "json"
2024-08-04 23:24:48 +00:00
require "log"
2024-08-03 22:25:09 +00:00
require "xml"
2024-08-04 22:54:34 +00:00
2024-08-02 20:03:39 +00:00
module Tartrazine
2024-08-06 20:01:14 +00:00
extend self
2024-08-13 14:06:06 +00:00
VERSION = {{ `shards version #{__DIR__}`.chomp.stringify }}
2024-08-02 20:03:39 +00:00
2024-08-04 23:24:48 +00:00
Log = ::Log.for("tartrazine")
2024-08-03 08:05:01 +00:00
end
2024-08-02 20:09:05 +00:00
# Convenience macros to parse XML
macro xml_to_s(node, name)
2024-08-02 20:23:40 +00:00
{{node}}.children.find{|n| n.name == "{{name}}".lstrip("_")}.try &.content.to_s
end
2024-08-03 08:05:01 +00:00
macro xml_to_f(node, name)
({{node}}.children.find{|n| n.name == "{{name}}".lstrip("_")}.try &.content.to_s.to_f)
2024-08-02 20:09:05 +00:00
end
macro xml_to_a(node, name)
{{node}}.children.select{|n| n.name == "{{name}}".lstrip("_")}.map {|n| n.content.to_s}
end