aboutsummaryrefslogtreecommitdiff
path: root/.config/awesome/quarrel/markup.lua
diff options
context:
space:
mode:
Diffstat (limited to '.config/awesome/quarrel/markup.lua')
-rw-r--r--.config/awesome/quarrel/markup.lua30
1 files changed, 30 insertions, 0 deletions
diff --git a/.config/awesome/quarrel/markup.lua b/.config/awesome/quarrel/markup.lua
new file mode 100644
index 0000000..d206530
--- /dev/null
+++ b/.config/awesome/quarrel/markup.lua
@@ -0,0 +1,30 @@
+--- Apply markup to a file
+---@param content string
+---@param args { bold: boolean, italic: boolean, fg: string, bg: string }
+---@return string
+return function(content, args)
+ args = args or {}
+ if args.bold then
+ content = "<b>" .. content .. "</b>"
+ end
+
+ if args.italic then
+ content = "<i>" .. content .. "</i>"
+ end
+
+ local span_content = ""
+
+ if args.fg or args.bg then
+ if args.fg then
+ span_content = "foreground='" .. args.fg .. "'"
+ end
+
+ if args.bg then
+ span_content = " background='" .. args.bg .. "'"
+ end
+
+ content = "<span " .. span_content .. ">" .. content .. "</span>"
+ end
+
+ return content
+end