madman 0.2.8 → 0.2.9

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7ce1a3efa4b8c0f8d508f3070a337c96f54f1309307a795a4f3f352ff491d120
4
- data.tar.gz: 15bcf89abb0f01f2040d2221d0ab8ad56b0ff35946f49a37ac8b29733854e4fb
3
+ metadata.gz: 60c061af738d6d3b7230deb983106d9f7048a7e37f8eaf0c26d5aac99c41af9e
4
+ data.tar.gz: 9080e9b62319d7038f5847e49aa0bc799f7da36aa665e345e962b6e528449b36
5
5
  SHA512:
6
- metadata.gz: f8cee25b6ba93719f3e277a142a33477f1e3d71d1ab2870eafbfd3e8ac7ab1c50802c19c3c42e6115dc4d74d31e75cabfc927e2bc58740ee3731fea4398b07fc
7
- data.tar.gz: aa60da86873a48de206154ff1608595e3b90802e5cedeef3a01b61c27c10bd7da44037ffae89e61a4d832d478621bf141d6601710e5f65bc3fdc45d26d27ba23
6
+ metadata.gz: 4c0144818df47c80e9e8758fb932cd1238eccea30615a68413e434d9b49da1d7b64e9ed02ab763c4214aa478e1d4a3d1f49a0e3634e83f83d30586c7914b121c
7
+ data.tar.gz: 934dbe15c427f51d1638b3aff0c9e653001f8eef3407133a62947232ab4305b57aafe82b9f8b50ad4314abf2512f1e8f213a01930377349396d3f95950156250
@@ -19,7 +19,7 @@ module Madman
19
19
 
20
20
  def run
21
21
  dir = args['DIR']
22
- basedir = Madman::Directory.new dir, dir
22
+ basedir = Madman::Directory.new dir
23
23
 
24
24
  dirs = basedir.deep_list.select { |i| i.dir? }.map { |i| i.path }
25
25
  dirs.each do |dir|
@@ -8,14 +8,28 @@ module Madman
8
8
  @renderer = settings.respond_to?(:renderer) ? settings.renderer : :default
9
9
  end
10
10
 
11
+ not_found do
12
+ content_type :text
13
+ "4O4 Not Found"
14
+ end
15
+
16
+ get '/favicon.ico' do
17
+ content_type :text
18
+ '(oOo)'
19
+ end
20
+
11
21
  get '/*' do
12
22
  path = params[:splat].first
13
23
 
14
24
  type, file = find_file(path)
15
25
  redirect "#{path}/" if type == :dir and path[-1] != '/'
16
26
 
17
- @doc = Document.from_file file
18
- slim :template
27
+ if File.exist? file
28
+ @doc = Document.from_file file
29
+ slim :template
30
+ else
31
+ halt 404
32
+ end
19
33
  end
20
34
 
21
35
  private
@@ -1,9 +1,9 @@
1
1
  module Madman
2
- # Represents a directory with markdown file sand subflders.
2
+ # Represents a directory with markdown files and subflders.
3
3
  class Directory
4
4
  attr_reader :dir, :basedir
5
5
 
6
- def initialize(dir, basedir=nil)
6
+ def initialize(dir, basedir = nil)
7
7
  @dir = dir
8
8
  @basedir = basedir || dir
9
9
  end
@@ -2,7 +2,7 @@ module Madman
2
2
  module Renderers
3
3
  class Default
4
4
  def self.render(text, opts={})
5
- CommonMarker.render_html text, :DEFAULT, [:table]
5
+ CommonMarker.render_html text, [:DEFAULT, :UNSAFE], [:table]
6
6
  end
7
7
  end
8
8
  end
@@ -1,3 +1,3 @@
1
1
  module Madman
2
- VERSION = "0.2.8"
2
+ VERSION = "0.2.9"
3
3
  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.2.8
4
+ version: 0.2.9
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: 2020-05-07 00:00:00.000000000 Z
11
+ date: 2020-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra