nvim-lua-guide/scripts/to_vimdoc.sed

50 lines
682 B
Sed
Raw Normal View History

#!/bin/sed -f
# Title
/^# / {
s/# /*nvim-lua-guide.txt* /
}
# Sections
/^## / {
s/[a-z]/\u&/g
s/## //
i==============================================================================
}
# Sub-sections, tips and caveats
/^####\? / {
s/####\? //
s/.*/&~/
}
2021-08-07 22:19:59 +00:00
# Help links
s/\[`vim\.api\.\(.*\)`\](.*)/|\1|/
2021-08-08 18:07:41 +00:00
s/\[`:help \(.*\)`\](.*)/|\1|/
2021-08-07 22:19:59 +00:00
s/\[`\(.*\)`\](.*)/|\1|/
# Markdown links
/\[.*\](http.*)/ {
y/[]()/ : /
}
# Todos
2021-09-16 18:03:35 +00:00
s/\*\*TODO\*\*: /\t*Todo\t/g
# Warnings
s/\*\*\(WARNING\)\*\*/\1/
# Code blocks
/^```.*$/,/^```$/{
s/.*/ &/
s/```.\+/>/
s/\s*```$/</
}
# Trim trailing whitespace
s/\s\+$//
$a\
\
vim:tw=78:ts=8:noet:ft=help:norl: