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

sile-typesetter / sile / 7246678005

18 Dec 2023 10:19AM UTC coverage: 67.096% (-7.5%) from 74.62%
7246678005

push

github

web-flow
chore(deps): Bump actions/upload-artifact from 3 to 4 (#1940)

Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

10583 of 15773 relevant lines covered (67.1%)

3150.6 hits per line

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

26.32
/packages/tate/init.lua
1
local base = require("packages.base")
2✔
2

3
local package = pl.class(base)
2✔
4
package._name = "tate"
2✔
5

6
SILE.tateFramePrototype = pl.class(SILE.framePrototype)
4✔
7
SILE.tateFramePrototype.direction = "TTB-RTL"
2✔
8

9

10
SILE.tateFramePrototype.enterHooks = {
2✔
11
    function (_, typesetter)
12
      SILE.typesetters.tate:cast(typesetter)
2✔
13
    end
14
  }
2✔
15

16
SILE.tateFramePrototype.leaveHooks = {
2✔
17
    function (_, typesetter)
18
      SILE.typesetters.base:cast(typesetter)
1✔
19
    end
20
  }
2✔
21

22
SILE.newTateFrame = function (spec)
2✔
23
  return SILE.newFrame(spec, SILE.tateFramePrototype)
×
24
end
25

26
local outputLatinInTate = function (self, typesetter, line)
27
  -- My baseline moved
28
  typesetter.frame:advanceWritingDirection(SILE.measurement("-0.5zw"))
×
29
  typesetter.frame:advancePageDirection(SILE.measurement("0.25zw"))
×
30

31
  local vorigin = -typesetter.frame.state.cursorY
×
32
  self:oldOutputYourself(typesetter,line)
×
33
  typesetter.frame.state.cursorY = -vorigin
×
34
  typesetter.frame:advanceWritingDirection(self:lineContribution())
×
35
  -- My baseline moved
36
  typesetter.frame:advanceWritingDirection(SILE.measurement("0.5zw") )
×
37
  typesetter.frame:advancePageDirection(-SILE.measurement("0.25zw"))
×
38
end
39

40
local outputTateChuYoko = function (self, typesetter, line)
41
  -- My baseline moved
42
  local em = SILE.measurement("1zw")
×
43
  typesetter.frame:advanceWritingDirection(-em + em/4 - self:lineContribution()/2)
×
44
  typesetter.frame:advancePageDirection(2*self.height - self.width/2)
×
45
  self:oldOutputYourself(typesetter,line)
×
46
  typesetter.frame:advanceWritingDirection(-self:lineContribution()*1.5+self.height*3/4)
×
47

48
end
49

50
function package:registerCommands ()
2✔
51

52
  self:registerCommand("tate-frame", function (options, _)
6✔
53
    SILE.documentState.thisPageTemplate.frames[options.id] = SILE.newTateFrame(options)
×
54
  end, "Declares (or re-declares) a frame on this page.")
3✔
55

56
  -- Eventually will be automatically called by script detection, but for now
57
  -- called manually
58
  self:registerCommand("latin-in-tate", function (_, content)
6✔
59
    if SILE.typesetter.frame:writingDirection() ~= "TTB" then
×
60
      return SILE.process(content)
×
61
    end
62
    local nodes
63
    local oldT = SILE.typesetter
×
64
    local prevDirection = oldT.frame.direction
×
65
    self:loadPackage("rotate")
×
66
    SILE.settings:temporarily(function()
×
67
      local latinTypesetter = pl.class(SILE.typesetters.base)
×
68
      local dummyFrame = pl.class(SILE.framePrototype)
×
69
      dummyFrame.init = function (f)
70
        f.state = {}
×
71
      end
72
      latinTypesetter.initFrame = function (typesetter, frame)
73
        typesetter.frame = frame
×
74
      end
75
      local frame = dummyFrame({}, true)
×
76
      SILE.typesetter = latinTypesetter(frame)
×
77
      SILE.settings:set("document.language", "und")
×
78
      SILE.settings:set("font.direction", "LTR")
×
79
      SILE.process(content)
×
80
      nodes = SILE.typesetter.state.nodes
×
81
      SILE.typesetter:shapeAllNodes(nodes)
×
82
      SILE.typesetter.frame.direction = prevDirection
×
83
    end)
84
    SILE.typesetter = oldT
×
85
    SILE.typesetter:pushGlue({
×
86
      width = SILE.length("0.5zw", "0.25zw", "0.25zw"):absolute()
×
87
    })
88
    for i = 1, #nodes do
×
89
      if SILE.typesetter.frame:writingDirection() ~= "TTB" or nodes[i].is_glue then
×
90
        SILE.typesetter:pushHorizontal(nodes[i])
×
91
      elseif nodes[i]:lineContribution():tonumber() > 0 then
×
92
        local hbox = SILE.call("hbox", {}, function ()
×
93
          SILE.typesetter:pushHorizontal(nodes[i])
×
94
        end)
95
        -- Turn off all complex flags.
96
        for j = 1, #(hbox.value) do
×
97
          for k = 1, #(hbox.value[j].nodes) do
×
98
            hbox.value[j].nodes[k].value.complex = false
×
99
          end
100
        end
101
        hbox.oldOutputYourself = hbox.outputYourself
×
102
        hbox.outputYourself = outputLatinInTate
×
103
      end
104
    end
105
  end, "Typeset rotated Western text in vertical Japanese")
3✔
106

107
  self:registerCommand("tate-chu-yoko", function (_, content)
6✔
108
    if SILE.typesetter.frame:writingDirection() ~= "TTB" then return SILE.process(content) end
×
109
    -- SILE.typesetter:pushGlue({
110
    --   width = SILE.length.new({length = SILE.toPoints("0.5zw"),
111
    --                            stretch = SILE.toPoints("0.25zw"),
112
    --                             shrink = SILE.toPoints("0.25zw")
113
    --                           })
114
    -- })
115
    SILE.settings:temporarily(function()
×
116
      SILE.settings:set("document.language", "und")
×
117
      SILE.settings:set("font.direction", "LTR")
×
118
      SILE.call("rotate",{angle =-90}, function ()
×
119
        local hbox = SILE.call("hbox", {}, content)
×
120
        hbox.misfit = true
×
121
        hbox.oldOutputYourself = hbox.outputYourself
×
122
        hbox.outputYourself = outputTateChuYoko
×
123
      end)
124

125
    end)
126
    -- SILE.typesetter:pushGlue({
127
    --   width = SILE.length.new({length = SILE.toPoints("0.5zw"),
128
    --                            stretch = SILE.toPoints("0.25zw"),
129
    --                             shrink = SILE.toPoints("0.25zw")
130
    --                           })
131
    -- })
132

133
  end)
134

135
end
136

137
package.documentation = [[
138
\begin{document}
139
The \autodoc:package{tate} package provides support for Japanese vertical typesetting.
140
It allows for the definition of vertical-oriented frames, as well as for two specific typesetting techniques required in vertical documents: \autodoc:command{\latin-in-tate} typesets its content as Latin text rotated 90 degrees, and \autodoc:command{\tate-chu-yoko} places (Latin) text horizontally within a single grid-square of the vertical \em{hanmen}.
141
\end{document}
142
]]
2✔
143

144
return package
2✔
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