madness 0.9.3 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +61 -8
- data/lib/madness/directory.rb +10 -4
- data/lib/madness/settings.rb +13 -5
- data/lib/madness/templates/madness.yml +53 -15
- 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
@@ -30,7 +30,7 @@
|
|
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
|
33
|
+
* [Basic Authentication](#basic-authentication)
|
34
34
|
* [Customizing Theme](#customizing-theme)
|
35
35
|
* [Forcing HTTPS Connection](#forcing-https-connection)
|
36
36
|
* [Docker Image](#docker-image)
|
@@ -117,22 +117,62 @@ documentation directory, and modify any of the settings below.
|
|
117
117
|
|
118
118
|
```yaml
|
119
119
|
# .madness.yml
|
120
|
-
|
121
|
-
|
122
|
-
|
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
|
123
131
|
sidebar: true
|
132
|
+
|
133
|
+
# add H1 title to files that do not have one
|
124
134
|
auto_h1: true
|
135
|
+
|
136
|
+
# append navigation to directory READMEs
|
125
137
|
auto_nav: true
|
138
|
+
|
139
|
+
# enable syntax highlighter for code snippets
|
126
140
|
highlighter: true
|
141
|
+
|
142
|
+
# enable line numbers for code snippets
|
127
143
|
line_numbers: true
|
144
|
+
|
145
|
+
# enable the copy to clipboard icon for code snippets
|
128
146
|
copy_code: true
|
129
|
-
|
130
|
-
|
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
|
131
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
|
132
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]+$']
|
133
173
|
```
|
134
174
|
|
135
|
-
For convenience, you can
|
175
|
+
For convenience, you can generate a template config file by running:
|
136
176
|
|
137
177
|
```shell
|
138
178
|
$ madness create config
|
@@ -191,10 +231,23 @@ numbers (`/^[a-z_\-0-9]+$/`) will not be displayed in the navigation. In
|
|
191
231
|
other words, directories must have at least one uppercase letter or a space
|
192
232
|
to be recognized as a documentation directory.
|
193
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
|
+
|
194
247
|
## Controlling Sort Order
|
195
248
|
|
196
249
|
To control the sort order of the automatically generated navigation elements,
|
197
|
-
simply
|
250
|
+
simply prefix your files and directories with digits followed by a dot and a
|
198
251
|
space, just like you would create an ordered list in Markdown. The numbers
|
199
252
|
will be omitted when they are displayed.
|
200
253
|
|
data/lib/madness/directory.rb
CHANGED
@@ -27,13 +27,19 @@ 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
|
36
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
|
+
|
37
43
|
def config
|
38
44
|
@config ||= Settings.instance
|
39
45
|
end
|
data/lib/madness/settings.rb
CHANGED
@@ -48,20 +48,22 @@ module Madness
|
|
48
48
|
|
49
49
|
def defaults
|
50
50
|
{
|
51
|
+
path: '.',
|
51
52
|
port: 3000,
|
52
53
|
bind: '0.0.0.0',
|
53
|
-
|
54
|
+
sidebar: true,
|
54
55
|
auto_h1: true,
|
56
|
+
auto_nav: true,
|
55
57
|
highlighter: true,
|
56
58
|
line_numbers: true,
|
57
59
|
copy_code: true,
|
60
|
+
toc: nil,
|
58
61
|
theme: nil,
|
59
62
|
open: false,
|
60
|
-
auto_nav: true,
|
61
|
-
sidebar: true,
|
62
63
|
auth: false,
|
63
64
|
auth_realm: 'Madness',
|
64
|
-
expose_extensions: nil
|
65
|
+
expose_extensions: nil,
|
66
|
+
exclude: [/^[a-z_\-0-9]+$/]
|
65
67
|
}
|
66
68
|
end
|
67
69
|
|
@@ -70,7 +72,13 @@ module Madness
|
|
70
72
|
end
|
71
73
|
|
72
74
|
def file_data
|
73
|
-
|
75
|
+
result = if file_exist?
|
76
|
+
ExtendedYAML.load(filename)&.symbolize_keys
|
77
|
+
else
|
78
|
+
{}
|
79
|
+
end
|
80
|
+
|
81
|
+
result || {}
|
74
82
|
end
|
75
83
|
|
76
84
|
end
|
@@ -1,18 +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
|
-
#
|
18
|
-
|
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: 2021-
|
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
|