feat: add meta tag
This commit is contained in:
parent
07dd66ed07
commit
35013b0676
2 changed files with 80 additions and 0 deletions
17
exe/yamd
17
exe/yamd
|
|
@ -91,6 +91,23 @@ class HTMLRenderer < YAMD::Renderer
|
|||
}
|
||||
end
|
||||
|
||||
def single_tag(name, **attrs)
|
||||
@buf << "<#{name}"
|
||||
attrs.each { |k, v|
|
||||
@buf << " "
|
||||
if k.kind_of? Symbol
|
||||
k = k.to_s
|
||||
end
|
||||
@buf << k
|
||||
@buf << "=" << v.dump
|
||||
}
|
||||
@buf << "/>"
|
||||
end
|
||||
|
||||
def meta(name, value)
|
||||
single_tag('meta', name: name, content: value)
|
||||
end
|
||||
|
||||
def tag(name, **attrs)
|
||||
@buf << "<#{name}"
|
||||
attrs.each { |k, v|
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue