Skip to content

Commit 6780682

Browse files
committed
- Remove ferret and implement simpler search
1 parent 789004d commit 6780682

28 files changed

Lines changed: 42 additions & 318 deletions

README.md

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,6 @@ auto_nav: true
124124
highlighter: true
125125
line_numbers: true
126126
copy_code: true
127-
index: false
128-
search_limit: 100
129127
dtoc: Table of Contents
130128
theme: _theme
131129
open: false
@@ -139,15 +137,7 @@ $ madness create config
139137

140138
## Search
141139

142-
Madness comes with a full text search page. To activate it, you need to
143-
generate a search index by running `madness --index` or
144-
`madness path/to/docs --index`.
145-
146-
This will create an `_index` sub folder, and will add a new search page
147-
to your documentation server.
148-
149-
You will need to run this command from time to time, as your
150-
documents change or new documents are added.
140+
Madness comes with a full text search page.
151141

152142
## Images and Static Files
153143

app/public/css/main.css

Lines changed: 0 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/public/css/main.css.map

Lines changed: 2 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/public/js/autocomplete.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

app/public/js/vendor/jquery.autocomplete-min.js

Lines changed: 0 additions & 8 deletions
This file was deleted.

app/styles/_autocomplete.scss

Lines changed: 0 additions & 29 deletions
This file was deleted.

app/styles/_manifest.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
@import "breadcrumbs";
1414
@import "nav";
1515
@import "icons";
16-
@import "autocomplete";
1716

1817
// Last
1918
@import "general";

app/views/layout.slim

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,10 @@ html
77
meta name="viewport" content="width=device-width, initial-scale=1"
88
link href='/css/main.css' rel='stylesheet' type='text/css'
99

10-
- if nav.with_search? or config.copy_code
11-
script src="/js/vendor/jquery.min.js"
12-
1310
- if config.copy_code
11+
script src="/js/vendor/jquery.min.js"
1412
script src="/js/vendor/clipboard.min.js"
1513
script src="/js/clipboard.js"
1614

17-
- if nav.with_search?
18-
script src="/js/vendor/jquery.autocomplete-min.js"
19-
script src="/js/autocomplete.js"
20-
2115
body
2216
== yield

app/views/search.slim

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,13 @@
22

33
.main class=(config.sidebar ? 'with-sidebar' : 'without-sidebar')
44
form.search-form action="/_search" method="get"
5-
input.search-field.autocomplete type="text" name="q" value="#{params[:q]}" placeholder="Search" autofocus=true
5+
input.search-field type="text" name="q" value="#{params[:q]}" placeholder="Search" autofocus=true
66
input type="submit" value="Search" style='display:none'
77

88
hr
99

1010
- if results
11-
- results.each_with_index do |result, index|
11+
- results.each do |label, file|
1212
h4
13-
= index+1
14-
= ". "
15-
a href="#{result[:file]}" = result[:label]
16-
17-
ul
18-
- if result[:highlights]
19-
- result[:highlights].each do |highlight|
20-
li.search-excerpt == highlight
21-
- else
22-
li.search-excerpt.quiet No excerpt
13+
a href="#{label}" = label
2314

lib/madness/command_line.rb

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ def set_config(args)
6565
config.port = args['--port'].to_i if args['--port']
6666
config.bind = args['--bind'] if args['--bind']
6767
config.toc = args['--toc'] if args['--toc']
68-
config.search_limit = args['--search-limit'].to_i if args['--search-limit']
6968
config.auth = args['--auth'] if args['--auth']
7069
config.auth_realm = args['--auth-realm'] if args['--auth-realm']
7170

@@ -75,15 +74,13 @@ def set_config(args)
7574
config.highlighter = false if args['--no-syntax']
7675
config.line_numbers = false if args['--no-line-numbers']
7776
config.copy_code = false if args['--no-copy-code']
78-
config.index = true if args['--index']
7977
config.open = true if args['--open']
8078

8179
config.theme = File.expand_path(args['--theme'], config.path) if args['--theme']
8280
end
8381

8482
# Generate index and toc, if requested by the user.
8583
def generate_stuff
86-
build_index if config.index
8784
build_toc if config.toc
8885
end
8986

@@ -120,13 +117,6 @@ def show_status
120117
say "-" * 60
121118
end
122119

123-
# Build the search index
124-
def build_index
125-
search = Search.new
126-
say_status :index, "generating #{search.index_dir}"
127-
search.build_index
128-
end
129-
130120
# Generate the table of contents file
131121
def build_toc
132122
say_status :toc, "generating #{config.toc}"

0 commit comments

Comments
 (0)