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

sile-typesetter / sile / 9304049654

30 May 2024 02:12PM UTC coverage: 60.021% (-14.7%) from 74.707%
9304049654

push

github

web-flow
Merge 1a26b4f22 into a1fd105f8

6743 of 12900 new or added lines in 186 files covered. (52.27%)

347 existing lines in 49 files now uncovered.

10311 of 17179 relevant lines covered (60.02%)

3307.34 hits per line

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

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

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

NEW
6
function package:_init (options)
×
NEW
7
   base._init(self, options)
×
NEW
8
   SILE.hyphenator.languages.grc = { patterns = {} }
×
NEW
9
   SILE.nodeMakers.grc = pl.class(SILE.nodeMakers.unicode)
×
NEW
10
   function SILE.nodeMakers.grc.iterator (node, items)
×
NEW
11
      return coroutine.wrap(function ()
×
NEW
12
         for i = 1, #items do
×
NEW
13
            node:addToken(items[i].text, items[i])
×
NEW
14
            node:makeToken()
×
NEW
15
            node:makePenalty()
×
NEW
16
            coroutine.yield(SILE.types.node.glue("0pt plus 2pt"))
×
17
         end
18
      end)
19
   end
20
end
21

22
local function hackVboxDir (v, dir)
NEW
23
   local output = v.outputYourself
×
24
   v.outputYourself = function (self, typesetter, line)
NEW
25
      typesetter.frame.direction = dir
×
NEW
26
      typesetter.frame:newLine()
×
NEW
27
      output(self, typesetter, line)
×
28
   end
29
end
30

31
function package:registerCommands ()
×
NEW
32
   self:registerCommand("boustrophedon", function (_, content)
×
NEW
33
      SILE.typesetter:leaveHmode()
×
NEW
34
      local saveBoxup = SILE.typesetter.boxUpNodes
×
NEW
35
      SILE.typesetter.boxUpNodes = function (self_)
×
NEW
36
         local vboxlist = saveBoxup(self_)
×
NEW
37
         local startdir = SILE.typesetter.frame.direction
×
NEW
38
         local dir = startdir
×
NEW
39
         for i = 1, #vboxlist do
×
NEW
40
            if vboxlist[i].is_vbox then
×
NEW
41
               hackVboxDir(vboxlist[i], dir)
×
NEW
42
               dir = dir == "LTR-TTB" and "RTL-TTB" or "LTR-TTB"
×
43
            end
44
         end
NEW
45
         if startdir == dir then
×
NEW
46
            local restore = SILE.types.node.vbox({})
×
47
            restore.outputYourself = function (_, typesetter, _)
NEW
48
               typesetter.frame.direction = startdir
×
NEW
49
               typesetter.frame:newLine()
×
50
            end
NEW
51
            vboxlist[#vboxlist + 1] = restore
×
52
         end
NEW
53
         return vboxlist
×
54
      end
NEW
55
      SILE.process(content)
×
NEW
56
      SILE.typesetter:leaveHmode()
×
NEW
57
      SILE.typesetter.boxUpNodes = saveBoxup
×
58
   end)
59
end
60

61
package.documentation = [[
62
\begin{document}
63
\use[module=packages.boustrophedon]
64
Partly designed to show off SILE’s extensibility, and partly designed for real use by classicists, the \autodoc:package{boustrophedon} package allows you to typeset ancient Greek texts in the “ox-turning” layout: the first line is written left to right as normal, but the next is set right to left, then left to right, and so on.
65
To use it, you will need to set the font’s language to ancient Greek (\code{grc}) and wrap text in a \autodoc:environment{boustrophedon} environment:
66

67
\set[parameter=document.parindent,value=0]{\par
68
\begin{boustrophedon}
69
\font[size=22pt,family=Gentium Plus,language=grc]
70
\noindent{}ΧΑΙΡΕΔΕΜΟΤΟΔΕΣΕΜΑΠΑΤΕΡΕΣΤΕΣΕΘΑΝΟΝΤΟΣΑΝΦΙΧΑΡΕΣΑΓΑΘΟΝΠΑΙΔΑΟΛΟΦΘΡΟΜΕΝΟΣΦΑΙΔΙΜΟΣΕΠΟΙΕ
71
\end{boustrophedon}
72
}
73

74
(Under normal circumstances, that line would appear as \font[language=grc,family=Gentium Plus]{
75
ΧΑΙΡΕΔΕΜΟΤΟΔΕΣΕΜΑΠΑΤΕΡΕΣΤΕΣΕΘΑΝΟΝΤΟΣΑΝΦΙΧΑΡΕΣΑΓΑΘΟΝΠΑΙΔΑΟΛΟΦΘΡΟΜΕΝΟΣΦΑΙΔΙΜΟΣΕΠΟΙΕ
76
}.)
77

78
\end{document}
79
]]
×
80

81
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