madness 0.9.0 → 0.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +77 -8
- data/app/public/css/main.css +1 -1
- data/app/public/css/main.css.map +2 -2
- data/app/styles/_anchor.scss +1 -1
- data/app/views/search.slim +1 -1
- data/lib/madness/directory.rb +16 -5
- data/lib/madness/search.rb +15 -6
- data/lib/madness/settings.rb +18 -5
- data/lib/madness/templates/madness.yml +53 -14
- data/lib/madness/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9954342312c1b0fcceffa8753071f6da48f619b7c25b5a007d5c62f50188e88d
|
4
|
+
data.tar.gz: 8687f6f8a42ee63e3c25c14193c82e5ec7de611dd066f326814218c7ae16b498
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3cdad49579a55393e76fd8e4ffc7ddd8eb68621a4a0d07e5876d4b5ce396e274dd5b7f3d02b631ac1287b474c81250de92882a291fa404d617cd37a4ec880c1c
|
7
|
+
data.tar.gz: 56e641741fcba7b549337cfd9659548b930ab25291a3fa363f8f084429fb0ba3a8127f288f76412276807debb3cdc7562ca5c6c172a5a2151b27265b72b66323
|
data/README.md
CHANGED
@@ -29,7 +29,8 @@
|
|
29
29
|
* [Table of Contents Generation](#table-of-contents-generation)
|
30
30
|
* [Hidden Directories](#hidden-directories)
|
31
31
|
* [Controlling Sort Order](#controlling-sort-order)
|
32
|
-
* [
|
32
|
+
* [Displaying Additional File Types](#displaying-additional-file-types)
|
33
|
+
* [Basic Authentication](#basic-authentication)
|
33
34
|
* [Customizing Theme](#customizing-theme)
|
34
35
|
* [Forcing HTTPS Connection](#forcing-https-connection)
|
35
36
|
* [Docker Image](#docker-image)
|
@@ -62,6 +63,7 @@ searching for local, markdown based documentation directories.
|
|
62
63
|
- Fully customizable theme.
|
63
64
|
- Automatic generation of navigation sidebar.
|
64
65
|
- Automatic generation of Table of Contents (site-wide and inline).
|
66
|
+
- Can optionally show additional file types in the navigation menu (e.g. PDF files).
|
65
67
|
|
66
68
|
## Usage
|
67
69
|
|
@@ -115,21 +117,62 @@ documentation directory, and modify any of the settings below.
|
|
115
117
|
|
116
118
|
```yaml
|
117
119
|
# .madness.yml
|
118
|
-
|
119
|
-
|
120
|
-
|
120
|
+
|
121
|
+
# path to the documentation root
|
122
|
+
path: .
|
123
|
+
|
124
|
+
# server port
|
125
|
+
port: 3000
|
126
|
+
|
127
|
+
# server listen address
|
128
|
+
bind: 0.0.0.0
|
129
|
+
|
130
|
+
# enable sidebar
|
121
131
|
sidebar: true
|
132
|
+
|
133
|
+
# add H1 title to files that do not have one
|
122
134
|
auto_h1: true
|
135
|
+
|
136
|
+
# append navigation to directory READMEs
|
123
137
|
auto_nav: true
|
138
|
+
|
139
|
+
# enable syntax highlighter for code snippets
|
124
140
|
highlighter: true
|
141
|
+
|
142
|
+
# enable line numbers for code snippets
|
125
143
|
line_numbers: true
|
144
|
+
|
145
|
+
# enable the copy to clipboard icon for code snippets
|
126
146
|
copy_code: true
|
127
|
-
|
128
|
-
|
147
|
+
|
148
|
+
# generate a table of contents file with this name, for example:
|
149
|
+
# toc: Table of Contents
|
150
|
+
toc: ~
|
151
|
+
|
152
|
+
# path to theme folder, for example:
|
153
|
+
# theme: _theme
|
154
|
+
theme: ~
|
155
|
+
|
156
|
+
# open the server URL in the browser
|
129
157
|
open: false
|
158
|
+
|
159
|
+
# provide user:password for basic authentication, for example:
|
160
|
+
# auth: admin:s3cr3t
|
161
|
+
auth: false
|
162
|
+
|
163
|
+
# if auth is enabled, specify auth realm name
|
164
|
+
auth_zone: Madness
|
165
|
+
|
166
|
+
# show files with these extensions in the navigation and search, for example:
|
167
|
+
# expose_extensions: pdf,docx,xlsx,txt
|
168
|
+
expose_extensions: ~
|
169
|
+
|
170
|
+
# exclude directories that match these regular expressions
|
171
|
+
# note that this is an array
|
172
|
+
exclude: ['^[a-z_\-0-9]+$']
|
130
173
|
```
|
131
174
|
|
132
|
-
For convenience, you can
|
175
|
+
For convenience, you can generate a template config file by running:
|
133
176
|
|
134
177
|
```shell
|
135
178
|
$ madness create config
|
@@ -188,10 +231,23 @@ numbers (`/^[a-z_\-0-9]+$/`) will not be displayed in the navigation. In
|
|
188
231
|
other words, directories must have at least one uppercase letter or a space
|
189
232
|
to be recognized as a documentation directory.
|
190
233
|
|
234
|
+
This can be configured by using the `exclude` configuration option:
|
235
|
+
|
236
|
+
```yaml
|
237
|
+
# do not ignore any directory
|
238
|
+
exclude: ~
|
239
|
+
|
240
|
+
# ignore only specific directories
|
241
|
+
exclude: [assets, public]
|
242
|
+
|
243
|
+
# ignore using regular expressions
|
244
|
+
exclude: ['^public$', 'assets']
|
245
|
+
```
|
246
|
+
|
191
247
|
## Controlling Sort Order
|
192
248
|
|
193
249
|
To control the sort order of the automatically generated navigation elements,
|
194
|
-
simply
|
250
|
+
simply prefix your files and directories with digits followed by a dot and a
|
195
251
|
space, just like you would create an ordered list in Markdown. The numbers
|
196
252
|
will be omitted when they are displayed.
|
197
253
|
|
@@ -201,6 +257,19 @@ will be omitted when they are displayed.
|
|
201
257
|
└── 2. Another file or folder
|
202
258
|
```
|
203
259
|
|
260
|
+
## Displaying Additional File Types
|
261
|
+
|
262
|
+
If you wish the navigation and search features to also show other documents
|
263
|
+
and files (for example, PDF files), you may configure the `expose_extensions`
|
264
|
+
option in the configuration file to contain a comma delimited list of
|
265
|
+
extensions:
|
266
|
+
|
267
|
+
```yaml
|
268
|
+
expose_extensions: pdf,docx,xlsx,txt
|
269
|
+
```
|
270
|
+
|
271
|
+
The default value of this option is `null` (or `~`, which is `null` in YAML).
|
272
|
+
|
204
273
|
## Basic Authentication
|
205
274
|
|
206
275
|
To add basic authentication, use the `--auth user:password` command line argument or the equivalent `auth` configuration option.
|
data/app/public/css/main.css
CHANGED
data/app/public/css/main.css.map
CHANGED
@@ -26,7 +26,7 @@
|
|
26
26
|
"// Mixins\n$breakpoint: 768px;\n\n@mixin mobile {\n\t@media only screen and (max-width: $breakpoint - 1) {\n\t\t@content;\n\t}\n}\n\n@mixin desktop {\n\t@media only screen and (min-width: $breakpoint) {\n\t\t@content;\n\t}\n}\n",
|
27
27
|
"body {\n -ms-text-size-adjust: 100%;\n -webkit-text-size-adjust: 100%;\n color: #333;\n // font-family: \"Helvetica Neue\", Helvetica, \"Segoe UI\", Arial, freesans, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";\n font-family: \"Segoe UI\", \"Helvetica Neue\", Helvetica,Arial, freesans, sans-serif;\n font-size: 16px;\n line-height: 1.6;\n word-wrap: break-word;\n}\n\nstrong, .strong {\n font-weight: bolder;\n}\n\nh1, h2, h3, h4, h5, h6 {\n margin-top: 1em;\n margin-bottom: 16px;\n font-weight: bold;\n line-height: 1.4;\n}\n\nh1 {\n margin: 0.67em 0;\n padding-bottom: 0.3em;\n font-size: 2.25em;\n line-height: 1.2;\n border-bottom: 1px solid #eee;\n}\n\nh2 {\n padding-bottom: 0.3em;\n font-size: 1.75em;\n line-height: 1.225;\n border-bottom: 1px solid #eee;\n}\n\nh3 {\n font-size: 1.5em;\n line-height: 1.43;\n}\n\nh4 {\n font-size: 1.25em;\n}\n\nh5 {\n font-size: 1em;\n}\n\nh6 {\n font-size: 1em;\n color: #777;\n}\n\ncode, pre, kbd {\n font-family: Consolas, \"Liberation Mono\", Menlo, Courier, monospace;\n font-size: 1em;\n}\n",
|
28
28
|
"table {\n border-spacing: 0;\n border-collapse: collapse;\n\n display: block;\n width: 100%;\n overflow: auto;\n word-break: normal;\n word-break: keep-all;\n \n th {\n font-weight: bold;\n }\n\n th, td {\n padding: 6px 13px;\n border: 1px solid #ddd;\n }\n\n tr {\n background-color: #fff;\n border-top: 1px solid #ccc;\n }\n\n tr:nth-child(2n) {\n background-color: #f8f8f8;\n }\n}\n",
|
29
|
-
"a {\n -webkit-text-decoration-skip: objects;\n\n color: #4078c0;\n text-decoration: none;\n\n &:active, &:hover {\n outline-width: 0;\n text-decoration: underline;\n }\n\n &:not([href]) {\n color: inherit;\n text-decoration: none;\n }\n}",
|
29
|
+
"a {\n -webkit-text-decoration-skip: objects;\n\n color: #4078c0;\n text-decoration: none;\n\n &:active, &:hover, &:focus {\n outline-width: 0;\n text-decoration: underline;\n }\n\n &:not([href]) {\n color: inherit;\n text-decoration: none;\n }\n}",
|
30
30
|
"ul, ol {\n margin-top: 0;\n margin-bottom: 0;\n\n padding-left: 2em;\n}\n\nol ol, ul ol {\n list-style-type: lower-roman;\n}\n\nul ul ol, ul ol ol, ol ul ol, ol ol ol {\n list-style-type: lower-alpha;\n}\n\nul ul, ul ol, ol ol, ol ul {\n margin-top: 0;\n margin-bottom: 0;\n}\n\ndd {\n margin-left: 0;\n}\n\ndl {\n padding: 0;\n\n dt {\n padding: 0;\n margin-top: 16px;\n font-size: 1em;\n font-style: italic;\n font-weight: bold;\n }\n\n dd {\n padding: 0 16px;\n margin-bottom: 16px;\n }\n}\n\nli>p {\n margin-top: 16px;\n}\n",
|
31
31
|
"code {\n padding: 0;\n padding-top: 0.2em;\n padding-bottom: 0.2em;\n margin: 0;\n // font-size: 85%;\n background-color: #eee;\n border-radius: 3px;\n \n &:before, &:after {\n letter-spacing: -0.2em;\n content: \"\\00a0\";\n }\n}\n\npre {\n margin-left: 20px;\n // margin-top: 0;\n // margin-bottom: 0;\n\n // padding: 16px;\n overflow: auto;\n // font-size: 85%;\n line-height: 1.45;\n // background-color: #f7f7f7;\n // border-radius: 3px;\n word-wrap: normal;\n\n &>code {\n padding: 0;\n margin: 0;\n font-size: 100%;\n word-break: normal;\n white-space: pre;\n background: transparent;\n border: 0;\n }\n\n code {\n display: inline-block;\n max-width: initial;\n // padding: 10px;\n overflow: initial;\n line-height: inherit;\n word-wrap: normal;\n border: 0;\n // background: #eee;\n }\n\n code:before,\n code:after {\n content: normal;\n }\n}\n",
|
32
32
|
".clipboard-button {\n position: absolute;\n right: 0;\n font-size: 1.25em;\n opacity: 0.2;\n transition: opacity 0.3s;\n}\n\ntable.CodeRay:hover .clipboard-button {\n opacity: 1;\n transition: opacity 0.3s;\n}\n\ntable.CodeRay {\n position: relative;\n margin-bottom: 0;\n \n pre {\n margin-bottom: 0;\n }\n \n tr, td {\n border: 0;\n pre {\n margin-left: 0;\n }\n }\n\n td.line-numbers {\n background: #eee;\n padding: 4px; \n }\n\n td.code {\n }\n\n}\n",
|
@@ -40,5 +40,5 @@
|
|
40
40
|
"* {\n box-sizing: border-box;\n}\n\np {\n margin-top: 0;\n margin-bottom: 10px;\n}\n\nblockquote {\n margin: 0;\n padding: 0 15px;\n color: #777;\n border-left: 4px solid #ddd;\n\n &>:first-child {\n margin-top: 0;\n }\n\n &>:last-child {\n margin-bottom: 0;\n }\n}\n\np, blockquote, ul, ol, dl, table, pre {\n margin-top: 0;\n margin-bottom: 16px;\n}\n\n.quiet {\n color: #777;\n}\n"
|
41
41
|
],
|
42
42
|
"names": [],
|
43
|
-
"mappings": "AGAA,AAAA,IAAI,CAAC;EACH,oBAAoB,EAAE,IAAI;EAC1B,wBAAwB,EAAE,IAAI;EAC9B,KAAK,EAAE,IAAI;EAEX,WAAW,EAAE,mEAAmE;EAChF,SAAS,EAAE,IAAI;EACf,WAAW,EAAE,GAAG;EAChB,SAAS,EAAE,UAAU,GACtB;;AAED,AAAA,MAAM,EAAE,OAAO,CAAC;EACd,WAAW,EAAE,MAAM,GACpB;;AAED,AAAA,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;EACrB,UAAU,EAAE,GAAG;EACf,aAAa,EAAE,IAAI;EACnB,WAAW,EAAE,IAAI;EACjB,WAAW,EAAE,GAAG,GACjB;;AAED,AAAA,EAAE,CAAC;EACD,MAAM,EAAE,QA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aAAa,EAAE,IAAI,GACpB;;AAED,AAAA,UAAU,CAAC;EACT,MAAM,EAAE,CAAC;EACT,OAAO,EAAE,MAAM;EACf,KAAK,EAAE,IAAI;EACX,WAAW,EAAE,cAAc,GAS5B;EAbD,AAME,UANQ,IAML,WAAW,CAAC;IACb,UAAU,EAAE,CAAC,GACd;EARH,AAUE,UAVQ,IAUL,UAAU,CAAC;IACZ,aAAa,EAAE,CAAC,GACjB;;AAGH,AAAA,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC;EACpC,UAAU,EAAE,CAAC;EACb,aAAa,EAAE,IAAI,GACpB;;AAED,AAAA,MAAM,CAAC;EACL,KAAK,EAAE,IAAI,GACZ;;AhB7BD,AAAA,IAAI,CAAC;EACH,SAAS,EAAE,MAAM;EACjB,MAAM,EAAE,MAAM,GACf;;AAED,AAAA,KAAK,CAAC;EACJ,OAAO,EAAE,iBAAiB,GAsB3B;EAvBD,AAGE,KAHG,CAGD,MAAM,EAHV,KAAK,CAGS,KAAK,CAAC;IAChB,OAAO,EAAE,KAAK;IACd,OAAO,EAAE,EAAE,GACZ;EEHF,MAAM,mCFUH;IAbJ,AAaI,KAbC,AAaA,aAAa,CAAC;MACb,UAAU,EAAE,KAAK;MACjB,WAAW,EAAE,KAAK,GACnB,EAAA;EAhBL,AAmBE,KAnBG,AAmBF,gBAAgB,CAAC;IAChB,SAAS,EAAE,KAAK;IAChB,MAAM,EAAE,MAAM,GACf"
|
44
44
|
}
|
data/app/styles/_anchor.scss
CHANGED
data/app/views/search.slim
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
.main class=(config.sidebar ? 'with-sidebar' : 'without-sidebar')
|
4
4
|
form.search-form action="/_search" method="get"
|
5
|
-
input.search-field type="text" name="q" value="#{params[:q]}" placeholder="Search" autofocus=true
|
5
|
+
input.search-field type="text" name="q" value="#{params[:q]}" placeholder="Search (use quotes for exact match)" autofocus=true
|
6
6
|
input type="submit" value="Search" style='display:none'
|
7
7
|
|
8
8
|
hr
|
data/lib/madness/directory.rb
CHANGED
@@ -17,7 +17,7 @@ module Madness
|
|
17
17
|
private
|
18
18
|
|
19
19
|
def files
|
20
|
-
result = Dir["#{dir}
|
20
|
+
result = Dir["#{dir}/#{config.dir_glob}"]
|
21
21
|
result.reject! do |f|
|
22
22
|
basename = File.basename(f)
|
23
23
|
basename == 'README.md' or basename == 'index.md'
|
@@ -27,11 +27,22 @@ module Madness
|
|
27
27
|
|
28
28
|
def dirs
|
29
29
|
result = Dir["#{dir}/*"].select { |f| File.directory? f }
|
30
|
-
result.reject!
|
31
|
-
basename = File.basename(f)
|
32
|
-
basename =~ /^[a-z_\-0-9]+$/
|
33
|
-
end
|
30
|
+
result.reject! { |f| exclude? f }
|
34
31
|
result.nat_sort.map { |path| Item.new path, :dir }
|
35
32
|
end
|
33
|
+
|
34
|
+
def exclude?(path)
|
35
|
+
return false unless config.exclude.is_a? Array
|
36
|
+
basename = File.basename path
|
37
|
+
config.exclude.each do |pattern|
|
38
|
+
return true if basename =~ Regexp.new(pattern)
|
39
|
+
end
|
40
|
+
false
|
41
|
+
end
|
42
|
+
|
43
|
+
def config
|
44
|
+
@config ||= Settings.instance
|
45
|
+
end
|
46
|
+
|
36
47
|
end
|
37
48
|
end
|
data/lib/madness/search.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'shellwords'
|
2
|
+
|
1
3
|
module Madness
|
2
4
|
class Search
|
3
5
|
include ServerHelper
|
@@ -13,14 +15,19 @@ module Madness
|
|
13
15
|
|
14
16
|
def search(query)
|
15
17
|
query = query.downcase
|
18
|
+
words = Shellwords.split query
|
19
|
+
word_count = words.count
|
16
20
|
result = {}
|
21
|
+
return result if words.empty?
|
17
22
|
|
18
23
|
index.each do |file, content|
|
19
|
-
file = file.remove("#{@path}/")
|
24
|
+
file = file.remove("#{@path}/").sub(/.md$/, '')
|
20
25
|
url = file_url file
|
21
26
|
label = file_label file
|
22
|
-
|
23
|
-
|
27
|
+
found = 0
|
28
|
+
words.each { |word| found += 1 if content.include? word }
|
29
|
+
next unless found == word_count
|
30
|
+
result[label] = url
|
24
31
|
end
|
25
32
|
|
26
33
|
result
|
@@ -30,10 +37,12 @@ module Madness
|
|
30
37
|
|
31
38
|
def index!
|
32
39
|
results = {}
|
33
|
-
|
40
|
+
|
41
|
+
Dir["#{@path}/**/#{config.dir_glob}"].sort.each do |file|
|
34
42
|
next if skip_index? file
|
35
|
-
filename = file_url(file.sub("#{@path}/", '')
|
36
|
-
|
43
|
+
filename = file_url(file.sub("#{@path}/", '')).downcase
|
44
|
+
index_content = File.extname(file) == '.md'
|
45
|
+
content = index_content ? File.read(file).downcase : ''
|
37
46
|
results[file] = "#{filename} #{content}"
|
38
47
|
end
|
39
48
|
results
|
data/lib/madness/settings.rb
CHANGED
@@ -40,23 +40,30 @@ module Madness
|
|
40
40
|
'.madness.yml'
|
41
41
|
end
|
42
42
|
|
43
|
+
def dir_glob
|
44
|
+
data[:expose_extensions] ? "*.{md,#{data[:expose_extensions].delete(' ')}}" : "*.md"
|
45
|
+
end
|
46
|
+
|
43
47
|
private
|
44
48
|
|
45
49
|
def defaults
|
46
50
|
{
|
51
|
+
path: '.',
|
47
52
|
port: 3000,
|
48
53
|
bind: '0.0.0.0',
|
49
|
-
|
54
|
+
sidebar: true,
|
50
55
|
auto_h1: true,
|
56
|
+
auto_nav: true,
|
51
57
|
highlighter: true,
|
52
58
|
line_numbers: true,
|
53
59
|
copy_code: true,
|
60
|
+
toc: nil,
|
54
61
|
theme: nil,
|
55
62
|
open: false,
|
56
|
-
auto_nav: true,
|
57
|
-
sidebar: true,
|
58
63
|
auth: false,
|
59
|
-
auth_realm: 'Madness'
|
64
|
+
auth_realm: 'Madness',
|
65
|
+
expose_extensions: nil,
|
66
|
+
exclude: [/^[a-z_\-0-9]+$/]
|
60
67
|
}
|
61
68
|
end
|
62
69
|
|
@@ -65,7 +72,13 @@ module Madness
|
|
65
72
|
end
|
66
73
|
|
67
74
|
def file_data
|
68
|
-
|
75
|
+
result = if file_exist?
|
76
|
+
ExtendedYAML.load(filename)&.symbolize_keys
|
77
|
+
else
|
78
|
+
{}
|
79
|
+
end
|
80
|
+
|
81
|
+
result || {}
|
69
82
|
end
|
70
83
|
|
71
84
|
end
|
@@ -1,17 +1,56 @@
|
|
1
1
|
# Madness configuration file
|
2
|
-
#
|
3
|
-
|
4
|
-
|
5
|
-
#
|
6
|
-
|
7
|
-
|
8
|
-
#
|
9
|
-
|
10
|
-
|
11
|
-
#
|
12
|
-
|
2
|
+
# These are the default configuration values
|
3
|
+
# You can delete any option you do not need
|
4
|
+
|
5
|
+
# path to the documentation root
|
6
|
+
path: .
|
7
|
+
|
8
|
+
# server port
|
9
|
+
port: 3000
|
10
|
+
|
11
|
+
# server listen address
|
12
|
+
bind: 0.0.0.0
|
13
|
+
|
14
|
+
# enable sidebar
|
15
|
+
sidebar: true
|
16
|
+
|
17
|
+
# add H1 title to files that do not have one
|
18
|
+
auto_h1: true
|
19
|
+
|
20
|
+
# append navigation to directory READMEs
|
21
|
+
auto_nav: true
|
22
|
+
|
23
|
+
# enable syntax highlighter for code snippets
|
24
|
+
highlighter: true
|
25
|
+
|
26
|
+
# enable line numbers for code snippets
|
27
|
+
line_numbers: true
|
28
|
+
|
29
|
+
# enable the copy to clipboard icon for code snippets
|
30
|
+
copy_code: true
|
31
|
+
|
32
|
+
# generate a table of contents file with this name, for example:
|
13
33
|
# toc: Table of Contents
|
34
|
+
toc: ~
|
35
|
+
|
36
|
+
# path to theme folder, for example:
|
14
37
|
# theme: _theme
|
15
|
-
|
16
|
-
|
17
|
-
#
|
38
|
+
theme: ~
|
39
|
+
|
40
|
+
# open the server URL in the browser
|
41
|
+
open: false
|
42
|
+
|
43
|
+
# provide user:password for basic authentication, for example:
|
44
|
+
# auth: admin:s3cr3t
|
45
|
+
auth: false
|
46
|
+
|
47
|
+
# if auth is enabled, specify auth realm name
|
48
|
+
auth_zone: Madness
|
49
|
+
|
50
|
+
# show files with these extensions in the navigation and search, for example:
|
51
|
+
# expose_extensions: pdf,docx,xlsx,txt
|
52
|
+
expose_extensions: ~
|
53
|
+
|
54
|
+
# exclude directories that match these regular expressions
|
55
|
+
# note that this is an array
|
56
|
+
exclude: ['^[a-z_\-0-9]+$']
|
data/lib/madness/version.rb
CHANGED
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.9.
|
4
|
+
version: 0.9.4
|
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:
|
11
|
+
date: 2021-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: coderay
|
@@ -282,7 +282,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
282
282
|
- !ruby/object:Gem::Version
|
283
283
|
version: '0'
|
284
284
|
requirements: []
|
285
|
-
rubygems_version: 3.2.
|
285
|
+
rubygems_version: 3.2.25
|
286
286
|
signing_key:
|
287
287
|
specification_version: 4
|
288
288
|
summary: Instant Markdown Server
|