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

sile-typesetter / sile / 9409557472

07 Jun 2024 12:09AM UTC coverage: 69.448% (-4.5%) from 73.988%
9409557472

push

github

alerque
fix(build): Distribute vendored compat-5.3.c source file

12025 of 17315 relevant lines covered (69.45%)

6023.46 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
   self:registerCommand("date", function (options, _)
×
26
      local datestring = self:date(options)
×
27
      SILE.typesetter:typeset(datestring)
×
28
   end, "Output a timestamp using the system date function")
×
29
end
30

31
package.documentation = [[
32
\begin{document}
33
The \autodoc:package{date} package provides the \autodoc:command{\date} command, which simply outputs a date using the system’s date function.
34
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.
35
You can customize the format by passing the \autodoc:parameter{format} parameter, following the formatting codes in the Lua manual
36
(\url{https://www.lua.org/pil/22.1.html}).
37
\end{document}
38
]]
×
39

40
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