Skip to content

Commit

Permalink
Merge pull request #540 from Witiko/fix/copyright-year-and-improve-pa…
Browse files Browse the repository at this point in the history
…rsers

Bump copyright year and remove needless parentheses in file `markdown-unicode-data.lua`
  • Loading branch information
Witiko authored Jan 13, 2025
2 parents 152b504 + 6041cdc commit 9d22442
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 19 deletions.
4 changes: 2 additions & 2 deletions docstrip.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
-- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE^^J%
-- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.^^J%
--^^J%
-- Copyright (C) 2016-2024 Vít Starý Novotný, Andrej Genčur^^J%
-- Copyright (C) 2016-2025 Vít Starý Novotný, Andrej Genčur^^J%
--^^J%
-- This work may be distributed and/or modified under the^^J%
-- conditions of the LaTeX Project Public License, either version 1.3^^J%
Expand Down Expand Up @@ -62,7 +62,7 @@
\let\luapostamble\empty
\declarepreamble\texpreamble
Copyright (C) 2016-2024 Vít Starý Novotný, Andrej Genčur
Copyright (C) 2016-2025 Vít Starý Novotný, Andrej Genčur
This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either version 1.3c
Expand Down
37 changes: 20 additions & 17 deletions markdown.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -27528,17 +27528,17 @@ parsers.ascii_punctuation = S("!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~")
end

print("M.punctuation = {}")
print("local S = lpeg.S")
print("local P = lpeg.P")
print("-- luacheck: push no max line length")
for length, prefix_tree in pairs(prefix_trees) do
local subparsers = {}
depth_first_search(prefix_tree, "", function(node, path)
if type(node) == "string" then
local suffix
if node == "]" then
suffix = "S('" .. node .. "')"
suffix = "P('" .. node .. "')"
else
suffix = "S([[" .. node .. "]])"
suffix = "P([[" .. node .. "]])"
end
if subparsers[path] ~= nil then
subparsers[path] = subparsers[path] .. " + " .. suffix
Expand All @@ -27550,20 +27550,23 @@ parsers.ascii_punctuation = S("!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~")
if #path > 0 then
local byte = path:sub(#path, #path)
local parent_path = path:sub(1, #path-1)
if subparsers[path] ~= nil then
local suffix
if byte == "]" then
suffix = "S('" .. byte .. "')"
else
suffix = "S([[" .. byte .. "]])"
end
suffix = suffix .. " * (" .. subparsers[path] .. ")"
if subparsers[parent_path] ~= nil then
subparsers[parent_path] = subparsers[parent_path]
.. " + " .. suffix
else
subparsers[parent_path] = suffix
end
local prefix
if byte == "]" then
prefix = "P('" .. byte .. "')"
else
prefix = "P([[" .. byte .. "]])"
end
local suffix
if subparsers[path]:find(" %+ ") then
suffix = prefix .. " * (" .. subparsers[path] .. ")"
else
suffix = prefix .. " * " .. subparsers[path]
end
if subparsers[parent_path] ~= nil then
subparsers[parent_path] = subparsers[parent_path]
.. " + " .. suffix
else
subparsers[parent_path] = suffix
end
else
print("M.punctuation[" .. length .. "] = " .. subparsers[path])
Expand Down

0 comments on commit 9d22442

Please sign in to comment.