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

sile-typesetter / sile / 6713098919

31 Oct 2023 10:21PM UTC coverage: 52.831% (-21.8%) from 74.636%
6713098919

push

github

web-flow
Merge d0a2a1ee9 into b185d4972

45 of 45 new or added lines in 3 files covered. (100.0%)

8173 of 15470 relevant lines covered (52.83%)

6562.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

© 2025 Coveralls, Inc