anatomy 0.1.7 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/anatomy/base.ay +5 -0
- data/lib/anatomy/data.ay +3 -0
- data/lib/anatomy/renderers/html.ay +127 -85
- data/lib/anatomy/stages/meta.ay +3 -0
- data/lib/anatomy/version.rb +1 -1
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 251772338d62c79967219e209665cee35093d54d
|
4
|
+
data.tar.gz: eadb122b153f4a9b2224868513e412b091282413
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de01700a0b61645b1ef728b1d223d0b319d4a446486d3fb02b3175188f6caf33a8e18329c42df6eacec3fea75a2340fef9d6603325b0e8bf69a05cee68f0778c
|
7
|
+
data.tar.gz: 3df0a6a0898c8989613531ba3054686fbcadfab89a2b1876f2e838cb9fa4c7e67b2abb9c49870fa4713bb277447f6aa93ebdc935c38496596453ec1480095769
|
data/lib/anatomy/base.ay
CHANGED
@@ -9,6 +9,11 @@ collect = require("anatomy/stages/collect")
|
|
9
9
|
|
10
10
|
hl = require("hl")
|
11
11
|
|
12
|
+
def(template(mod)):
|
13
|
+
data MetaBlock new(
|
14
|
+
[part]:
|
15
|
+
part template = mod)
|
16
|
+
|
12
17
|
def(title(content, tag-name = data sanitize(content), *extra-tag-names)):
|
13
18
|
data MetaBlock new(
|
14
19
|
[part]:
|
data/lib/anatomy/data.ay
CHANGED
@@ -8,6 +8,8 @@ require("fileutils")
|
|
8
8
|
use(require("anatomy/html"))
|
9
9
|
data = require("anatomy/data")
|
10
10
|
|
11
|
+
in-reference? = dynamic(false)
|
12
|
+
in-sidebar? = dynamic(false)
|
11
13
|
|
12
14
|
fn(tag-url(t)):
|
13
15
|
t target match:
|
@@ -20,97 +22,91 @@ fn(tag-url(t)):
|
|
20
22
|
.url(x):
|
21
23
|
x
|
22
24
|
|
23
|
-
|
24
|
-
|
25
|
-
<dl:
|
26
|
-
[ <dt: over(name)
|
27
|
-
<dd: over(body)
|
28
|
-
]
|
29
|
-
def(over(l & data List)):
|
30
|
-
<ul:
|
31
|
-
l elements collect [body]:
|
32
|
-
<li: over(body)
|
33
|
-
def(over(l & data OrderedList)):
|
34
|
-
<ol:
|
35
|
-
l elements collect [body]:
|
36
|
-
<li: over(body)
|
37
|
-
def(over(p & data Paragraph)):
|
38
|
-
<p: over(p content)
|
39
|
-
def(over(b & data Block)):
|
40
|
-
b style match:
|
25
|
+
fn(block-style(style, content)):
|
26
|
+
style match:
|
41
27
|
.tt:
|
42
|
-
<pre: over(
|
28
|
+
<pre: over(content)
|
43
29
|
|
44
30
|
.verbatim:
|
45
|
-
<pre(.verbatim): over(
|
31
|
+
<pre(.verbatim): over(content)
|
46
32
|
|
47
33
|
.class(*classes):
|
48
|
-
<div(class = classes join(" ")): over(
|
34
|
+
<div(class = classes join(" ")): over(content)
|
35
|
+
|
36
|
+
.classed(style, *classes):
|
37
|
+
h = block-style(style, content)
|
38
|
+
h attributes["class"] = classes join(" ")
|
39
|
+
h
|
40
|
+
|
41
|
+
.unordered-list:
|
42
|
+
<ul: over(content)
|
43
|
+
|
44
|
+
.list-item:
|
45
|
+
<li: over(content)
|
49
46
|
|
50
47
|
.header(depth):
|
51
|
-
<"h#{depth}": over(
|
48
|
+
<"h#{depth}": over(content)
|
52
49
|
|
53
50
|
.inset:
|
54
|
-
<div(style = "margin: 0 2em 1em"): over(
|
51
|
+
<div(style = "margin: 0 2em 1em"): over(content)
|
55
52
|
|
56
53
|
.centered:
|
57
|
-
<div(style = "text-align: center"): over(
|
54
|
+
<div(style = "text-align: center"): over(content)
|
58
55
|
|
59
56
|
.margin-note:
|
60
|
-
<blockquote: over(
|
57
|
+
<blockquote: over(content)
|
61
58
|
|
62
59
|
nil:
|
63
|
-
<div: over(
|
60
|
+
<div: over(content)
|
64
61
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
def(over(t & data Target)):
|
69
|
-
<a(name = t name): nil
|
70
|
-
def(over(p & data Reference)):
|
71
|
-
if(p tag)
|
72
|
-
then:
|
73
|
-
<a(href = tag-url(p tag)):
|
74
|
-
with(in-reference? = true):
|
75
|
-
over(p content)
|
76
|
-
else:
|
77
|
-
<a(.undefined): over(p content)
|
78
|
-
def(over(r & data ResolveElement)):
|
79
|
-
error(.did-not-resolve(r))
|
80
|
-
def(over(e & data Element)):
|
81
|
-
e style match:
|
62
|
+
fn(element-style(style, content)):
|
63
|
+
style match:
|
82
64
|
.italic:
|
83
|
-
<em: over(
|
65
|
+
<em: over(content)
|
84
66
|
|
85
67
|
.bold:
|
86
|
-
<strong: over(
|
68
|
+
<strong: over(content)
|
87
69
|
|
88
70
|
.tt:
|
89
|
-
<code: over(
|
71
|
+
<code: over(content)
|
90
72
|
|
91
73
|
.superscript:
|
92
|
-
<sup: over(
|
74
|
+
<sup: over(content)
|
93
75
|
|
94
76
|
.subscript:
|
95
|
-
<sub: over(
|
77
|
+
<sub: over(content)
|
96
78
|
|
97
79
|
.smaller:
|
98
|
-
<span(style = "font-size: 80%"): over(
|
80
|
+
<span(style = "font-size: 80%"): over(content)
|
99
81
|
|
100
82
|
.larger:
|
101
|
-
<span(style = "font-size: 120%"): over(
|
83
|
+
<span(style = "font-size: 120%"): over(content)
|
102
84
|
|
103
85
|
.strike:
|
104
|
-
<span(style = "text-decoration: line-through"): over(
|
86
|
+
<span(style = "text-decoration: line-through"): over(content)
|
105
87
|
|
106
88
|
.class(*classes):
|
107
|
-
<span(class = classes join(" ")): over(
|
89
|
+
<span(class = classes join(" ")): over(content)
|
90
|
+
|
91
|
+
.classed(style, *classes):
|
92
|
+
h = element-style(style, content)
|
93
|
+
h attributes["class"] = classes join(" ")
|
94
|
+
h
|
95
|
+
|
96
|
+
.button:
|
97
|
+
<button: over(content)
|
108
98
|
|
109
99
|
.hyperlink(url):
|
110
|
-
<a(href = url): over(
|
100
|
+
<a(href = url): over(content)
|
111
101
|
|
112
102
|
.image(file):
|
113
|
-
<img(src = file, alt = over(
|
103
|
+
<img(src = file, alt = over(content))
|
104
|
+
|
105
|
+
.image(file, width):
|
106
|
+
<img(src = file, alt = over(content), width = width)
|
107
|
+
|
108
|
+
.font-awesome(*classes):
|
109
|
+
<i(class = (["fa"] + classes) join(" ")): over(content)
|
114
110
|
|
115
111
|
.svg(file):
|
116
112
|
<object(data = file, type = "image/svg+xml", width = "100%", height = "100%"):
|
@@ -124,8 +120,41 @@ def(over(e & data Element)):
|
|
124
120
|
|
125
121
|
.aux:
|
126
122
|
unless(^(in-reference?) || ^(in-sidebar?)):
|
127
|
-
over(
|
123
|
+
over(content)
|
124
|
+
|
125
|
+
def(over(i & data Itemization)):
|
126
|
+
i elements collect [name, body]:
|
127
|
+
<dl:
|
128
|
+
[ <dt: over(name)
|
129
|
+
<dd: over(body)
|
130
|
+
]
|
131
|
+
def(over(l & data OrderedList)):
|
132
|
+
<ol:
|
133
|
+
l elements collect [body]:
|
134
|
+
<li: over(body)
|
135
|
+
def(over(l & data List)):
|
136
|
+
<ul:
|
137
|
+
l elements collect [body]:
|
138
|
+
<li: over(body)
|
139
|
+
def(over(p & data Paragraph)):
|
140
|
+
<p: over(p content)
|
141
|
+
def(over(b & data Block)):
|
142
|
+
block-style(b style, b content)
|
128
143
|
|
144
|
+
def(over(t & data Target)):
|
145
|
+
<a(name = t name): nil
|
146
|
+
def(over(p & data Reference)):
|
147
|
+
if(p tag)
|
148
|
+
then:
|
149
|
+
<a(href = tag-url(p tag)):
|
150
|
+
with(in-reference? = true):
|
151
|
+
over(p content)
|
152
|
+
else:
|
153
|
+
<a(.undefined): over(p content)
|
154
|
+
def(over(r & data ResolveElement)):
|
155
|
+
error(.did-not-resolve(r))
|
156
|
+
def(over(e & data Element)):
|
157
|
+
element-style(e style, e content)
|
129
158
|
def(over(nil)): nil
|
130
159
|
def(over(s & String)): s
|
131
160
|
def(over(a & Array)):
|
@@ -196,8 +225,12 @@ def(render(part, out = ".")):
|
|
196
225
|
<head:
|
197
226
|
<meta("http-equiv" = "Content-Type", content = "text/html; charset=UTF-8")
|
198
227
|
<title: StrippedTags new(over(part title))
|
199
|
-
|
200
|
-
|
228
|
+
|
229
|
+
unless(part template):
|
230
|
+
[ <link(type = "text/css", rel = "stylesheet", href = "public/anatomy.css")
|
231
|
+
<link(type = "text/css", rel = "stylesheet", href = "public/highlight.css")
|
232
|
+
]
|
233
|
+
|
201
234
|
<script(type = "text/javascript", src = "public/jquery.js") {}
|
202
235
|
<script(type = "text/javascript", src = "public/jquery.hotkeys.js") {}
|
203
236
|
<script(type = "text/javascript", src = "public/tags.js") {}
|
@@ -207,29 +240,7 @@ def(render(part, out = ".")):
|
|
207
240
|
<link(type = "text/css", rel = "stylesheet", href = File basename(addition))
|
208
241
|
|
209
242
|
<body(class = class):
|
210
|
-
|
211
|
-
<div(#content):
|
212
|
-
render-part(part, out)
|
213
|
-
|
214
|
-
<div(.search):
|
215
|
-
<form(action = "javascript:void(0)"):
|
216
|
-
<input(
|
217
|
-
type = "text"
|
218
|
-
placeholder = "Search…"
|
219
|
-
autocomplete = "off"
|
220
|
-
#search)
|
221
|
-
|
222
|
-
<ul(.search-results) {}
|
223
|
-
|
224
|
-
with(in-sidebar? = true):
|
225
|
-
<div(#sidebar):
|
226
|
-
<h2:
|
227
|
-
<a(href = url(part top)):
|
228
|
-
over(part top title)
|
229
|
-
|
230
|
-
<ol(.toc):
|
231
|
-
part top parts collect [p]:
|
232
|
-
toc-leaf(part, p)
|
243
|
+
render-part-template(part, out)
|
233
244
|
|
234
245
|
when(analytics-id = ENV["ANALYTICS_ID"]):
|
235
246
|
<script: UnescapedString new(i"
|
@@ -243,13 +254,37 @@ def(render(part, out = ".")):
|
|
243
254
|
")
|
244
255
|
})
|
245
256
|
|
246
|
-
def(render-part(part, out = "."
|
247
|
-
part
|
248
|
-
|
257
|
+
def(render-part-template(part, out = ".")):
|
258
|
+
copy-part-assets(part, out)
|
259
|
+
(part template || Self) template-for(part, out)
|
249
260
|
|
250
|
-
|
251
|
-
|
261
|
+
def(template-for(part, out)):
|
262
|
+
<div(#page):
|
263
|
+
<div(#main):
|
264
|
+
<div(#content):
|
265
|
+
render-part(part, out)
|
266
|
+
|
267
|
+
<div(.search):
|
268
|
+
<form(action = "javascript:void(0)"):
|
269
|
+
<input(
|
270
|
+
type = "text"
|
271
|
+
placeholder = "Search…"
|
272
|
+
autocomplete = "off"
|
273
|
+
#search)
|
274
|
+
|
275
|
+
<ul(.search-results) {}
|
276
|
+
|
277
|
+
with(in-sidebar? = true):
|
278
|
+
<div(#sidebar):
|
279
|
+
<h2:
|
280
|
+
<a(href = url(part top)):
|
281
|
+
over(part top title)
|
252
282
|
|
283
|
+
<ol(.toc):
|
284
|
+
part top parts collect [p]:
|
285
|
+
toc-leaf(part, p)
|
286
|
+
|
287
|
+
def(render-part(part, out = ".", depth = 1)):
|
253
288
|
<div(.section, id = i"section_#{part tag name}"):
|
254
289
|
<"h#{depth}"(.section_header):
|
255
290
|
<a(name = part tag name) {}
|
@@ -265,8 +300,15 @@ def(render-part(part, out = ".", depth = 1)):
|
|
265
300
|
toc-leaf(part, sub)
|
266
301
|
else:
|
267
302
|
part parts collect [sub]:
|
303
|
+
copy-part-assets(sub, out)
|
268
304
|
render-part(sub, out, depth + 1)
|
269
305
|
|
306
|
+
def(copy-part-assets(part, out)):
|
307
|
+
part assets each [a]:
|
308
|
+
FileUtils cp_r(a, out, #{.remove_destination -> true})
|
309
|
+
|
310
|
+
part css-additions each [a]:
|
311
|
+
FileUtils cp_r(a, out)
|
270
312
|
|
271
313
|
def(search-tags(p)):
|
272
314
|
tags = [
|
data/lib/anatomy/stages/meta.ay
CHANGED
data/lib/anatomy/version.rb
CHANGED
metadata
CHANGED
@@ -1,66 +1,66 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: anatomy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Suraci
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
type: :runtime
|
15
14
|
name: atomy
|
16
|
-
|
15
|
+
type: :runtime
|
17
16
|
requirement: !ruby/object:Gem::Requirement
|
18
17
|
requirements:
|
19
18
|
- - "~>"
|
20
19
|
- !ruby/object:Gem::Version
|
21
20
|
version: 0.6.3
|
21
|
+
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.6.3
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
type: :runtime
|
29
28
|
name: broomhlda
|
30
|
-
|
29
|
+
type: :runtime
|
31
30
|
requirement: !ruby/object:Gem::Requirement
|
32
31
|
requirements:
|
33
32
|
- - "~>"
|
34
33
|
- !ruby/object:Gem::Version
|
35
34
|
version: 0.2.0
|
35
|
+
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.2.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
type: :runtime
|
43
42
|
name: json_pure
|
44
|
-
|
43
|
+
type: :runtime
|
45
44
|
requirement: !ruby/object:Gem::Requirement
|
46
45
|
requirements:
|
47
46
|
- - "~>"
|
48
47
|
- !ruby/object:Gem::Version
|
49
48
|
version: '1.8'
|
49
|
+
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.8'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
type: :development
|
57
56
|
name: rake
|
58
|
-
|
57
|
+
type: :development
|
59
58
|
requirement: !ruby/object:Gem::Requirement
|
60
59
|
requirements:
|
61
60
|
- - "~>"
|
62
61
|
- !ruby/object:Gem::Version
|
63
62
|
version: '10.4'
|
63
|
+
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
118
|
version: '0'
|
119
119
|
requirements: []
|
120
120
|
rubyforge_project: anatomy
|
121
|
-
rubygems_version: 2.
|
121
|
+
rubygems_version: 2.5.1
|
122
122
|
signing_key:
|
123
123
|
specification_version: 4
|
124
124
|
summary: Anatomy documentation system
|