madness 0.7.6 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/madness/breadcrumbs.rb +1 -1
- data/lib/madness/command_line.rb +1 -1
- data/lib/madness/directory.rb +1 -1
- data/lib/madness/document.rb +8 -7
- data/lib/madness/item.rb +2 -2
- data/lib/madness/navigation.rb +1 -1
- data/lib/madness/refinements/string_refinements.rb +4 -0
- data/lib/madness/search.rb +1 -1
- data/lib/madness/server.rb +5 -1
- data/lib/madness/settings.rb +1 -1
- data/lib/madness/table_of_contents.rb +1 -1
- data/lib/madness/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17e42d618e170958cf8b556c2271ddb7efeeae6e15144c5e5f4252cdb4708808
|
4
|
+
data.tar.gz: b4fc80231d2cdbc2834dab2a428a501371abbb3b7426984f20833b411314df6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 547e6b50b089cac0e4c01bc4938ea14a0cee3985c7dbdcf6bf01a7aa375a4f18f31d720c368918e595c4d03a2ef5f03b6ece929d260c90b523f90d2886b54af5
|
7
|
+
data.tar.gz: 5c72050811de28e4bf8174b1897f847a770f6eeb12844b741c81ca810ba1c345b353e7aac00194f7ca0c01493d5ba664539ae00bdbedb552b81bffec4c07d4f9
|
data/lib/madness/breadcrumbs.rb
CHANGED
data/lib/madness/command_line.rb
CHANGED
data/lib/madness/directory.rb
CHANGED
data/lib/madness/document.rb
CHANGED
@@ -47,19 +47,20 @@ module Madness
|
|
47
47
|
|
48
48
|
# Return the HTML for that document, force re-read.
|
49
49
|
def content!
|
50
|
-
|
50
|
+
[:empty, :missing].include?(type) ? "<h1>#{title}</h1>" : markdown_to_html
|
51
51
|
end
|
52
52
|
|
53
|
-
|
53
|
+
private
|
54
54
|
|
55
55
|
# Identify file, dir and type.
|
56
|
-
# :readme
|
57
|
-
#
|
58
|
-
# :file
|
59
|
-
# :empty
|
56
|
+
# :readme - in case the path is a directory, and it contains index.md
|
57
|
+
# or README.md
|
58
|
+
# :file - in case the path is a *.md file
|
59
|
+
# :empty - in case it is a folder without README.md or index.md
|
60
|
+
# :missing - in any other case, we don't know (will trigger 404)
|
60
61
|
def set_base_attributes
|
61
62
|
@dir = docroot
|
62
|
-
@type = :
|
63
|
+
@type = :missing
|
63
64
|
@file = ''
|
64
65
|
@title = 'Index'
|
65
66
|
|
data/lib/madness/item.rb
CHANGED
@@ -14,7 +14,7 @@ module Madness
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def href
|
17
|
-
|
17
|
+
path_without_extension.sub(/^#{docroot}/, '').to_href
|
18
18
|
end
|
19
19
|
|
20
20
|
def dir?
|
@@ -25,7 +25,7 @@ module Madness
|
|
25
25
|
type == :file
|
26
26
|
end
|
27
27
|
|
28
|
-
|
28
|
+
private
|
29
29
|
|
30
30
|
def label!
|
31
31
|
File.basename(path_without_extension).to_label
|
data/lib/madness/navigation.rb
CHANGED
data/lib/madness/search.rb
CHANGED
data/lib/madness/server.rb
CHANGED
@@ -4,6 +4,8 @@ module Madness
|
|
4
4
|
|
5
5
|
# The Sinatra server
|
6
6
|
class Server < ServerBase
|
7
|
+
using StringRefinements
|
8
|
+
|
7
9
|
get '/_search' do
|
8
10
|
query = params[:q]
|
9
11
|
results = query ? Search.new.search(query) : false
|
@@ -33,7 +35,7 @@ module Madness
|
|
33
35
|
content = doc.content
|
34
36
|
|
35
37
|
if doc.type == :readme and !path.empty? and path[-1] != '/'
|
36
|
-
redirect "#{path}/"
|
38
|
+
redirect "#{path.to_href}/"
|
37
39
|
end
|
38
40
|
|
39
41
|
nav = Navigation.new dir
|
@@ -43,6 +45,8 @@ module Madness
|
|
43
45
|
redirect to(nav.links.first.href)
|
44
46
|
end
|
45
47
|
|
48
|
+
status 404 if doc.type == :missing
|
49
|
+
|
46
50
|
slim :document, locals: {
|
47
51
|
content: content,
|
48
52
|
type: doc.type,
|
data/lib/madness/settings.rb
CHANGED
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.
|
4
|
+
version: 0.8.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: 2019-12-
|
11
|
+
date: 2019-12-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: coderay
|