madness 0.5.7 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f7c16859452e4652252758d4ead7dbb37eace8c0997cc4723891a937c200408f
4
- data.tar.gz: 203352bfdaf474d2c4fcf2cd7b220deffe326ecb0185e8e46a5f0912d888351a
3
+ metadata.gz: 07d2ef37fab295b6921ab9ebcc0b4acff83f62acb8d915be0bf83d7f15529858
4
+ data.tar.gz: db1c5bb7216cd6afef30a0c2bc2cc5b2b29add53ea44ffc8e5fe57eee8faffa4
5
5
  SHA512:
6
- metadata.gz: 3de2ec54e53a84022d9f8131b27c15b7a09985793e21ea30d861354814a0071721aa3a0f3101bb752df9889931f8ecc3b595c1c889a05bd828de3add6b9ca453
7
- data.tar.gz: a3768d1826817338345e537f4e76c34cc3098d71a96ef86833d06c5a481a9a7ab53088cd438ae425332782053f801ebecacc639595db278b2cd2c0e2097bdad4
6
+ metadata.gz: 296e842af36958bed1cd80a43e7326fb3a2e23e7aa4380f645d6b4a275caa3243b5411ed2e00f342e2524dab774899eb1df735b5cf68d711b54a50a6eb65e74a
7
+ data.tar.gz: b6d8e5d2e1f3abc18f262cbab6daf38c636691df911df86063230aed0b57c071711a6912d15b9e7bb5f1501e9327e36a2cccee360a44d42bda1a4f86da1f81c1
data/README.md CHANGED
@@ -9,10 +9,15 @@ Madness - Instant Markdown Server
9
9
  ---
10
10
 
11
11
 
12
- Screenshot
12
+ Screenshots (click to zoom)
13
13
  --------------------------------------------------
14
14
 
15
- ![screenshot]
15
+ <table><tr>
16
+ <td><a target='_screenshot' href='screenshots/main.png'><img src='screenshots/main.png'/></a></td>
17
+ <td><a target='_screenshot' href='screenshots/nav.png'><img src='screenshots/nav.png'/></a></td>
18
+ <td><a target='_screenshot' href='screenshots/code.png'><img src='screenshots/code.png'/></a></td>
19
+ <td><a target='_screenshot' href='screenshots/search.png'><img src='screenshots/search.png'/></a></td>
20
+ </tr></table>
16
21
 
17
22
 
18
23
 
@@ -30,6 +35,7 @@ Table of Contents
30
35
  * [Automatic H1](#automatic-h1)
31
36
  * [Table of Contents Generation](#table-of-contents-generation)
32
37
  * [Hidden Directories](#hidden-directories)
38
+ * [Controlling Sort Order](#controlling-sort-order)
33
39
  * [Customizing Theme](#customizing-theme)
34
40
  * [Docker Image](#docker-image)
35
41
 
@@ -202,6 +208,21 @@ numbers (`/^[a-z_\-0-9]+$/`) will not be displayed in the navigation.
202
208
 
203
209
 
204
210
 
211
+ Controlling Sort Order
212
+ --------------------------------------------------
213
+
214
+ To control the sort order of the automatically generated navigation elements,
215
+ simply perfix your files and directories with digits followed by a dot and a
216
+ space, just like you would create an ordered list in Markdown
217
+
218
+ ```
219
+ ./
220
+ ├── 1. Some file or folder
221
+ └── 2. Another file or folder
222
+ ```
223
+
224
+
225
+
205
226
  Customizing Theme
206
227
  --------------------------------------------------
207
228
 
@@ -265,7 +286,6 @@ For more information see:
265
286
 
266
287
  ---
267
288
 
268
- [screenshot]: https://raw.githubusercontent.com/DannyBen/madness/master/screenshot.png
269
289
  [dockerhub]: https://hub.docker.com/r/dannyben/madness/
270
290
  [dockerfile]: https://github.com/DannyBen/docker-madness
271
291
  [css]: app/public/css/main.css
@@ -125,6 +125,7 @@ code {
125
125
  content: "\00a0"; }
126
126
 
127
127
  pre {
128
+ margin-left: 20px;
128
129
  overflow: auto;
129
130
  line-height: 1.45;
130
131
  word-wrap: normal; }
@@ -137,26 +138,27 @@ pre {
137
138
  background: transparent;
138
139
  border: 0; }
139
140
  pre code {
140
- margin: 0;
141
- display: inline;
141
+ display: inline-block;
142
142
  max-width: initial;
143
- padding: 0;
144
143
  overflow: initial;
145
144
  line-height: inherit;
146
145
  word-wrap: normal;
147
- background-color: transparent;
148
146
  border: 0; }
149
147
  pre code:before,
150
148
  pre code:after {
151
149
  content: normal; }
152
150
 
153
- td.line-numbers {
154
- background: #eee; }
155
-
156
151
  table.CodeRay {
157
152
  margin-bottom: 0; }
158
153
  table.CodeRay pre {
159
154
  margin-bottom: 0; }
155
+ table.CodeRay tr, table.CodeRay td {
156
+ border: 0; }
157
+ table.CodeRay tr pre, table.CodeRay td pre {
158
+ margin-left: 0; }
159
+ table.CodeRay td.line-numbers {
160
+ background: #eee;
161
+ padding: 4px; }
160
162
 
161
163
  img {
162
164
  border-style: none;
@@ -198,7 +200,8 @@ kbd {
198
200
  box-shadow: inset 0 -1px 0 #bbb; }
199
201
 
200
202
  .search-form {
201
- margin-bottom: 20px; }
203
+ margin-bottom: 20px;
204
+ margin-top: 20px; }
202
205
 
203
206
  .search-field {
204
207
  outline: none;
@@ -206,14 +209,12 @@ kbd {
206
209
  font-size: 1.5em;
207
210
  width: 50%;
208
211
  min-width: 200px;
212
+ width: 100%;
209
213
  border: #ccc 1px solid;
210
214
  border-radius: 3px; }
211
215
  .search-field:focus {
212
216
  border-color: #4078c0; }
213
217
 
214
- .search-excerpt {
215
- white-space: pre-wrap; }
216
-
217
218
  .breadcrumbs {
218
219
  margin-top: 6px;
219
220
  border-bottom: 1px solid #ccc; }
@@ -227,16 +228,26 @@ nav {
227
228
  width: 250px;
228
229
  overflow-y: auto;
229
230
  position: fixed;
230
- padding: 10px 0;
231
231
  border-right: 1px solid #eee; }
232
232
  @media print {
233
233
  nav {
234
234
  display: none; } }
235
- nav a, nav span {
235
+ nav .icon-bar {
236
+ border-bottom: 1px dotted #ddd; }
237
+ nav a.document, nav span.document, nav .caption {
236
238
  border-bottom: 1px dotted #ddd;
237
239
  display: block;
238
240
  padding: 3px 20px 3px 30px; }
239
- nav a:hover, nav span:hover {
241
+ nav a.document:hover, nav span.document:hover, nav .caption:hover {
242
+ background: #e4e4e4; }
243
+ nav a.icon {
244
+ display: inline-block;
245
+ font-size: 1.5em;
246
+ width: 50%;
247
+ padding: 3px 20px 3px 30px; }
248
+ nav a.icon.wide {
249
+ width: 100%; }
250
+ nav a.icon:hover {
240
251
  background: #e4e4e4; }
241
252
  nav:after {
242
253
  content: "";
@@ -250,6 +261,31 @@ nav {
250
261
  background: #ddd;
251
262
  -webkit-border-radius: 3px; }
252
263
 
264
+ @font-face {
265
+ font-family: 'fontello';
266
+ src: url("../fonts/fontello.eot?14105917");
267
+ src: url("../fonts/fontello.eot?14105917#iefix") format("embedded-opentype"), url("../fonts/fontello.woff2?14105917") format("woff2"), url("../fonts/fontello.woff?14105917") format("woff"), url("../fonts/fontello.ttf?14105917") format("truetype"), url("../fonts/fontello.svg?14105917#fontello") format("svg");
268
+ font-weight: normal;
269
+ font-style: normal; }
270
+ [class^="icon-"]:before, [class*=" icon-"]:before {
271
+ font-family: "fontello";
272
+ font-style: normal;
273
+ font-weight: normal;
274
+ speak: none;
275
+ display: inline-block;
276
+ text-decoration: inherit;
277
+ width: 1em;
278
+ margin-right: .2em;
279
+ text-align: center;
280
+ font-variant: normal;
281
+ text-transform: none; }
282
+
283
+ .icon-search:before {
284
+ content: '\e800'; }
285
+
286
+ .icon-home:before {
287
+ content: '\e801'; }
288
+
253
289
  * {
254
290
  box-sizing: border-box; }
255
291
 
@@ -257,17 +293,17 @@ p {
257
293
  margin-top: 0;
258
294
  margin-bottom: 10px; }
259
295
 
260
- blockquote, .search-excerpt {
296
+ blockquote {
261
297
  margin: 0;
262
298
  padding: 0 15px;
263
299
  color: #777;
264
300
  border-left: 4px solid #ddd; }
265
- blockquote > :first-child, .search-excerpt > :first-child {
301
+ blockquote > :first-child {
266
302
  margin-top: 0; }
267
- blockquote > :last-child, .search-excerpt > :last-child {
303
+ blockquote > :last-child {
268
304
  margin-bottom: 0; }
269
305
 
270
- p, blockquote, .search-excerpt, ul, ol, dl, table, pre {
306
+ p, blockquote, ul, ol, dl, table, pre {
271
307
  margin-top: 0;
272
308
  margin-bottom: 16px; }
273
309
 
@@ -281,10 +317,6 @@ body {
281
317
  .main {
282
318
  padding: 0 20px 100px 20px;
283
319
  min-height: 100vh; }
284
- @media print {
285
- .main {
286
- margin-left: 0;
287
- border-width: 0; } }
288
320
  .main:before, .main:after {
289
321
  display: table;
290
322
  content: ""; }
@@ -292,6 +324,10 @@ body {
292
324
  margin-left: 250px;
293
325
  border: 1px solid #ccc;
294
326
  border-width: 0 1px; }
327
+ @media print {
328
+ .main.with-sidebar {
329
+ margin-left: 0;
330
+ border-width: 0; } }
295
331
  .main.without-sidebar {
296
332
  max-width: 980px;
297
333
  margin: 0 auto; }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "mappings": "AAAA,IAAK;EACH,oBAAoB,EAAE,IAAI;EAC1B,wBAAwB,EAAE,IAAI;EAC9B,KAAK,EAAE,IAAI;EACX,WAAW,EAAE,8HAA8H;EAC3I,SAAS,EAAE,IAAI;EACf,WAAW,EAAE,GAAG;EAChB,SAAS,EAAE,UAAU;;AAGvB,eAAgB;EACd,WAAW,EAAE,MAAM;;AAGrB,sBAAuB;EACrB,UAAU,EAAE,GAAG;EACf,aAAa,EAAE,IAAI;EACnB,WAAW,EAAE,IAAI;EACjB,WAAW,EAAE,GAAG;;AAGlB,EAAG;EACD,MAAM,EAAE,QAAQ;EAChB,cAAc,EAAE,KAAK;EACrB,SAAS,EAAE,MAAM;EACjB,WAAW,EAAE,GAAG;EAChB,aAAa,EAAE,cAAc;;AAG/B,EAAG;EACD,cAAc,EAAE,KAAK;EACrB,SAAS,EAAE,MAAM;EACjB,WAAW,EAAE,KAAK;EAClB,aAAa,EAAE,cAAc;;AAG/B,EAAG;EACD,SAAS,EAAE,KAAK;EAChB,WAAW,EAAE,IAAI;;AAGnB,EAAG;EACD,SAAS,EAAE,MAAM;;AAGnB,EAAG;EACD,SAAS,EAAE,GAAG;;AAGhB,EAAG;EACD,SAAS,EAAE,GAAG;EACd,KAAK,EAAE,IAAI;;AAGb,cAAe;EACb,WAAW,EAAE,oBAAoB;EACjC,SAAS,EAAE,GAAG;;AAGhB,cAAe;EACb,WAAW,EAAE,sDAAsD;;AC5DrE,KAAM;EACJ,cAAc,EAAE,CAAC;EACjB,eAAe,EAAE,QAAQ;EAEzB,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GAAG;;ACjC5B,CAAE;EACA,UAAU,EAAE,UAAU;;AAGxB,CAAE;EACA,UAAU,EAAE,CAAC;EACb,aAAa,EAAE,IAAI;;AAGrB,2BAAW;EACT,MAAM,EAAE,CAAC;EACT,OAAO,EAAE,MAAM;EACf,KAAK,EAAE,IAAI;EACX,WAAW,EAAE,cAAc;EAE3B,yDAAe;IACb,UAAU,EAAE,CAAC;EAGf,uDAAc;IACZ,aAAa,EAAE,CAAC;;AAIpB,sDAAsC;EACpC,UAAU,EAAE,CAAC;EACb,aAAa,EAAE,IAAI;;AAGrB,MAAO;EACL,KAAK,EAAE,IAAI;;AC5Bb,IAAK;EACH,SAAS,EAAE,MAAM;EACjB,MAAM,EAAE,MAAM;;AAGhB,KAAM;EAKJ,OAAO,EAAE,iBAAiB;EAC1B,UAAU,EAAE,KAAK;EALjB,YAAa;IADf,KAAM;MAEF,WAAW,EAAE,CAAC;MACd,YAAY,EAAE,CAAC;EAKjB,yBAAkB;IAChB,OAAO,EAAE,KAAK;IACd,OAAO,EAAE,EAAE;EAOb,kBAAe;IACb,WAAW,EAAE,KAAK;IAClB,MAAM,EAAC,cAAc;IACrB,YAAY,EAAE,KAAK;EAGrB,qBAAkB;IAChB,SAAS,EAAE,KAAK;IAChB,MAAM,EAAE,MAAM",
4
- "sources": ["../../styles/_typography.scss","../../styles/_table.scss","../../styles/_anchor.scss","../../styles/_list.scss","../../styles/_code.scss","../../styles/_coderay.scss","../../styles/_image.scss","../../styles/_line.scss","../../styles/_keyboard.scss","../../styles/_search.scss","../../styles/_breadcrumbs.scss","../../styles/_nav.scss","../../styles/_general.scss","../../styles/main.scss"],
3
+ "mappings": "AAAA,IAAK;EACH,oBAAoB,EAAE,IAAI;EAC1B,wBAAwB,EAAE,IAAI;EAC9B,KAAK,EAAE,IAAI;EACX,WAAW,EAAE,8HAA8H;EAC3I,SAAS,EAAE,IAAI;EACf,WAAW,EAAE,GAAG;EAChB,SAAS,EAAE,UAAU;;AAGvB,eAAgB;EAC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M;EACnB,KAAK,EAAE,IAAI;EAEX,OAAO,EAAE,YAAY;EACrB,eAAe,EAAE,OAAO;EACxB,KAAK,EAAE,GAAG;EACV,YAAY,EAAE,IAAI;EAClB,UAAU,EAAE,MAAM;EAElB,YAAY,EAAE,MAAM;EACpB,cAAc,EAAE,IAAI;;AAEtB,mBAAoB;EAAE,OAAO,EAAE,OAAO;;AACtC,iBAAkB;EAAE,OAAO,EAAE,OAAO;;AC7BpC,CAAE;EACA,UAAU,EAAE,UAAU;;AAGxB,CAAE;EACA,UAAU,EAAE,CAAC;EACb,aAAa,EAAE,IAAI;;AAGrB,UAAW;EACT,MAAM,EAAE,CAAC;EACT,OAAO,EAAE,MAAM;EACf,KAAK,EAAE,IAAI;EACX,WAAW,EAAE,cAAc;EAE3B,yBAAe;IACb,UAAU,EAAE,CAAC;EAGf,wBAAc;IACZ,aAAa,EAAE,CAAC;;AAIpB,qCAAsC;EACpC,UAAU,EAAE,CAAC;EACb,aAAa,EAAE,IAAI;;AAGrB,MAAO;EACL,KAAK,EAAE,IAAI;;AC5Bb,IAAK;EACH,SAAS,EAAE,MAAM;EACjB,MAAM,EAAE,MAAM;;AAGhB,KAAM;EACJ,OAAO,EAAE,iBAAiB;EAC1B,UAAU,EAAE,KAAK;EAEjB,yBAAkB;IAChB,OAAO,EAAE,KAAK;IACd,OAAO,EAAE,EAAE;EAOb,kBAAe;IACb,WAAW,EAAE,KAAK;IAClB,MAAM,EAAC,cAAc;IACrB,YAAY,EAAE,KAAK;IACnB,YAAa;MAJf,kBAAe;QAKX,WAAW,EAAE,CAAC;QACd,YAAY,EAAE,CAAC;EAKnB,qBAAkB;IAChB,SAAS,EAAE,KAAK;IAChB,MAAM,EAAE,MAAM",
4
+ "sources": ["../../styles/_typography.scss","../../styles/_table.scss","../../styles/_anchor.scss","../../styles/_list.scss","../../styles/_code.scss","../../styles/_coderay.scss","../../styles/_image.scss","../../styles/_line.scss","../../styles/_keyboard.scss","../../styles/_search.scss","../../styles/_breadcrumbs.scss","../../styles/_nav.scss","../../styles/_icons.scss","../../styles/_general.scss","../../styles/main.scss"],
5
5
  "names": [],
6
6
  "file": "main.css"
7
7
  }
Binary file
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg xmlns="http://www.w3.org/2000/svg">
4
+ <metadata>Copyright (C) 2018 by original authors @ fontello.com</metadata>
5
+ <defs>
6
+ <font id="fontello" horiz-adv-x="1000" >
7
+ <font-face font-family="fontello" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" />
8
+ <missing-glyph horiz-adv-x="1000" />
9
+ <glyph glyph-name="search" unicode="&#xe800;" d="M772 78q30-34 6-62l-46-46q-36-32-68 0l-190 190q-74-42-156-42-128 0-223 95t-95 223 90 219 218 91 224-95 96-223q0-88-46-162z m-678 358q0-88 68-156t156-68 151 63 63 153q0 88-68 155t-156 67-151-63-63-151z" horiz-adv-x="789" />
10
+
11
+ <glyph glyph-name="home" unicode="&#xe801;" d="M888 336q16-16 11-27t-27-11l-84 0 0-310q0-14-1-21t-8-13-23-6l-204 0 0 310-204 0 0-310-194 0q-28 0-35 10t-7 30l0 310-84 0q-22 0-27 11t11 27l400 402q16 16 38 16t38-16z" horiz-adv-x="900" />
12
+ </font>
13
+ </defs>
14
+ </svg>
Binary file
Binary file
Binary file
@@ -14,6 +14,7 @@ code {
14
14
  }
15
15
 
16
16
  pre {
17
+ margin-left: 20px;
17
18
  // margin-top: 0;
18
19
  // margin-bottom: 0;
19
20
 
@@ -36,15 +37,14 @@ pre {
36
37
  }
37
38
 
38
39
  code {
39
- margin: 0;
40
- display: inline;
40
+ display: inline-block;
41
41
  max-width: initial;
42
- padding: 0;
42
+ // padding: 10px;
43
43
  overflow: initial;
44
44
  line-height: inherit;
45
45
  word-wrap: normal;
46
- background-color: transparent;
47
46
  border: 0;
47
+ // background: #eee;
48
48
  }
49
49
 
50
50
  code:before,
@@ -1,10 +1,23 @@
1
- td.line-numbers {
2
- background: #eee;
3
- }
4
-
5
1
  table.CodeRay {
6
2
  margin-bottom: 0;
3
+
7
4
  pre {
8
5
  margin-bottom: 0;
9
6
  }
7
+
8
+ tr, td {
9
+ border: 0;
10
+ pre {
11
+ margin-left: 0;
12
+ }
13
+ }
14
+
15
+ td.line-numbers {
16
+ background: #eee;
17
+ padding: 4px;
18
+ }
19
+
20
+ td.code {
21
+ }
22
+
10
23
  }
@@ -30,4 +30,3 @@ p, blockquote, ul, ol, dl, table, pre {
30
30
  .quiet {
31
31
  color: #777;
32
32
  }
33
-
@@ -0,0 +1,30 @@
1
+ // Generated with http://fontello.com/ + Entypo font
2
+ @font-face {
3
+ font-family: 'fontello';
4
+ src: url('../fonts/fontello.eot?14105917');
5
+ src: url('../fonts/fontello.eot?14105917#iefix') format('embedded-opentype'),
6
+ url('../fonts/fontello.woff2?14105917') format('woff2'),
7
+ url('../fonts/fontello.woff?14105917') format('woff'),
8
+ url('../fonts/fontello.ttf?14105917') format('truetype'),
9
+ url('../fonts/fontello.svg?14105917#fontello') format('svg');
10
+ font-weight: normal;
11
+ font-style: normal;
12
+ }
13
+
14
+ [class^="icon-"]:before, [class*=" icon-"]:before {
15
+ font-family: "fontello";
16
+ font-style: normal;
17
+ font-weight: normal;
18
+ speak: none;
19
+
20
+ display: inline-block;
21
+ text-decoration: inherit;
22
+ width: 1em;
23
+ margin-right: .2em;
24
+ text-align: center;
25
+
26
+ font-variant: normal;
27
+ text-transform: none;
28
+ }
29
+ .icon-search:before { content: '\e800'; }
30
+ .icon-home:before { content: '\e801'; }
@@ -10,6 +10,7 @@
10
10
  @import "search";
11
11
  @import "breadcrumbs";
12
12
  @import "nav";
13
+ @import "icons";
13
14
 
14
15
  // Last
15
16
  @import "general";
data/app/styles/_nav.scss CHANGED
@@ -2,14 +2,18 @@ nav {
2
2
  @media print {
3
3
  display: none;
4
4
  }
5
+
6
+ .icon-bar {
7
+ border-bottom: 1px dotted #ddd;
8
+ }
9
+
5
10
  background: #eee;
6
11
  height: 100vh;
7
12
  width: 250px;
8
13
  overflow-y: auto;
9
14
  position: fixed;
10
- padding: 10px 0;
11
15
  border-right: 1px solid #eee;
12
- a, span {
16
+ a.document, span.document, .caption {
13
17
  border-bottom: 1px dotted #ddd;
14
18
  &:hover {
15
19
  background: #e4e4e4;
@@ -17,6 +21,21 @@ nav {
17
21
  display: block;
18
22
  padding: 3px 20px 3px 30px;
19
23
  }
24
+
25
+ a.icon {
26
+ display: inline-block;
27
+ font-size: 1.5em;
28
+ width: 50%;
29
+ padding: 3px 20px 3px 30px;
30
+ &.wide {
31
+ width: 100%
32
+ }
33
+ &:hover {
34
+ background: #e4e4e4;
35
+ }
36
+ }
37
+
38
+
20
39
  &:after {
21
40
  content: "";
22
41
  height: 90px;
@@ -1,5 +1,6 @@
1
1
  .search-form {
2
2
  margin-bottom: 20px;
3
+ margin-top: 20px;
3
4
  }
4
5
 
5
6
  .search-field {
@@ -8,6 +9,7 @@
8
9
  font-size: 1.5em;
9
10
  width: 50%;
10
11
  min-width: 200px;
12
+ width: 100%;
11
13
 
12
14
  border: #ccc 1px solid;
13
15
  border-radius: 3px;
@@ -16,9 +18,3 @@
16
18
  border-color: #4078c0;
17
19
  }
18
20
  }
19
-
20
- .search-excerpt {
21
- @extend blockquote;
22
- white-space: pre-wrap;
23
- }
24
-
data/app/styles/main.scss CHANGED
@@ -6,10 +6,6 @@ body {
6
6
  }
7
7
 
8
8
  .main {
9
- @media print {
10
- margin-left: 0;
11
- border-width: 0;
12
- }
13
9
  padding: 0 20px 100px 20px;
14
10
  min-height: 100vh;
15
11
 
@@ -26,6 +22,11 @@ body {
26
22
  margin-left: 250px;
27
23
  border:1px solid #ccc;
28
24
  border-width: 0 1px;
25
+ @media print {
26
+ margin-left: 0;
27
+ border-width: 0;
28
+ }
29
+
29
30
  }
30
31
 
31
32
  &.without-sidebar {
@@ -1,4 +1,4 @@
1
- ul
1
+ ol
2
2
  - nav.links.each do |item|
3
3
  li
4
4
  a href="#{item.href}" class=('strong' if item.type == :dir)
data/app/views/_nav.slim CHANGED
@@ -1,11 +1,15 @@
1
1
  nav
2
- a.strong href="/" accesskey='h' Home
3
- - if nav.with_search?
4
- a.strong href="/_search" accesskey='s' Search
2
+ .icon-bar
3
+ a.icon href="/" accesskey='h' class=('wide' unless nav.with_search?)
4
+ i.icon-home
5
+
6
+ - if nav.with_search?
7
+ a.icon href="/_search" accesskey='s' style='text-align:right'
8
+ i.icon-search
5
9
 
6
10
  - if nav.caption
7
- span.strong = "#{nav.caption}:"
11
+ .caption = "#{nav.caption}:"
8
12
 
9
13
  - nav.links.each do |item|
10
- a href="#{item.href}" class=('strong' if item.type == :dir)
14
+ a.document href="#{item.href}" class=('strong' if item.type == :dir)
11
15
  = item.label
@@ -2,7 +2,7 @@
2
2
 
3
3
  .main class=(config.sidebar ? 'with-sidebar' : 'without-sidebar')
4
4
  == slim :_breadcrumbs, locals: { breadcrumbs: breadcrumbs }
5
- == slim :_content, locals: { nav: nav, content: content}
5
+ == content
6
6
 
7
7
  - if type != :file and config.auto_nav
8
8
  - unless type == :empty
@@ -1,10 +1,8 @@
1
1
  == slim :_nav, locals: { nav: nav } if config.sidebar
2
2
 
3
3
  .main class=(config.sidebar ? 'with-sidebar' : 'without-sidebar')
4
- h1 Search
5
-
6
4
  form.search-form action="/_search" method="get"
7
- input.search-field type="text" name="q" value="#{params[:q]}" placeholder="Enter search query" autofocus=true
5
+ input.search-field type="text" name="q" value="#{params[:q]}" placeholder="Search" autofocus=true
8
6
  input type="submit" value="Search" style='display:none'
9
7
 
10
8
  hr
@@ -16,10 +14,11 @@
16
14
  = ". "
17
15
  a href="#{result[:file]}" = result[:label]
18
16
 
19
- - if result[:highlights]
20
- - result[:highlights].each do |highlight|
21
- pre.search-excerpt == highlight
22
- - else
23
- p.quiet No excerpt
17
+ ul
18
+ - if result[:highlights]
19
+ - result[:highlights].each do |highlight|
20
+ li.search-excerpt == highlight
21
+ - else
22
+ li.search-excerpt.quiet No excerpt
24
23
 
25
24
 
data/lib/madness.rb CHANGED
@@ -13,10 +13,12 @@ require 'sass/plugin/rack'
13
13
  require 'sinatra/base'
14
14
  require 'sinatra/reloader'
15
15
  require 'slim'
16
+ require 'naturally'
16
17
 
17
18
  require 'byebug' if ENV['BYEBUG']
18
19
 
19
20
  require 'madness/refinements/string_refinements'
21
+ require 'madness/refinements/array_refinements'
20
22
 
21
23
  require 'madness/server_helper'
22
24
 
@@ -3,6 +3,8 @@ module Madness
3
3
  # Handle breadcumbs generation by converting a path to an array
4
4
  # of links
5
5
  class Breadcrumbs
6
+ using StringRefinements
7
+
6
8
  attr_reader :path
7
9
 
8
10
  def initialize(path)
@@ -25,7 +27,7 @@ module Madness
25
27
  def breadcrumbs_maker(partial_path)
26
28
  parent, basename = File.split partial_path
27
29
  item = OpenStruct.new({
28
- label: basename.tr('-', ' '),
30
+ label: basename.to_label,
29
31
  href: "/#{partial_path}" }
30
32
  )
31
33
  result = [item]
@@ -2,6 +2,7 @@ module Madness
2
2
  # Represents a directory with markdown file sand subflders.
3
3
  class Directory
4
4
  include ServerHelper
5
+ using ArrayRefinements
5
6
 
6
7
  attr_reader :dir
7
8
 
@@ -21,7 +22,7 @@ module Madness
21
22
  basename = File.basename(f)
22
23
  basename == 'README.md' or basename == 'index.md'
23
24
  end
24
- result.sort.map { |path| Item.new path, :file }
25
+ result.nat_sort.map { |path| Item.new path, :file }
25
26
  end
26
27
 
27
28
  def dirs
@@ -30,7 +31,7 @@ module Madness
30
31
  basename = File.basename(f)
31
32
  basename =~ /^[a-z_\-0-9]+$/
32
33
  end
33
- result.sort.map { |path| Item.new path, :dir }
34
+ result.nat_sort.map { |path| Item.new path, :dir }
34
35
  end
35
36
  end
36
37
  end
@@ -31,6 +31,12 @@ module Madness
31
31
  @dir
32
32
  end
33
33
 
34
+ # Return the path to the document directory
35
+ def title
36
+ set_base_attributes unless @title
37
+ @title
38
+ end
39
+
34
40
  # Return the HTML for that document
35
41
  def content
36
42
  @content ||= content!
@@ -38,17 +44,7 @@ module Madness
38
44
 
39
45
  # Return the HTML for that document, force re-read.
40
46
  def content!
41
- type == :empty ? '' : markdown_to_html
42
- end
43
-
44
- # Return a reasonable HTML title for the file or directory
45
- def title
46
- if type == :readme
47
- result = File.basename File.dirname(file)
48
- else
49
- result = File.basename(file,'.md')
50
- end
51
- result.tr '-', ' '
47
+ type == :empty ? "<h1>#{title}</h1>" : markdown_to_html
52
48
  end
53
49
 
54
50
  private
@@ -62,10 +58,13 @@ module Madness
62
58
  @dir = docroot
63
59
  @type = :empty
64
60
  @file = ''
61
+ @title = 'Index'
65
62
 
66
63
  if File.directory? base
64
+ @title = File.basename(path).to_label unless path.empty?
67
65
  set_base_attributes_for_directory
68
66
  elsif File.exist? "#{base}.md"
67
+ @title = File.basename(base).to_label
69
68
  @file = "#{base}.md"
70
69
  @dir = File.dirname file
71
70
  @type = :file
data/lib/madness/item.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  module Madness
2
2
  class Item
3
3
  include ServerHelper
4
+ using StringRefinements
4
5
 
5
6
  attr_reader :path, :type
6
7
 
@@ -9,7 +10,7 @@ module Madness
9
10
  end
10
11
 
11
12
  def label
12
- @label ||= File.basename(path_without_extension)
13
+ @label ||= label!
13
14
  end
14
15
 
15
16
  def href
@@ -26,6 +27,10 @@ module Madness
26
27
 
27
28
  private
28
29
 
30
+ def label!
31
+ File.basename(path_without_extension).to_label
32
+ end
33
+
29
34
  def path_without_extension
30
35
  @path_without_extension ||= path.sub(/\.md$/, '')
31
36
  end
@@ -2,6 +2,7 @@ module Madness
2
2
  # Handle the navigation links for a given directory
3
3
  class Navigation
4
4
  include ServerHelper
5
+ using StringRefinements
5
6
 
6
7
  attr_reader :dir
7
8
 
@@ -14,7 +15,7 @@ module Madness
14
15
  end
15
16
 
16
17
  def caption
17
- @caption ||= (dir == docroot ? "Index" : File.basename(dir))
18
+ @caption ||= (dir == docroot ? "Index" : File.basename(dir).to_label)
18
19
  end
19
20
 
20
21
  def with_search?
@@ -0,0 +1,9 @@
1
+ module Madness
2
+ module ArrayRefinements
3
+ refine Array do
4
+ def nat_sort
5
+ Naturally.sort self
6
+ end
7
+ end
8
+ end
9
+ end
@@ -4,6 +4,16 @@ module Madness
4
4
  def to_slug
5
5
  downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '')
6
6
  end
7
+
8
+ # This is here so we can have one place that defines how to convert
9
+ # a string (usually a filename without .md extension, or a folder name)
10
+ # to a label.
11
+ # It is used by different navigation elements in madness, and ucrrently
12
+ # just removes any numbers followed by a dot at the beginning of the
13
+ # string, in order to allow "The Invisible Sorting Hand".
14
+ def to_label
15
+ gsub(/^\d+\.\s+/, '')
16
+ end
7
17
  end
8
18
  end
9
19
  end
@@ -4,6 +4,7 @@ module Madness
4
4
  include ServerHelper
5
5
  include Ferret
6
6
  include Ferret::Index
7
+ using StringRefinements
7
8
 
8
9
  def initialize(path=nil)
9
10
  @path = path || docroot
@@ -19,7 +20,7 @@ module Madness
19
20
  index = Index.new path: index_dir, create: true
20
21
 
21
22
  Dir["#{@path}/**/*.md"].each do |file|
22
- index << { file: file, content: File.read(file) }
23
+ index << { file: file, content: searchable_content(file) }
23
24
  end
24
25
 
25
26
  index.optimize()
@@ -33,15 +34,13 @@ module Madness
33
34
  index.search_each(query, limit: 20) do |doc_id, score|
34
35
  filename = index[doc_id][:file].sub("#{@path}/", '')[0...-3]
35
36
  highlights = index.highlight "content:(#{query.tr(' ',' OR ')}) ", doc_id, field: :content,
36
- pre_tag: "", post_tag: "",
37
+ pre_tag: "<strong>", post_tag: "</strong>",
37
38
  excerpt_length: 100
38
39
 
39
- highlights.map! { |excerpt| CGI.escapeHTML excerpt } if highlights
40
-
41
40
  results << {
42
41
  score: score,
43
42
  file: filename,
44
- label: filename.gsub("/", " / "),
43
+ label: file_label(filename),
45
44
  highlights: highlights
46
45
  }
47
46
  end
@@ -57,7 +56,21 @@ module Madness
57
56
 
58
57
  def index_dir
59
58
  "#{@path}/_index"
60
- end
59
+ end
60
+
61
+ private
61
62
 
63
+ # This is poor-mans markdown strip.
64
+ # Convert to HTML, strip tags and return plain text suitable to act as
65
+ # the content for the search index.
66
+ def searchable_content(file)
67
+ content = File.read file
68
+ content = CommonMarker.render_html content
69
+ content.gsub(/<\/?[^>]*>/, "").gsub("\n", " ")
70
+ end
71
+
72
+ def file_label(filename)
73
+ filename.split('/').map { |i| i.to_label }.join(' / ')
74
+ end
62
75
  end
63
76
  end
@@ -1,3 +1,3 @@
1
1
  module Madness
2
- VERSION = "0.5.7"
2
+ VERSION = "0.6.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: madness
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.7
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danny Ben Shitrit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-30 00:00:00.000000000 Z
11
+ date: 2018-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sass
@@ -178,6 +178,20 @@ dependencies:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
180
  version: '2.1'
181
+ - !ruby/object:Gem::Dependency
182
+ name: naturally
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - "~>"
186
+ - !ruby/object:Gem::Version
187
+ version: '2.1'
188
+ type: :runtime
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: '2.1'
181
195
  - !ruby/object:Gem::Dependency
182
196
  name: byebug
183
197
  requirement: !ruby/object:Gem::Requirement
@@ -343,11 +357,17 @@ files:
343
357
  - app/public/css/main.css
344
358
  - app/public/css/main.css.map
345
359
  - app/public/favicon.ico
360
+ - app/public/fonts/fontello.eot
361
+ - app/public/fonts/fontello.svg
362
+ - app/public/fonts/fontello.ttf
363
+ - app/public/fonts/fontello.woff
364
+ - app/public/fonts/fontello.woff2
346
365
  - app/styles/_anchor.scss
347
366
  - app/styles/_breadcrumbs.scss
348
367
  - app/styles/_code.scss
349
368
  - app/styles/_coderay.scss
350
369
  - app/styles/_general.scss
370
+ - app/styles/_icons.scss
351
371
  - app/styles/_image.scss
352
372
  - app/styles/_keyboard.scss
353
373
  - app/styles/_line.scss
@@ -359,7 +379,6 @@ files:
359
379
  - app/styles/_typography.scss
360
380
  - app/styles/main.scss
361
381
  - app/views/_breadcrumbs.slim
362
- - app/views/_content.slim
363
382
  - app/views/_index_nav.slim
364
383
  - app/views/_nav.slim
365
384
  - app/views/document.slim
@@ -374,6 +393,7 @@ files:
374
393
  - lib/madness/document.rb
375
394
  - lib/madness/item.rb
376
395
  - lib/madness/navigation.rb
396
+ - lib/madness/refinements/array_refinements.rb
377
397
  - lib/madness/refinements/string_refinements.rb
378
398
  - lib/madness/search.rb
379
399
  - lib/madness/server.rb
@@ -1,6 +0,0 @@
1
- - if content.empty?
2
- h1 = nav.caption || "Index"
3
-
4
- - else
5
- == content
6
-