-- lx-public:0

-- lx format
local format = require("core.format")

format.register({
	name = "Liqube Page File",
	shortname = "liqubepage",
	author = "liqube",
	created = "2020-05-16",
	default_mode = "preview", -- Render LiqubePage documents through lppreview
	extensions = "page",
	headers = "^@[a-z].-{",
	comment = "//",

	patterns = {
		{ pattern = ";.-\n", type = "comment" },
		{ pattern = "//.-\n", type = "comment" },
		{ pattern = "^^%s*\n", type = "literal" },
		{ pattern = { "<!%-%-", "%-%->" }, type = "comment" }, -- XML comments
		{ pattern = "</?.+>", type = "normal" }, -- HTML
		{ pattern = { "'''", "'''" }, type = "string" },
		{ pattern = { "''", "''" }, type = "string" },
		{ pattern = "0x[%da-fA-F]+", type = "number" },
		{ pattern = "-?%d+[%d%.eE]*", type = "number" },
		{ pattern = "-?%.?%d+", type = "number" },
		{ pattern = "=.+=", type = "function" }, -- Headings
		{ pattern = "@.+@", type = "function" }, -- Arrogant headings
		{ pattern = "%[%[.+%]%]", type = "keyword2" }, -- Links
		{ pattern = "[|{}]", type = "function" }, -- Paragraph
		{ pattern = "|%d+", type = "function" }, -- Paragraph with width
		{ pattern = "%[%^.+%]", type = "operator" },
		{ pattern = "%[/?.+%]", type = "keyword" },
		{ pattern = { "@%w+%s*{", "}" }, type = "operator" }, -- Metas
		{ pattern = "[%[%],%|:]", type = "operator" }, -- Operators
		{ pattern = "%-%-|%-%-%-%-", type = "operator" }, -- Separators and en dashes
		{ pattern = "%#%w+", type = "operator" },
		{ pattern = "%^[%a%w#]+", type = "operator" },
		{ pattern = "%^%^\n", type = "operator" },
		{ pattern = "%s+%*%s+", type = "operator" }, -- Lists
	},

	symbols = {
		["true"] = "literal",
		["false"] = "literal",
		["null"] = "literal",
	},
})
