aboutsummaryrefslogtreecommitdiffstats
path: root/warn-info_sections.lua
diff options
context:
space:
mode:
Diffstat (limited to 'warn-info_sections.lua')
-rw-r--r--warn-info_sections.lua23
1 files changed, 23 insertions, 0 deletions
diff --git a/warn-info_sections.lua b/warn-info_sections.lua
new file mode 100644
index 0000000..40abcc3
--- /dev/null
+++ b/warn-info_sections.lua
@@ -0,0 +1,23 @@
+function Heading(lines, meta)
+ local warningPattern = "%>% [!WARNING]"
+ local infoPattern = "%>% [NOTE]"
+ for i, line in ipairs(lines) do
+ if line:match(warningPattern) then
+ local warning = {}
+ for j = 2, #lines do
+ table.insert(warning, lines[j])
+ end
+ table.insert(meta.warning, {text = warning, color = "red"})
+ elseif line:match(infoPattern) then
+ local info = {}
+ for j = 2, #lines do
+ table.insert(info, lines[j])
+ end
+ table.insert(meta.info, {text = info, color = "blue"})
+ end
+ end
+end
+
+return {
+ Heading = Heading,
+} \ No newline at end of file