You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nvim-lua-guide/scripts/to_vimdoc.sed

50 lines
682 B
Sed

#!/bin/sed -f
# Title
/^# / {
s/# /*nvim-lua-guide.txt* /
}
# Sections
/^## / {
s/[a-z]/\u&/g
s/## //
i==============================================================================
}
# Sub-sections, tips and caveats
/^####\? / {
s/####\? //
s/.*/&~/
}
# Help links
s/\[`vim\.api\.\(.*\)`\](.*)/|\1|/
s/\[`:help \(.*\)`\](.*)/|\1|/
s/\[`\(.*\)`\](.*)/|\1|/
# Markdown links
/\[.*\](http.*)/ {
y/[]()/ : /
}
# Todos
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: