From 8801b77ed09876605e42f4a3fddf8c020c14b711 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 5 Oct 2024 08:52:57 -0700 Subject: fix(docs): missing `@returns` desc in _meta/api.lua #30673 --- scripts/util.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'scripts/util.lua') diff --git a/scripts/util.lua b/scripts/util.lua index 6343ad4b21..dda18fb807 100644 --- a/scripts/util.lua +++ b/scripts/util.lua @@ -173,6 +173,19 @@ local function parse_md(text) return extract(root) or {} end +--- Prefixes each line in `text`. +--- +--- Does not wrap, that's not important for "meta" files? (You probably want md_to_vimdoc instead.) +--- +--- @param text string +--- @param prefix_ string +function M.prefix(prefix_, text) + if (text):find('\n$') then + return text:gsub('([^\n]*)[\t ]*\n', prefix_ .. '%1\n') + end + return prefix_ .. text:gsub('([^\n]*)[\t ]*\n', '%1\n' .. prefix_) +end + --- @param x string --- @param start_indent integer --- @param indent integer -- cgit