madness 0.9.2 → 0.9.3

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: 6e6d1a2a1af740dbcace6dcf480bdb39bd070f1a2950d0bfdc75728ee99104cf
4
- data.tar.gz: 4342dcc15681c42998f97736dda3d118c5062e295beae85e482ebf850e920977
3
+ metadata.gz: 4d1899b2ed090d1ff053077a195f6e5a8c80a24ba66ebbe6e9ed1f50ad167a5c
4
+ data.tar.gz: d13d70143ba4f3ac510e83d738df2d5a1cb15f03db33f2ac2e9c255fabb8ff19
5
5
  SHA512:
6
- metadata.gz: 0d8c1f9366a41f91332e775c8c26d3a1994f4b13694a342a55c18a8cf99124f59257b3ce7f7ce1634c5759003dcfeb3a63f74f75ee1abaf835a30c9e83d68f9d
7
- data.tar.gz: 7ed9cafc3418cdd966a55c2d0ba2fddee9e5e3bdae5c159e6caea8108d845d32a78ccdd77464469f8ff3cbdd70e70dac79e652e6001e980ea8662a3a0530ddee
6
+ metadata.gz: 61e495e8e475069111ba693451bbde77876e5ddf784a035250aaca3321defe30409a011bcb3264519812d992b7bd050625cf3d719eb286b90eecc73e6a40050a
7
+ data.tar.gz: 796aa6f34076dffdb370233f21f7df5973142839f8fc4cdfbc1666c426d518498a83daf604e999c61fcd72045876dd966f5c50cca4249b4a3b06153bc4b679da
data/README.md CHANGED
@@ -29,6 +29,7 @@
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
+ * [Displaying Additional File Types](#displaying-additional-file-types)
32
33
  * [Basic Authntication](#basic-authentication)
33
34
  * [Customizing Theme](#customizing-theme)
34
35
  * [Forcing HTTPS Connection](#forcing-https-connection)
@@ -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
 
@@ -124,9 +126,10 @@ auto_nav: true
124
126
  highlighter: true
125
127
  line_numbers: true
126
128
  copy_code: true
127
- dtoc: Table of Contents
129
+ toc: Table of Contents
128
130
  theme: _theme
129
131
  open: false
132
+ expose_extensions: ~
130
133
  ```
131
134
 
132
135
  For convenience, you can get a template config file by running:
@@ -201,6 +204,19 @@ will be omitted when they are displayed.
201
204
  └── 2. Another file or folder
202
205
  ```
203
206
 
207
+ ## Displaying Additional File Types
208
+
209
+ If you wish the navigation and search features to also show other documents
210
+ and files (for example, PDF files), you may configure the `expose_extensions`
211
+ option in the configuration file to contain a comma delimited list of
212
+ extensions:
213
+
214
+ ```yaml
215
+ expose_extensions: pdf,docx,xlsx,txt
216
+ ```
217
+
218
+ The default value of this option is `null` (or `~`, which is `null` in YAML).
219
+
204
220
  ## Basic Authentication
205
221
 
206
222
  To add basic authentication, use the `--auth user:password` command line argument or the equivalent `auth` configuration option.
@@ -17,7 +17,7 @@ module Madness
17
17
  private
18
18
 
19
19
  def files
20
- result = Dir["#{dir}/*.md"]
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'
@@ -33,5 +33,10 @@ module Madness
33
33
  end
34
34
  result.nat_sort.map { |path| Item.new path, :dir }
35
35
  end
36
+
37
+ def config
38
+ @config ||= Settings.instance
39
+ end
40
+
36
41
  end
37
42
  end
@@ -21,7 +21,7 @@ module Madness
21
21
  return result if words.empty?
22
22
 
23
23
  index.each do |file, content|
24
- file = file.remove("#{@path}/")[0...-3]
24
+ file = file.remove("#{@path}/").sub(/.md$/, '')
25
25
  url = file_url file
26
26
  label = file_label file
27
27
  found = 0
@@ -37,10 +37,12 @@ module Madness
37
37
 
38
38
  def index!
39
39
  results = {}
40
- Dir["#{@path}/**/*.md"].sort.each do |file|
40
+
41
+ Dir["#{@path}/**/#{config.dir_glob}"].sort.each do |file|
41
42
  next if skip_index? file
42
- filename = file_url(file.sub("#{@path}/", '')[0...-3]).downcase
43
- content = File.read(file).downcase
43
+ filename = file_url(file.sub("#{@path}/", '')).downcase
44
+ index_content = File.extname(file) == '.md'
45
+ content = index_content ? File.read(file).downcase : ''
44
46
  results[file] = "#{filename} #{content}"
45
47
  end
46
48
  results
@@ -40,6 +40,10 @@ 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
@@ -56,7 +60,8 @@ module Madness
56
60
  auto_nav: true,
57
61
  sidebar: true,
58
62
  auth: false,
59
- auth_realm: 'Madness'
63
+ auth_realm: 'Madness',
64
+ expose_extensions: nil
60
65
  }
61
66
  end
62
67
 
@@ -15,3 +15,4 @@
15
15
  # open: false
16
16
  # auth: false
17
17
  # auth_zone: 'Madness'
18
+ # expose_extensions: ~
@@ -1,3 +1,3 @@
1
1
  module Madness
2
- VERSION = "0.9.2"
2
+ VERSION = "0.9.3"
3
3
  end
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.2
4
+ version: 0.9.3
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-01-13 00:00:00.000000000 Z
11
+ date: 2021-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: coderay