• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

sile-typesetter / sile / 9304060604

30 May 2024 02:07PM UTC coverage: 74.124% (-0.6%) from 74.707%
9304060604

push

github

alerque
style: Reformat Lua with stylua

8104 of 11995 new or added lines in 184 files covered. (67.56%)

15 existing lines in 11 files now uncovered.

12444 of 16788 relevant lines covered (74.12%)

7175.1 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/classes/markdown.lua
1
-- You will need my lunamark fork from https://github.com/simoncozens/lunamark
2
-- for the AST writer.
3

4
local book = require("classes.book")
×
5
local class = pl.class(book)
×
6
class._name = "markdown"
×
7

8
SILE.inputs.markdown = {
×
9
   order = 2,
10
   appropriate = function (fn, _)
NEW
11
      return fn:match("md$") or fn:match("markdown$")
×
12
   end,
13
   process = function (data)
NEW
14
      local lunamark = require("lunamark")
×
NEW
15
      local reader = lunamark.reader.markdown
×
NEW
16
      local writer = lunamark.writer.ast.new()
×
NEW
17
      local parse = reader.new(writer)
×
NEW
18
      local t = parse(data)
×
NEW
19
      t = { [1] = t, id = "document", options = { class = "markdown" } }
×
20
      -- SILE.inputs.common.init(fn, t)
NEW
21
      SILE.process(t[1])
×
22
   end,
23
}
24

25
function class:_init (options)
×
NEW
26
   book._init(self, options)
×
NEW
27
   self:loadPackage("url")
×
NEW
28
   self:loadPackage("image")
×
29
end
30

31
function class:registerCommands ()
×
NEW
32
   book.registerCommands(self)
×
33

NEW
34
   self:registerCommand("sect1", function (options, content)
×
NEW
35
      SILE.call("chapter", options, content)
×
36
   end)
37

NEW
38
   self:registerCommand("sect2", function (options, content)
×
NEW
39
      SILE.call("section", options, content)
×
40
   end)
41

NEW
42
   self:registerCommand("sect3", function (options, content)
×
NEW
43
      SILE.call("subsection", options, content)
×
44
   end)
45

NEW
46
   self:registerCommand("emphasis", function (options, content)
×
NEW
47
      SILE.call("em", options, content)
×
48
   end)
49

NEW
50
   self:registerCommand("paragraph", function (_, content)
×
NEW
51
      SILE.process(content)
×
NEW
52
      SILE.call("par")
×
53
   end)
54

NEW
55
   self:registerCommand("bulletlist", function (_, content)
×
NEW
56
      SILE.process(content)
×
57
   end)
58

NEW
59
   self:registerCommand("link", function (_, content)
×
60
      SILE.call("verbatim:font", {}, content)
×
61
   end)
62

NEW
63
   self:registerCommand("image", function (_, content)
×
NEW
64
      SILE.call("img", { src = content.src })
×
65
   end)
66
end
67

68
return class
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc