Sevgi
#!/usr/bin/env -S ruby -S sevgi
# Example taken from: https://svg-tutorial.com/svg/use
SVG :minimal, width: 200, height: 200, viewBox: do
path id: , stroke: , : 5, d:
60.step(300, 60) { use(href: ).Rotate(it) }
end.Save
#!/usr/bin/env -S ruby -S sevgi
SVG :minimal, width: 200, height: 100 do
rect id: , width: 200, height: 100, rx: 5, fill:
circle id: , cx: 80, cy: 50, r: 40, fill:
circle id: , cx: 90, cy: 28, r: 6, fill:
polygon id: , points: , fill:
symbol id: do
circle cx: 120, cy: 50, r: 6, fill:
end
g id: do
TileX , n: 3, d: 18
end
end.Save
#!/usr/bin/env -S ruby -S sevgi
# frozen_string_literal: true
SVG width: 100, height: 100 do
rect x: 0, y: 0, width: 100, height: 100, fill:
circle cx: 50, cy: 50, r: 40, fill:
rect x: 10, y: 50, width: 80, height: 50, fill:
[ 25, 50 ].each do
circle cx: x, cy: 40, r: 8, fill:
end
path fill: , d:
end.Save
#!/usr/bin/env -S ruby -S sevgi
= 20
= 150
=
= {
: { font: },
: { stroke: , : 0.2 },
: { stroke: , : 0.1 },
: { stroke: , : 0.1 },
: { stroke: , : 0.05, fill: }
}
SVG :inkscape, :a4 do
css STYLE
rect id: , width: WIDTH, height: HEIGHT, class:
layer id: do
length = 2
(0..HEIGHT).step(1) do
hline x: 0, y: y, length: length, class:
hline x: WIDTH, y: y, length: -length, class:
end
end
layer id: do
length = 4
(0..HEIGHT).step(5) do
hline x: 0, y: y, length: length, class:
hline x: WIDTH, y: y, length: -length, class:
end
end
layer id: do
length = 6
(10..HEIGHT - 10).step(10) do
hline x: 0, y: y, length: length, class:
hline x: WIDTH, y: y, length: -length, class:
end
layer id: do
[
3.5,
*(10..HEIGHT - 10).step(10).to_a.map { _1 + 1.4 },
HEIGHT - 1
].each_with_index do
text , x: length + 1.4, y: y, class:
end
end
end
end.Save
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/env -S ruby -S sevgi
= 20
= 150
=
= {
: { font: },
: { stroke: , : 0.2 },
: { stroke: , : 0.1 },
: { stroke: , : 0.1 },
: { stroke: , : 0.05, fill: }
}
SVG :inkscape, :a4 do
css STYLE
rect id: , width: WIDTH, height: HEIGHT, class:
layer id: do
length = 2
(0..HEIGHT).step(1) do
line x1: 0, y1: y, x2: length, y2: y, class:
line x1: WIDTH, y1: y, x2: WIDTH - length, y2: y, class:
end
end
layer id: do
length = 4
(0..HEIGHT).step(5) do
line x1: 0, y1: y, x2: length, y2: y, class:
line x1: WIDTH, y1: y, x2: WIDTH - length, y2: y, class:
end
end
layer id: do
length = 6
(10..HEIGHT - 10).step(10) do
line x1: 0, y1: y, x2: length, y2: y, class:
line x1: WIDTH, y1: y, x2: WIDTH - length, y2: y, class:
end
layer id: do
[
3.5,
*(10..HEIGHT - 10).step(10).to_a.map { _1 + 1.4 },
HEIGHT - 1
].each_with_index do
text , x: length + 1.4, y: y, class:
end
end
end
end.Save
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.