mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-08-14.git
synced 2024-08-15 00:53:20 +00:00
29 lines
663 B
Crystal
29 lines
663 B
Crystal
macro add_mapping(mapping)
|
|
def initialize({{*mapping.keys.map { |id| "@#{id}".id }}})
|
|
end
|
|
|
|
def to_a
|
|
return [{{*mapping.keys.map { |id| "@#{id}".id }}}]
|
|
end
|
|
|
|
DB.mapping({{mapping}})
|
|
end
|
|
|
|
macro json_mapping(mapping)
|
|
def initialize({{*mapping.keys.map { |id| "@#{id}".id }}})
|
|
end
|
|
|
|
def to_a
|
|
return [{{*mapping.keys.map { |id| "@#{id}".id }}}]
|
|
end
|
|
|
|
JSON.mapping({{mapping}})
|
|
end
|
|
|
|
macro templated(filename, template = "template")
|
|
render "src/invidious/views/#{{{filename}}}.ecr", "src/invidious/views/#{{{template}}}.ecr"
|
|
end
|
|
|
|
macro rendered(filename)
|
|
render "src/invidious/views/#{{{filename}}}.ecr"
|
|
end
|