rtfdoc 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/rtfdoc.rb +31 -11
- data/lib/rtfdoc/version.rb +1 -1
- data/src/css/application.scss +82 -47
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6fe3681c1ed97593bf930b2affe79ce710f8e02ba25220fc2568eb259819907
|
4
|
+
data.tar.gz: 1987316da892c9fafc03b7d541cd772cb767c51730729a2063108048d8bec032
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0993193c6965352819b9e435b3333b5890a98bc685cfc293bc613e97ffc8e72489b4898471ad2e9537d0ab6334e191c30e864deaa17f5a1917baaf3b41d830d
|
7
|
+
data.tar.gz: 449972e46595c02fdda34c6957e7a37ec7e6222ca88dbbbd96e3d3d246438e33d39da704b8df9dbddbbc231964bbce32aa9957fcc823ba28643e265522730448
|
data/Gemfile.lock
CHANGED
data/lib/rtfdoc.rb
CHANGED
@@ -91,14 +91,23 @@ module RTFDoc
|
|
91
91
|
if language == 'attributes' || language == 'parameters'
|
92
92
|
AttributesComponent.new(code, language).output
|
93
93
|
elsif language == 'response'
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
HTML
|
94
|
+
format_code('RESPONSE', code)
|
95
|
+
elsif language == 'title_and_code'
|
96
|
+
title, _code = code.split("\n", 2)
|
97
|
+
title ||= 'RESPONSE'
|
98
|
+
format_code(title, _code)
|
100
99
|
end
|
101
100
|
end
|
101
|
+
|
102
|
+
private def format_code(title, code)
|
103
|
+
<<-HTML
|
104
|
+
<div class="section-response">
|
105
|
+
<div class="response-topbar">#{title}</div>
|
106
|
+
<pre><code>#{rouge_formatter.format(rouge_lexer.lex(code.strip))}</code></pre>
|
107
|
+
</div>
|
108
|
+
HTML
|
109
|
+
end
|
110
|
+
|
102
111
|
end
|
103
112
|
|
104
113
|
class Template
|
@@ -157,7 +166,7 @@ module RTFDoc
|
|
157
166
|
parse_metadata(YAML.load(raw_content.slice!(0, idx + 3)))
|
158
167
|
end
|
159
168
|
|
160
|
-
raise 'missing metadata' if resource && !@path && !@method
|
169
|
+
raise 'missing metadata' if resource && !meta_section? && !@path && !@method
|
161
170
|
|
162
171
|
@content, @example = raw_content.split('$$$')
|
163
172
|
end
|
@@ -179,17 +188,28 @@ module RTFDoc
|
|
179
188
|
end
|
180
189
|
|
181
190
|
def signature
|
182
|
-
sig
|
191
|
+
anchor(sig)
|
192
|
+
end
|
193
|
+
|
194
|
+
def example_to_html
|
195
|
+
res = super
|
196
|
+
@resource && res && !meta_section? ? res.sub('RESPONSE', sig) : res
|
197
|
+
end
|
198
|
+
|
199
|
+
private
|
200
|
+
|
201
|
+
def sig
|
202
|
+
@sig ||= <<-HTML.strip!
|
183
203
|
<div class="endpoint-def">
|
184
204
|
<div class="method method__#{method.downcase}">#{method.upcase}</div>
|
185
205
|
<div class="path">#{path}</div>
|
186
206
|
</div>
|
187
207
|
HTML
|
188
|
-
|
189
|
-
anchor(sig)
|
190
208
|
end
|
191
209
|
|
192
|
-
|
210
|
+
def meta_section?
|
211
|
+
name == 'desc' || name == 'object'
|
212
|
+
end
|
193
213
|
|
194
214
|
def menu_title
|
195
215
|
@menu_title || name.capitalize
|
data/lib/rtfdoc/version.rb
CHANGED
data/src/css/application.scss
CHANGED
@@ -29,14 +29,19 @@
|
|
29
29
|
--endpoints-line-height: 22px;
|
30
30
|
--table-font-size: 14px;
|
31
31
|
--table-line-height: 18px;
|
32
|
-
--code-font-size: 14px;
|
32
|
+
--code-font-size: 14px;
|
33
|
+
}
|
33
34
|
|
34
35
|
* {
|
35
36
|
box-sizing: border-box;
|
36
|
-
word-wrap: break-word;
|
37
|
+
word-wrap: break-word;
|
38
|
+
-moz-osx-font-smoothing: grayscale;
|
39
|
+
-webkit-font-smoothing: antialiased;
|
40
|
+
}
|
37
41
|
|
38
42
|
html {
|
39
|
-
overflow: auto;
|
43
|
+
overflow: auto;
|
44
|
+
}
|
40
45
|
|
41
46
|
body {
|
42
47
|
margin: 0;
|
@@ -46,7 +51,9 @@ body {
|
|
46
51
|
overflow-y: scroll;
|
47
52
|
max-width: 100%;
|
48
53
|
-moz-osx-font-smoothing: grayscale;
|
49
|
-
|
54
|
+
-webkit-font-smoothing: antialiased;
|
55
|
+
background-color: var(--background-color);
|
56
|
+
}
|
50
57
|
|
51
58
|
body[data-theme="dark"] {
|
52
59
|
--background-color: var(--sail-gray900);
|
@@ -79,7 +86,8 @@ body[data-theme="dark"] {
|
|
79
86
|
--code-numbers: #56b6c2;
|
80
87
|
--code-booleans: #d19a66;
|
81
88
|
--child-list-title-color: var(--sail-gray500);
|
82
|
-
--child-list-title-hover-color: var(--sail-gray100);
|
89
|
+
--child-list-title-hover-color: var(--sail-gray100);
|
90
|
+
}
|
83
91
|
|
84
92
|
body[data-theme="light"] {
|
85
93
|
--background-color: #fff;
|
@@ -112,7 +120,8 @@ body[data-theme="light"] {
|
|
112
120
|
--code-numbers: #005cc5;
|
113
121
|
--code--booleans: #e36209;
|
114
122
|
--child-list-title-color: #586069;
|
115
|
-
--child-list-title-hover-color: #24292e;
|
123
|
+
--child-list-title-hover-color: #24292e;
|
124
|
+
}
|
116
125
|
|
117
126
|
#sidebar {
|
118
127
|
width: var(--sidebar-width);
|
@@ -122,20 +131,24 @@ body[data-theme="light"] {
|
|
122
131
|
left: 0;
|
123
132
|
bottom: 0;
|
124
133
|
z-index: 10;
|
125
|
-
box-shadow: -1px 0 0 0 var(--divider-color) inset;
|
134
|
+
box-shadow: -1px 0 0 0 var(--divider-color) inset;
|
135
|
+
}
|
126
136
|
|
127
137
|
.sidebar-header {
|
128
138
|
color: var(--nav-header-color);
|
129
139
|
padding: 16px;
|
130
140
|
display: flex;
|
131
141
|
flex-direction: row;
|
132
|
-
justify-content: space-between;
|
133
|
-
.sidebar-
|
142
|
+
justify-content: space-between;
|
143
|
+
.sidebar-title {
|
134
144
|
font-size: 15px;
|
135
|
-
line-height: 20px;
|
136
|
-
|
145
|
+
line-height: 20px;
|
146
|
+
}
|
147
|
+
.api {
|
137
148
|
text-transform: uppercase;
|
138
|
-
color: var(--brand-color);
|
149
|
+
color: var(--brand-color);
|
150
|
+
}
|
151
|
+
}
|
139
152
|
|
140
153
|
.sidebar-nav {
|
141
154
|
margin-top: 16px; }
|
@@ -330,59 +343,81 @@ ul {
|
|
330
343
|
.section-response {
|
331
344
|
background: var(--response-background-color);
|
332
345
|
border-radius: 8px;
|
333
|
-
box-shadow: 0 0 0 1px var(--response-shadow-color);
|
334
|
-
|
346
|
+
box-shadow: 0 0 0 1px var(--response-shadow-color);
|
347
|
+
max-height: 83vh;
|
348
|
+
overflow-y: auto;
|
349
|
+
|
350
|
+
.response-topbar {
|
335
351
|
background: var(--block-header-background-color);
|
336
352
|
padding: 10px 12px;
|
337
353
|
font-weight: 500;
|
338
354
|
font-size: 12px;
|
339
355
|
color: var(--response-header-color);
|
340
|
-
border-radius: 8px 8px 0 0;
|
341
|
-
|
356
|
+
border-radius: 8px 8px 0 0;
|
357
|
+
text-transform: uppercase;
|
358
|
+
|
359
|
+
.endpoint-def .method { width: auto }
|
360
|
+
}
|
361
|
+
|
362
|
+
p {
|
342
363
|
margin: 0;
|
343
|
-
padding: 12px var(--sp20);
|
344
|
-
|
364
|
+
padding: 12px var(--sp20);
|
365
|
+
}
|
366
|
+
|
367
|
+
pre {
|
345
368
|
margin: 0;
|
346
369
|
padding: 12px;
|
347
370
|
color: var(--code-color);
|
348
371
|
font-family: var(--monospace-font);
|
349
372
|
font-size: var(--code-font-size);
|
350
373
|
font-weight: 400;
|
351
|
-
line-height: 18px;
|
374
|
+
line-height: 18px;
|
375
|
+
}
|
376
|
+
}
|
352
377
|
|
353
|
-
.
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
.section-endpoints .method {
|
378
|
+
.endpoint-def {
|
379
|
+
display: flex;
|
380
|
+
flex-direction: row;
|
381
|
+
font-family: var(--monospace-font);
|
382
|
+
font-size: var(--code-font-size);
|
383
|
+
font-weight: 500;
|
384
|
+
line-height: 22px;
|
385
|
+
color: var(--endpoints-def-color);
|
386
|
+
|
387
|
+
.method {
|
364
388
|
text-align: right;
|
365
389
|
width: 55px;
|
366
|
-
margin-right: 7px;
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
.
|
373
|
-
|
374
|
-
.
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
.
|
379
|
-
|
380
|
-
|
381
|
-
|
390
|
+
margin-right: 7px;
|
391
|
+
text-transform: uppercase;
|
392
|
+
}
|
393
|
+
|
394
|
+
.path { text-transform: none }
|
395
|
+
|
396
|
+
.method__get { color: var(--sail-blue400); }
|
397
|
+
.method__post { color: #50b573; }
|
398
|
+
.method__patch,
|
399
|
+
.method__put {
|
400
|
+
color: #50b573;
|
401
|
+
}
|
402
|
+
.method__delete { color: var(--redish); }
|
403
|
+
}
|
404
|
+
|
405
|
+
.section-endpoints {
|
406
|
+
padding: 12px 22px;
|
407
|
+
|
408
|
+
a { text-decoration: none; }
|
409
|
+
a:hover .method {
|
410
|
+
filter: brightness(calc(100% + var(--filter-ratio)));
|
411
|
+
}
|
412
|
+
a:hover .path {
|
413
|
+
color: var(--endpoints-def-hover-color);
|
414
|
+
}
|
415
|
+
}
|
382
416
|
|
383
417
|
h3 {
|
384
418
|
margin-top: 20px;
|
385
|
-
padding-top: 16px;
|
419
|
+
padding-top: 16px;
|
420
|
+
}
|
386
421
|
|
387
422
|
h3,
|
388
423
|
.section-list .section-list-title {
|