---
name: TXT2TAGS
tags:
#- selector : TXT2TAGS
# begin : "\n
\n"
# end : "\n\n"
# filters:
# - indent
- selector : markup.other.paragraph - markup.raw
begin : "\n"
end : "\n
\n"
filters:
- strip
- indent
- selector : markup.heading.plain
cbegin : '""'
cend : '"\n"'
filters :
- strip
- selector : other.filler
invisible: true
- selector : keyword.other - markup.raw
invisible: true
- selector : comment
invisible: true
- selector : variable - markup.raw
invisible: true
- selector : markup.other.email - markup.raw
cbegin : '""'
end :
- selector : markup.other.link - markup.raw
cbegin : '""'
end :
- selector : meta.link.complex markup.other.link - markup.raw
invisible: true
- selector : meta.link.complex - markup.raw
ccontent : |-
"#{children[1].text}"
- selector : markup.bold - markup.raw
begin :
end :
- selector : markup.italic - markup.raw
begin :
end :
- selector : markup.underline - markup.raw
begin :
end :
- selector : markup.raw.verbatim
begin : ""
end : "
"
- selector : markup.raw.verbatim.line
begin : "\n"
end : "\n
\n"
- selector : markup.raw.verbatim.block
begin : "\n"
end : "
\n"
- selector : markup.quote.line - markup.raw
cbegin : |-
@@quote_depth ||= []
depth = predecessor.text.size
if @@quote_depth.empty?
@@quote_depth << depth
("\t" * depth) + "\n"
elsif depth > @@quote_depth.last
@@quote_depth << depth
"\n" + ("\t" * depth) + "\n"
else
""
end
cend : |-
next_depth = successor.text.size
if ! next_depth || successor.name != predecessor.name
result = "\n"
while ! @@quote_depth.empty?
depth = @@quote_depth.pop
result += ("\t" * depth) + "
\n"
end
result
elsif next_depth < @@quote_depth.last
depth = @@quote_depth.pop
"\n" + ("\t" * depth) + "
\n"
else
""
end
filters :
- strip
- selector : markup.list.unnumbered - markup.raw
cbegin : |-
@@list_stack ||= []
res = ""
depth = predecessor.text.size
if @@list_stack.empty?
res += (" " * depth) + "\n"
elsif depth > @@list_stack.last
res += "\n" + (" " * depth) + "\n"
end
@@list_stack << depth
res += "\n" + (" " * depth) + "- \n"
cend : |-
depth = predecessor.text.size
res = ""
if depth < @@list_stack.last
res += "\n"
while depth < @@list_stack.last
res += (" " * @@list_stack.pop) + "
\n"
end
res
end
res += "\n" + (" " * depth ) + "\n"
if successor.name != predecessor.name
res = "\n"
while ! @@list_stack.empty?
depth = @@list_stack.pop
res += (" " * depth) + "
\n"
end
end
res
filters :
- strip
- selector : line.blank
invisible: true
begin :
end :
- selector : markup.other.bar.thin - markup.raw
begin :
nocontent: true
- selector : markup.other.bar.thick - markup.raw
begin :
nocontent: true
- selector : markup.raw line.blank