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

sile-typesetter / sile / 5913454052

19 Aug 2023 08:49PM UTC coverage: 54.288% (-20.1%) from 74.359%
5913454052

push

github

web-flow
Merge bb71e7fce into c8a15fb85

8469 of 15600 relevant lines covered (54.29%)

6468.28 hits per line

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

0.0
/packages/date/init.lua
1
local base = require("packages.base")
×
2

3
local package = pl.class(base)
×
4
package._name = "date"
×
5

6
local localeify = function (lang)
7
  lang = lang == "en-u-va-posix" and "en" or lang
×
8
  return lang .. "_" .. string.upper(lang) ..  ".utf-8"
×
9
end
10

11
function package.date (_, options)
×
12
  options.format = options.format or "%c"
×
13
  options.time = options.time or os.time()
×
14
  options.locale = options.locale or localeify(SILE.settings:get("document.language"))
×
15
  os.setlocale(options.locale, "time")
×
16
  return os.date(options.format, options.time)
×
17
end
18

19
function package:_init ()
×
20
  base._init(self)
×
21
  self:deprecatedExport("date", self.date)
×
22
end
23

24
function package:registerCommands ()
×
25

26
  self:registerCommand("date", function (options, _)
×
27
    local datestring = self:date(options)
×
28
    SILE.typesetter:typeset(datestring)
×
29
  end, "Output a timestamp using the system date function")
×
30

31
end
32

33
package.documentation = [[
34
\begin{document}
35
The \autodoc:package{date} package provides the \autodoc:command{\date} command, which simply outputs a date using the system’s date function.
36
It defaults to the current date and time, but can be used to format any other input time as well using the \autodoc:parameter{time} parameter.
37
You can customize the format by passing the \autodoc:parameter{format} parameter, following the formatting codes in the Lua manual
38
(\url{https://www.lua.org/pil/22.1.html}).
39
\end{document}
40
]]
×
41

42
return package
×
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

© 2026 Coveralls, Inc