• 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
/packages/textcase/init.lua
1
local base = require("packages.base")
×
2

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

6
local icu = require("justenoughicu")
×
7

8
function package:uppercase (input, extraArgs)
×
NEW
9
   if type(self) ~= "table" or (self.type ~= "class" and self.type ~= "package") then
×
NEW
10
      input, extraArgs = self, input
×
11
   end
NEW
12
   if not extraArgs then
×
NEW
13
      extraArgs = {}
×
14
   end
NEW
15
   if not extraArgs.options then
×
NEW
16
      extraArgs.options = {}
×
17
   end
NEW
18
   local lang = extraArgs.options.language or SILE.settings:get("document.language")
×
NEW
19
   return icu.case(input, lang, "upper")
×
20
end
21

22
function package:lowercase (input, extraArgs)
×
NEW
23
   if type(self) ~= "table" or (self.type ~= "class" and self.type ~= "package") then
×
NEW
24
      input, extraArgs = self, input
×
25
   end
NEW
26
   if not extraArgs then
×
NEW
27
      extraArgs = {}
×
28
   end
NEW
29
   if not extraArgs.options then
×
NEW
30
      extraArgs.options = {}
×
31
   end
NEW
32
   local lang = extraArgs.options.language or SILE.settings:get("document.language")
×
NEW
33
   return icu.case(input, lang, "lower")
×
34
end
35

36
function package:titlecase (input, extraArgs)
×
NEW
37
   if type(self) ~= "table" or (self.type ~= "class" and self.type ~= "package") then
×
NEW
38
      input, extraArgs = self, input
×
39
   end
NEW
40
   if not extraArgs then
×
NEW
41
      extraArgs = {}
×
42
   end
NEW
43
   if not extraArgs.options then
×
NEW
44
      extraArgs.options = {}
×
45
   end
NEW
46
   local lang = extraArgs.options.language or SILE.settings:get("document.language")
×
NEW
47
   return icu.case(input, lang, "title")
×
48
end
49

50
function package:_init ()
×
NEW
51
   base._init(self)
×
NEW
52
   self:loadPackage("inputfilter")
×
NEW
53
   self:deprecatedExport("uppercase", self.uppercase)
×
NEW
54
   self:deprecatedExport("lowercase", self.lowercase)
×
NEW
55
   self:deprecatedExport("titlecase", self.titlecase)
×
56
end
57

58
function package:registerCommands ()
×
NEW
59
   self:registerCommand("uppercase", function (options, content)
×
NEW
60
      SILE.process(self.class.packages.inputfilter:transformContent(content, self.uppercase, options))
×
NEW
61
   end, "Typeset the enclosed text as uppercase")
×
62

NEW
63
   self:registerCommand("lowercase", function (options, content)
×
NEW
64
      SILE.process(self.class.packages.inputfilter:transformContent(content, self.lowercase, options))
×
NEW
65
   end, "Typeset the enclosed text as lowercase")
×
66

NEW
67
   self:registerCommand("titlecase", function (options, content)
×
NEW
68
      SILE.process(self.class.packages.inputfilter:transformContent(content, self.titlecase, options))
×
NEW
69
   end, "Typeset the enclosed text as titlecase")
×
70
end
71

72
package.documentation = [[
73
\begin{document}
74
\use[module=packages.textcase]
75
The \autodoc:package{textcase} package provides commands for language-aware case conversion of input text.
76
For example, when language is set to English, then \autodoc:command{\uppercase{hij}} will return \autodoc:example{\uppercase{hij}}.
77
However, when language is set to Turkish, it will return \autodoc:example{\font[language=tr]{\uppercase{hij}}}.
78

79
As well as \autodoc:command{\uppercase}, the package provides the commands \autodoc:command{\lowercase} and \autodoc:command{\titlecase}.
80
\end{document}
81
]]
×
82

83
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