madman 0.2.13 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -2
- data/bin/madman +1 -1
- data/lib/madman/cli.rb +0 -1
- data/lib/madman/commands/nav.rb +28 -26
- data/lib/madman/commands/preview.rb +16 -13
- data/lib/madman/commands/readme.rb +14 -15
- data/lib/madman/commands/render.rb +13 -15
- data/lib/madman/commands/serve.rb +13 -14
- data/lib/madman/commands.rb +1 -1
- data/lib/madman/dir_server.rb +6 -7
- data/lib/madman/directory.rb +2 -2
- data/lib/madman/document.rb +7 -6
- data/lib/madman/injector.rb +4 -4
- data/lib/madman/item.rb +4 -3
- data/lib/madman/navigation.rb +9 -6
- data/lib/madman/preview_server.rb +2 -2
- data/lib/madman/refinements/array.rb +2 -2
- data/lib/madman/refinements/string.rb +2 -2
- data/lib/madman/renderers/default.rb +3 -3
- data/lib/madman/renderers/github.rb +4 -6
- data/lib/madman/renderers/yaml.rb +1 -3
- data/lib/madman/renderers.rb +2 -2
- data/lib/madman/server_base.rb +5 -5
- data/lib/madman/version.rb +2 -2
- data/lib/madman/yamldoc.rb +3 -4
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '039309eaa86e5f877b526211a472e1633d159880d76f6671e10defe0174b0282'
|
4
|
+
data.tar.gz: feb72279e624edb0bd5eb8a843068146d91104dbd9b3d9875521573574a2332b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97c8e85dfa09c26cb4688cb0a90fbb14a572c7bd5487b7d1eaf4c2e87adc7a5f35590fe9f5b6a0261190f2d4b591a56da20c31aad018560345f540471707bcf6
|
7
|
+
data.tar.gz: ed9d05c52593d1e9c1286d2997cc531a9b935d32a0efc299e7835f04fedd182293f22d7407152d13a5a288df3564d1873ab4848710d552fc0d2a30d4c219b034
|
data/README.md
CHANGED
@@ -36,8 +36,7 @@ Features
|
|
36
36
|
- [ ] Ad-hoc server to allow editing of a local markdown file.
|
37
37
|
- [x] Markdown generation with GitHub API (optional).
|
38
38
|
- [x] Table of Contents generation for a folder of markdown files.
|
39
|
-
- [x] Web server for an entire folder (like [Madness][1]) with GitHub Pages
|
40
|
-
compatibility.
|
39
|
+
- [x] Web server for an entire folder (like [Madness][1]) with GitHub Pages compatibility.
|
41
40
|
- [x] Automatic detection of Right-to-Left markdown files for HTML rendering.
|
42
41
|
- [x] Generate navigation README in folders without one.
|
43
42
|
- [x] Convert YAML file to an interactive HTML with collapsible sections.
|
data/bin/madman
CHANGED
data/lib/madman/cli.rb
CHANGED
data/lib/madman/commands/nav.rb
CHANGED
@@ -5,26 +5,29 @@ module Madman
|
|
5
5
|
class Nav < MisterBin::Command
|
6
6
|
include Colsole
|
7
7
|
|
8
|
-
summary
|
8
|
+
summary 'Add site-wide navigation links to README files'
|
9
9
|
|
10
|
-
help
|
10
|
+
help 'This command generates a Table of Contents for a directory, and injects it to a ' \
|
11
|
+
'file. In addition, it supports recursive execution, which will add a Table of Contents ' \
|
12
|
+
'to all README files (or a filename of your choice) in all the subfolders, creating ' \
|
13
|
+
'nagigation pages for an entire Markdown site.'
|
11
14
|
|
12
|
-
usage
|
13
|
-
usage
|
15
|
+
usage 'madman nav DIR [options]'
|
16
|
+
usage 'madman nav (-h|--help)'
|
14
17
|
|
15
|
-
option
|
16
|
-
option
|
17
|
-
option
|
18
|
-
option
|
19
|
-
option
|
20
|
-
option
|
21
|
-
option
|
18
|
+
option '-f --force', 'Inject TOC to all README files, even if they do not have a marker'
|
19
|
+
option '-m --marker TEXT', 'Look for an HTML comment with <!-- TEXT --> [default: nav]'
|
20
|
+
option '-d --depth N', 'The depth of the table of contents [default: 1]'
|
21
|
+
option '-v --verbose', 'Show the updated README content'
|
22
|
+
option '-t --target NAME', 'Set the target filename to look for. [default: README.md]'
|
23
|
+
option '-r --recursive', 'Inject to all target files'
|
24
|
+
option '-y --dry', 'Do not save the updated files, just show what will happen'
|
22
25
|
|
23
|
-
param
|
26
|
+
param 'DIR', 'The directory containing markdown files'
|
24
27
|
|
25
|
-
example
|
26
|
-
example
|
27
|
-
example
|
28
|
+
example 'madman nav'
|
29
|
+
example 'madman nav path/to/docs --force --marker toc'
|
30
|
+
example 'madman nav path/to/docs --dry -v -d2'
|
28
31
|
|
29
32
|
def run
|
30
33
|
if recursive?
|
@@ -33,7 +36,7 @@ module Madman
|
|
33
36
|
update_file "#{dir}/#{target}"
|
34
37
|
end
|
35
38
|
|
36
|
-
say dry? ?
|
39
|
+
say dry? ? 'Done (dry mode, no changes were made)' : 'Done'
|
37
40
|
end
|
38
41
|
|
39
42
|
def update_file(file)
|
@@ -45,7 +48,7 @@ module Madman
|
|
45
48
|
|
46
49
|
if verbose?
|
47
50
|
say word_wrap " !txtblu!#{doc.text}"
|
48
|
-
say
|
51
|
+
say ''
|
49
52
|
end
|
50
53
|
|
51
54
|
doc.save unless dry?
|
@@ -53,15 +56,14 @@ module Madman
|
|
53
56
|
|
54
57
|
# CLI Arguments
|
55
58
|
|
56
|
-
def dir
|
57
|
-
def depth
|
58
|
-
def marker
|
59
|
-
def target
|
60
|
-
def force
|
61
|
-
def dry
|
62
|
-
def verbose
|
63
|
-
def recursive
|
64
|
-
|
59
|
+
def dir = args['DIR'] || '.'
|
60
|
+
def depth = args['--depth'].to_i
|
61
|
+
def marker = args.[]('--marker')
|
62
|
+
def target = args.[]('--target')
|
63
|
+
def force? = args.[]('--force')
|
64
|
+
def dry? = args.[]('--dry')
|
65
|
+
def verbose? = args.[]('--verbose')
|
66
|
+
def recursive? = args.[]('--recursive')
|
65
67
|
end
|
66
68
|
end
|
67
69
|
end
|
@@ -3,23 +3,28 @@ module Madman
|
|
3
3
|
class Preview < MisterBin::Command
|
4
4
|
include Colsole
|
5
5
|
|
6
|
-
summary
|
6
|
+
summary 'Serve a markdown or YAML file using a local server'
|
7
7
|
|
8
|
-
help
|
8
|
+
help <<~USAGE
|
9
|
+
This command will start a local server with two endpoints:
|
10
|
+
/ will render the markdown with the default renderer
|
11
|
+
/github will render with the GitHub API
|
12
|
+
USAGE
|
9
13
|
|
10
|
-
usage
|
11
|
-
usage
|
14
|
+
usage 'madman preview FILE [--port N --bind ADDRESS]'
|
15
|
+
usage 'madman preview (-h|--help)'
|
12
16
|
|
13
|
-
option
|
14
|
-
option
|
17
|
+
option '-p --port N', 'Set server port [default: 3000]'
|
18
|
+
option '-b --bind ADDRESS', 'Set server listen address [default: 0.0.0.0]'
|
15
19
|
|
16
|
-
param
|
20
|
+
param 'FILE', 'The input markdown or YAML file'
|
17
21
|
|
18
|
-
environment
|
22
|
+
environment 'GITHUB_ACCESS_TOKEN',
|
23
|
+
"Your GitHub API access token\nRequired only if you wish to use the '/github' endpoint\nGenerate one here: https://github.com/settings/tokens"
|
19
24
|
|
20
|
-
example
|
21
|
-
example
|
22
|
-
example
|
25
|
+
example 'madman preview README.md'
|
26
|
+
example 'madman preview README.md -p4000'
|
27
|
+
example 'madman preview file.yml'
|
23
28
|
|
24
29
|
def run
|
25
30
|
file = args['FILE']
|
@@ -35,8 +40,6 @@ module Madman
|
|
35
40
|
Madman::PreviewServer.set bind: bind, port: port, file: file
|
36
41
|
Madman::PreviewServer.run!
|
37
42
|
end
|
38
|
-
|
39
43
|
end
|
40
44
|
end
|
41
45
|
end
|
42
|
-
|
@@ -3,28 +3,29 @@ module Madman
|
|
3
3
|
class Readme < MisterBin::Command
|
4
4
|
include Colsole
|
5
5
|
|
6
|
-
summary
|
6
|
+
summary 'Create README in all qualified sub directories'
|
7
7
|
|
8
|
-
help
|
8
|
+
help 'This command generates README.md files in all subdirectories. Each file will receive ' \
|
9
|
+
'an H1 caption with the name of the folder it resides in. This command is designed to ' \
|
10
|
+
'assist in preparing a folder for table of contents injection.'
|
9
11
|
|
10
|
-
usage
|
11
|
-
usage
|
12
|
+
usage 'madman readme DIR [--dry]'
|
13
|
+
usage 'madman readme (-h|--help)'
|
12
14
|
|
13
|
-
option
|
15
|
+
option '-y --dry', "Only show what will be created, don't make any changes"
|
14
16
|
|
15
|
-
param
|
17
|
+
param 'DIR', 'The directory containing markdown files'
|
16
18
|
|
17
|
-
example
|
18
|
-
example
|
19
|
+
example 'madman readme .'
|
20
|
+
example 'madman readme path/to/docs --dry'
|
19
21
|
|
20
22
|
def run
|
21
|
-
|
22
|
-
basedir = Madman::Directory.new dir
|
23
|
+
basedir = Madman::Directory.new args['DIR']
|
23
24
|
|
24
|
-
dirs = basedir.deep_list.select
|
25
|
+
dirs = basedir.deep_list.select(&:dir?).map(&:path)
|
25
26
|
dirs.each do |dir|
|
26
27
|
file = "#{dir}/README.md"
|
27
|
-
|
28
|
+
|
28
29
|
if File.exist? file
|
29
30
|
say "Skipping #{file}"
|
30
31
|
else
|
@@ -34,10 +35,8 @@ module Madman
|
|
34
35
|
end
|
35
36
|
end
|
36
37
|
|
37
|
-
say args['--dry'] ?
|
38
|
+
say args['--dry'] ? 'Done (dry mode, no changes were made)' : 'Done'
|
38
39
|
end
|
39
|
-
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
43
|
-
|
@@ -3,22 +3,22 @@ module Madman
|
|
3
3
|
class Render < MisterBin::Command
|
4
4
|
include Colsole
|
5
5
|
|
6
|
-
help
|
6
|
+
help 'Render markdown or YAML to HTML'
|
7
7
|
|
8
|
-
usage
|
9
|
-
usage
|
8
|
+
usage 'madman render FILE [--github --save OUTFILE]'
|
9
|
+
usage 'madman render (-h|--help)'
|
10
10
|
|
11
|
-
option
|
12
|
-
option
|
11
|
+
option '--github', "Render using the GitHub API\nRequires setting the GITHUB_ACCESS_TOKEN environment variable"
|
12
|
+
option '--save OUTFILE', 'Save the output to a file'
|
13
13
|
|
14
|
-
param
|
14
|
+
param 'FILE', 'The input markdown or YAML file'
|
15
15
|
|
16
|
-
environment
|
16
|
+
environment 'GITHUB_ACCESS_TOKEN', "Your GitHub API access token\nGenerate one here: https://github.com/settings/tokens"
|
17
17
|
|
18
|
-
example
|
19
|
-
example
|
20
|
-
example
|
21
|
-
example
|
18
|
+
example 'madman render README.md'
|
19
|
+
example 'madman render README.md --github'
|
20
|
+
example 'madman render README.md --save out.html'
|
21
|
+
example 'madman render file.yml --save out.html'
|
22
22
|
|
23
23
|
def run
|
24
24
|
infile = args['FILE']
|
@@ -26,18 +26,16 @@ module Madman
|
|
26
26
|
renderer = args['--github'] ? :github : :default
|
27
27
|
|
28
28
|
doc = Madman::Document.from_file infile
|
29
|
-
|
29
|
+
|
30
30
|
output = doc.render renderer
|
31
31
|
|
32
32
|
if outfile
|
33
|
-
File.write outfile, output
|
33
|
+
File.write outfile, output
|
34
34
|
say "Saved !txtgrn!#{outfile}"
|
35
35
|
else
|
36
36
|
puts output
|
37
37
|
end
|
38
38
|
end
|
39
|
-
|
40
39
|
end
|
41
40
|
end
|
42
41
|
end
|
43
|
-
|
@@ -3,21 +3,22 @@ module Madman
|
|
3
3
|
class Serve < MisterBin::Command
|
4
4
|
include Colsole
|
5
5
|
|
6
|
-
summary
|
6
|
+
summary 'Serve a markdown directory using a local server'
|
7
7
|
|
8
|
-
usage
|
9
|
-
usage
|
8
|
+
usage 'madman serve DIR [--port N --bind ADDRESS --github]'
|
9
|
+
usage 'madman serve (-h|--help)'
|
10
10
|
|
11
|
-
option
|
12
|
-
option
|
13
|
-
option
|
11
|
+
option '--github', 'Use the GitHub API renderer instead of the default one'
|
12
|
+
option '-p --port N', 'Set server port [default: 3000]'
|
13
|
+
option '-b --bind ADDRESS', 'Set server listen address [default: 0.0.0.0]'
|
14
14
|
|
15
|
-
param
|
15
|
+
param 'DIR', 'The directory containing markdown files'
|
16
16
|
|
17
|
-
environment
|
17
|
+
environment 'GITHUB_ACCESS_TOKEN',
|
18
|
+
"Your GitHub API access token\nRequired only if you wish to use the '/github' endpoint\nGenerate one here: https://github.com/settings/tokens"
|
18
19
|
|
19
|
-
example
|
20
|
-
example
|
20
|
+
example 'madman serve'
|
21
|
+
example 'madman serve path/to/docs -p4000 --github'
|
21
22
|
|
22
23
|
def run
|
23
24
|
dir = args['DIR']
|
@@ -27,13 +28,11 @@ module Madman
|
|
27
28
|
|
28
29
|
say "Starting server at !undblu!localhost:#{port}!txtrst! using the !txtgrn!#{renderer}!txtrst! renderer\n"
|
29
30
|
|
30
|
-
Madman::DirServer.set bind: bind, port: port,
|
31
|
+
Madman::DirServer.set bind: bind, port: port,
|
31
32
|
dir: dir, renderer: renderer
|
32
|
-
|
33
|
+
|
33
34
|
Madman::DirServer.run!
|
34
35
|
end
|
35
|
-
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
39
|
-
|
data/lib/madman/commands.rb
CHANGED
data/lib/madman/dir_server.rb
CHANGED
@@ -10,19 +10,19 @@ module Madman
|
|
10
10
|
|
11
11
|
not_found do
|
12
12
|
content_type :text
|
13
|
-
|
13
|
+
'4O4 Not Found'
|
14
14
|
end
|
15
15
|
|
16
16
|
get '/favicon.ico' do
|
17
17
|
content_type :text
|
18
18
|
'(oOo)'
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
get '/*' do
|
22
22
|
path = params[:splat].first
|
23
23
|
|
24
24
|
type, file = find_file(path)
|
25
|
-
redirect "#{path}/" if type == :dir
|
25
|
+
redirect "#{path}/" if (type == :dir) && (path[-1] != '/')
|
26
26
|
|
27
27
|
if File.exist? file
|
28
28
|
@doc = Document.from_file file
|
@@ -40,13 +40,12 @@ module Madman
|
|
40
40
|
|
41
41
|
if File.directory? file
|
42
42
|
type = path.empty? ? :root : :dir
|
43
|
-
file ="#{file}/README.md"
|
43
|
+
file = "#{file}/README.md"
|
44
44
|
else
|
45
|
-
file ="#{file}.md"
|
45
|
+
file = "#{file}.md"
|
46
46
|
end
|
47
47
|
|
48
48
|
[type, file]
|
49
49
|
end
|
50
|
-
|
51
50
|
end
|
52
|
-
end
|
51
|
+
end
|
data/lib/madman/directory.rb
CHANGED
@@ -7,7 +7,7 @@ module Madman
|
|
7
7
|
@dir = dir
|
8
8
|
@basedir = basedir || dir
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
def list
|
12
12
|
@list ||= (dirs + files)
|
13
13
|
end
|
@@ -30,7 +30,7 @@ module Madman
|
|
30
30
|
|
31
31
|
def dirs
|
32
32
|
result = Dir["#{dir}/*"].select { |f| File.directory? f }
|
33
|
-
result.reject! do |f|
|
33
|
+
result.reject! do |f|
|
34
34
|
basename = File.basename(f)
|
35
35
|
basename =~ /^[a-z_\-0-9]+$/
|
36
36
|
end
|
data/lib/madman/document.rb
CHANGED
@@ -10,7 +10,7 @@ module Madman
|
|
10
10
|
|
11
11
|
def self.from_file(file)
|
12
12
|
if File.extname(file) == '.yml'
|
13
|
-
result = new YAML.
|
13
|
+
result = new YAML.unsafe_load_file(file), file
|
14
14
|
result.yaml_mode = true
|
15
15
|
result
|
16
16
|
else
|
@@ -18,12 +18,12 @@ module Madman
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
def initialize(text, filename=nil)
|
21
|
+
def initialize(text, filename = nil)
|
22
22
|
@text = text
|
23
23
|
@filename = filename
|
24
24
|
end
|
25
25
|
|
26
|
-
def render(renderer
|
26
|
+
def render(renderer = :default)
|
27
27
|
if yaml_mode
|
28
28
|
renderers[:yaml].render text, title: File.basename(filename, '.yml')
|
29
29
|
else
|
@@ -35,9 +35,10 @@ module Madman
|
|
35
35
|
detector.direction(text[0..200]) == 'rtl'
|
36
36
|
end
|
37
37
|
|
38
|
-
def save(save_as=nil)
|
38
|
+
def save(save_as = nil)
|
39
39
|
save_as ||= filename
|
40
|
-
raise ArgumentError,
|
40
|
+
raise ArgumentError, 'No filename provided' unless save_as
|
41
|
+
|
41
42
|
File.write save_as, text
|
42
43
|
end
|
43
44
|
|
@@ -51,4 +52,4 @@ module Madman
|
|
51
52
|
Renderers.available_renderers
|
52
53
|
end
|
53
54
|
end
|
54
|
-
end
|
55
|
+
end
|
data/lib/madman/injector.rb
CHANGED
@@ -6,13 +6,13 @@ module Madman
|
|
6
6
|
|
7
7
|
content = [marker, content, marker].join "\n"
|
8
8
|
|
9
|
-
if found_markers
|
9
|
+
if found_markers.zero? && force
|
10
10
|
self.text += "\n\n#{content}"
|
11
11
|
elsif found_markers == 1
|
12
|
-
text.gsub!
|
12
|
+
text.gsub!(/#{marker}/im, content)
|
13
13
|
elsif found_markers == 2
|
14
|
-
text.gsub!
|
14
|
+
text.gsub!(/#{marker}.*#{marker}/im, content)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
18
|
-
end
|
18
|
+
end
|
data/lib/madman/item.rb
CHANGED
@@ -5,7 +5,9 @@ module Madman
|
|
5
5
|
attr_reader :path, :type, :basedir
|
6
6
|
|
7
7
|
def initialize(path, type, basedir)
|
8
|
-
@path
|
8
|
+
@path = path
|
9
|
+
@type = type
|
10
|
+
@basedir = basedir
|
9
11
|
end
|
10
12
|
|
11
13
|
def label
|
@@ -13,7 +15,7 @@ module Madman
|
|
13
15
|
end
|
14
16
|
|
15
17
|
def href
|
16
|
-
Addressable::URI.escape(path_without_extension.sub(
|
18
|
+
Addressable::URI.escape(path_without_extension.sub(%r{^#{basedir}/}, ''))
|
17
19
|
end
|
18
20
|
|
19
21
|
def dir?
|
@@ -31,4 +33,3 @@ module Madman
|
|
31
33
|
end
|
32
34
|
end
|
33
35
|
end
|
34
|
-
|
data/lib/madman/navigation.rb
CHANGED
@@ -5,8 +5,9 @@ module Madman
|
|
5
5
|
class Navigation
|
6
6
|
attr_reader :dir, :depth
|
7
7
|
|
8
|
-
def initialize(dir='.', depth: 10)
|
9
|
-
@dir
|
8
|
+
def initialize(dir = '.', depth: 10)
|
9
|
+
@dir = dir
|
10
|
+
@depth = depth
|
10
11
|
end
|
11
12
|
|
12
13
|
def toc
|
@@ -28,16 +29,18 @@ module Madman
|
|
28
29
|
result.join "\n"
|
29
30
|
end
|
30
31
|
|
31
|
-
def toc!(path=dir, level=0)
|
32
|
+
def toc!(path = dir, level = 0)
|
32
33
|
return [] unless level < depth
|
34
|
+
|
33
35
|
list = Directory.new(path, dir).list
|
34
36
|
|
35
37
|
result = []
|
36
38
|
list.each do |item|
|
37
|
-
|
39
|
+
case item.type
|
40
|
+
when :dir
|
38
41
|
result.push level: level, item: item
|
39
|
-
result += toc! item.path, level+1
|
40
|
-
|
42
|
+
result += toc! item.path, level + 1
|
43
|
+
when :file
|
41
44
|
result.push level: level, item: item
|
42
45
|
end
|
43
46
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
module StringRefinements
|
2
2
|
refine String do
|
3
3
|
def slug
|
4
|
-
downcase.strip.
|
4
|
+
downcase.strip.tr(' ', '-').gsub(/[^\w-]/, '')
|
5
5
|
end
|
6
6
|
|
7
7
|
def to_html
|
8
8
|
CommonMarker.render_html self, :DEFAULT, [:table]
|
9
9
|
end
|
10
10
|
end
|
11
|
-
end
|
11
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
module Madman
|
2
2
|
module Renderers
|
3
3
|
class Default
|
4
|
-
def self.render(text,
|
5
|
-
CommonMarker.render_html text, [
|
4
|
+
def self.render(text, _opts = {})
|
5
|
+
CommonMarker.render_html text, %i[DEFAULT UNSAFE], [:table]
|
6
6
|
end
|
7
7
|
end
|
8
8
|
end
|
9
|
-
end
|
9
|
+
end
|
@@ -1,19 +1,17 @@
|
|
1
1
|
module Madman
|
2
2
|
module Renderers
|
3
|
-
class
|
4
|
-
def self.render(text,
|
3
|
+
class Github
|
4
|
+
def self.render(text, _opts = {})
|
5
5
|
client.markdown text
|
6
6
|
end
|
7
7
|
|
8
|
-
private
|
9
|
-
|
10
8
|
def self.client
|
11
9
|
Octokit::Client.new access_token: access_token
|
12
10
|
end
|
13
11
|
|
14
12
|
def self.access_token
|
15
|
-
ENV['GITHUB_ACCESS_TOKEN'] or raise ArgumentError,
|
13
|
+
ENV['GITHUB_ACCESS_TOKEN'] or raise ArgumentError, 'Please set GITHUB_ACCESS_TOKEN'
|
16
14
|
end
|
17
15
|
end
|
18
16
|
end
|
19
|
-
end
|
17
|
+
end
|
data/lib/madman/renderers.rb
CHANGED
data/lib/madman/server_base.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
module Madman
|
2
2
|
class ServerBase < Sinatra::Base
|
3
3
|
set :views, File.expand_path('../views', __dir__)
|
4
|
-
|
4
|
+
|
5
5
|
Slim::Engine.set_options pretty: true
|
6
|
-
|
7
|
-
# Reloader temporarily removed due to
|
6
|
+
|
7
|
+
# Reloader temporarily removed due to
|
8
8
|
# https://github.com/sinatra/sinatra/issues/1587
|
9
9
|
#
|
10
10
|
# configure :development do
|
@@ -13,7 +13,7 @@ module Madman
|
|
13
13
|
# end
|
14
14
|
|
15
15
|
get '/favicon.ico' do
|
16
|
+
''
|
16
17
|
end
|
17
|
-
|
18
18
|
end
|
19
|
-
end
|
19
|
+
end
|
data/lib/madman/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module Madman
|
2
|
-
VERSION =
|
3
|
-
end
|
2
|
+
VERSION = '0.3.0'
|
3
|
+
end
|
data/lib/madman/yamldoc.rb
CHANGED
@@ -40,7 +40,7 @@ module Madman
|
|
40
40
|
@counter += 1
|
41
41
|
end
|
42
42
|
|
43
|
-
def tree!(data=nil, indent=0, caption=2)
|
43
|
+
def tree!(data = nil, indent = 0, caption = 2)
|
44
44
|
data ||= yaml
|
45
45
|
result = []
|
46
46
|
caption = 6 if caption > 6
|
@@ -65,14 +65,13 @@ module Madman
|
|
65
65
|
end
|
66
66
|
|
67
67
|
if value.is_a? Hash
|
68
|
-
result.push tree!(value, indent+1, caption+1)
|
68
|
+
result.push tree!(value, indent + 1, caption + 1)
|
69
69
|
elsif value
|
70
|
-
result.push "#{space * (indent+1)}#{value.to_html}"
|
70
|
+
result.push "#{space * (indent + 1)}#{value.to_html}"
|
71
71
|
end
|
72
72
|
|
73
73
|
result.push "#{space * indent}</div>"
|
74
74
|
result
|
75
75
|
end
|
76
|
-
|
77
76
|
end
|
78
77
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: madman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.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: 2022-12-
|
11
|
+
date: 2022-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -228,7 +228,8 @@ files:
|
|
228
228
|
homepage: https://github.com/dannyben/madman
|
229
229
|
licenses:
|
230
230
|
- MIT
|
231
|
-
metadata:
|
231
|
+
metadata:
|
232
|
+
rubygems_mfa_required: 'true'
|
232
233
|
post_install_message:
|
233
234
|
rdoc_options: []
|
234
235
|
require_paths:
|
@@ -237,7 +238,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
237
238
|
requirements:
|
238
239
|
- - ">="
|
239
240
|
- !ruby/object:Gem::Version
|
240
|
-
version:
|
241
|
+
version: 3.0.0
|
241
242
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
242
243
|
requirements:
|
243
244
|
- - ">="
|