mirror of
https://github.com/ralsina/tartrazine.git
synced 2024-10-14 08:22:24 +00:00
32 lines
733 B
Crystal
32 lines
733 B
Crystal
require "./actions"
|
|
require "./formatter"
|
|
require "./formatters/**"
|
|
require "./rules"
|
|
require "./styles"
|
|
require "./tartrazine"
|
|
require "baked_file_system"
|
|
require "base58"
|
|
require "json"
|
|
require "log"
|
|
require "xml"
|
|
|
|
module Tartrazine
|
|
extend self
|
|
VERSION = {{ `shards version #{__DIR__}`.chomp.stringify }}
|
|
|
|
Log = ::Log.for("tartrazine")
|
|
end
|
|
|
|
# Convenience macros to parse XML
|
|
macro xml_to_s(node, name)
|
|
{{node}}.children.find{|n| n.name == "{{name}}".lstrip("_")}.try &.content.to_s
|
|
end
|
|
|
|
macro xml_to_f(node, name)
|
|
({{node}}.children.find{|n| n.name == "{{name}}".lstrip("_")}.try &.content.to_s.to_f)
|
|
end
|
|
|
|
macro xml_to_a(node, name)
|
|
{{node}}.children.select{|n| n.name == "{{name}}".lstrip("_")}.map {|n| n.content.to_s}
|
|
end
|