patricia 0.0.1
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 +7 -0
- data/.gitignore +25 -0
- data/Gemfile +12 -0
- data/LICENSE.txt +22 -0
- data/README.md +77 -0
- data/Rakefile +2 -0
- data/bin/patricia +48 -0
- data/lib/patricia/app.rb +258 -0
- data/lib/patricia/assets/javascripts/app.js +170 -0
- data/lib/patricia/assets/javascripts/bootstrap.min.js +7 -0
- data/lib/patricia/assets/javascripts/jquery-1.11.0.min.js +4 -0
- data/lib/patricia/assets/javascripts/tooltips.js +10 -0
- data/lib/patricia/assets/stylesheets/app.css +22 -0
- data/lib/patricia/assets/stylesheets/bootstrap.min.css +7 -0
- data/lib/patricia/cli.rb +66 -0
- data/lib/patricia/patricia.rb +248 -0
- data/lib/patricia/version.rb +3 -0
- data/lib/patricia/views/404.haml +12 -0
- data/lib/patricia/views/application.haml +18 -0
- data/lib/patricia/views/search.haml +62 -0
- data/lib/patricia/views/wiki/page.haml +31 -0
- data/lib/patricia/views/wiki/welcome.md +101 -0
- data/lib/patricia.rb +3 -0
- data/patricia/.gitignore +22 -0
- data/patricia.gemspec +25 -0
- data/spec/app_spec.rb +195 -0
- data/spec/assets/javascripts/one.js +1 -0
- data/spec/assets/javascripts/two.js +1 -0
- data/spec/assets/stylesheets/green.css +3 -0
- data/spec/assets/stylesheets/red.css +3 -0
- data/spec/patricia_wiki_spec.rb +123 -0
- data/spec/random-test-wiki/amazing-animals/index.md +3 -0
- data/spec/random-test-wiki/amazing-animals/small/hamster.md +7 -0
- data/spec/random-test-wiki/amazing-animals/small/mouse.md +13 -0
- data/spec/random-test-wiki/amazing-animals/small/rat.md +7 -0
- data/spec/random-test-wiki/amazing-animals/tall/elephant.md +13 -0
- data/spec/random-test-wiki/amazing-animals/tall/giraffe.md +7 -0
- data/spec/random-test-wiki/colors/blue.md +9 -0
- data/spec/random-test-wiki/colors/bright-orange.org +19 -0
- data/spec/random-test-wiki/colors/dark-yellow.textile +14 -0
- data/spec/random-test-wiki/colors/file.txt +3 -0
- data/spec/random-test-wiki/colors/green.markdown +3 -0
- data/spec/random-test-wiki/colors/image.png +0 -0
- data/spec/random-test-wiki/colors/light-pink.rst +74 -0
- data/spec/random-test-wiki/colors/red.md +7 -0
- data/spec/random-test-wiki/overview.md +15 -0
- data/spec/test_helpers.rb +11 -0
- metadata +143 -0
@@ -0,0 +1,62 @@
|
|
1
|
+
%div.container
|
2
|
+
%br
|
3
|
+
%a.text-muted.small{:href => '/'} < Home
|
4
|
+
%div.panel.panel-default.page-header
|
5
|
+
%div.row.panel-body
|
6
|
+
%div.text-center
|
7
|
+
%h1 Search Pages
|
8
|
+
%br
|
9
|
+
%div.container
|
10
|
+
%form.col.col-md-8.col-md-offset-2{:method => 'post', :action => '/patricia/search'}
|
11
|
+
%div.well.row
|
12
|
+
%div.col.col-md-10
|
13
|
+
%input.form-control{:type => 'text', :name => 'search_query', :placeholder => 'Search', :value => "#{@previous_search_query}"}
|
14
|
+
%div.col.col-md-2
|
15
|
+
%button.form-control.btn.btn-default{:type => 'submit'} OK
|
16
|
+
%div.text-right
|
17
|
+
%label
|
18
|
+
- if @previous_search_query_was_sensitive
|
19
|
+
%input{:type => 'checkbox', :name => 'case_sensitive', :checked => ''}
|
20
|
+
- else
|
21
|
+
%input{:type => 'checkbox', :name => 'case_sensitive'}
|
22
|
+
Case sensitive
|
23
|
+
|
24
|
+
- if defined?(@results)
|
25
|
+
%div.container
|
26
|
+
%div.row.col.col-md-8.col-md-offset-2
|
27
|
+
%div.row
|
28
|
+
%br
|
29
|
+
%div.col.col-md-10
|
30
|
+
- if defined?(@previous_search_query)
|
31
|
+
%p
|
32
|
+
Search results for
|
33
|
+
"
|
34
|
+
%strong= @previous_search_query
|
35
|
+
"
|
36
|
+
- if @previous_search_query_was_sensitive
|
37
|
+
(case sensitive)
|
38
|
+
- else
|
39
|
+
(case insensitive)
|
40
|
+
%div.col.col-md-2
|
41
|
+
%p.text-right.text-muted
|
42
|
+
= @results.length
|
43
|
+
results
|
44
|
+
- if @results.empty?
|
45
|
+
%hr
|
46
|
+
%p.text-center
|
47
|
+
%em No pages found
|
48
|
+
%div.list-group
|
49
|
+
- @results.each_with_index do |result, i|
|
50
|
+
%a.list-group-item{:href => "#{result[1]}"}
|
51
|
+
%div.row
|
52
|
+
%div.col.col-md-10
|
53
|
+
%h2.no-style= result[0]
|
54
|
+
%p.text-muted= result[2]
|
55
|
+
%div.col.col-md-2
|
56
|
+
%p.text-right.text-muted
|
57
|
+
%span.row.small
|
58
|
+
= i + 1
|
59
|
+
\.
|
60
|
+
%em.row
|
61
|
+
= result[3]
|
62
|
+
lines
|
@@ -0,0 +1,31 @@
|
|
1
|
+
%br
|
2
|
+
%div.container
|
3
|
+
%div.row
|
4
|
+
%div.col.col-md-7.col-md-offset-1#content
|
5
|
+
%div.row
|
6
|
+
%div.col.col-md-8
|
7
|
+
%a{:href => "/"}
|
8
|
+
%strong= @title if defined?(@title)
|
9
|
+
- if defined?(@page_title)
|
10
|
+
- if !@page_title.empty?
|
11
|
+
|
|
12
|
+
%span.text-muted= @breadcrumb
|
13
|
+
= @page_title if defined?(@page_title)
|
14
|
+
%div.col.col-md-4
|
15
|
+
%p.text-right
|
16
|
+
%a.text-muted.small#p-page-search-link{:href => "/patricia/search"} Search pages >
|
17
|
+
%hr
|
18
|
+
= @html if defined?(@html)
|
19
|
+
%hr
|
20
|
+
- if defined?(@markup_url)
|
21
|
+
%p.text-center
|
22
|
+
%small
|
23
|
+
%a.text-muted{:href => "#{@markup_url}"} Markup for this page
|
24
|
+
%div.col.col-md-3.col-md-offset-1.well#p-sidebar
|
25
|
+
%input.form-control#p-sidebar-search-box{:type => 'text', :placeholder => 'Search'}
|
26
|
+
%p.text-right
|
27
|
+
%a.btn.btn-link.btn-xs#p-sidebar-width-toggle{:href => ''} Widen sidebar
|
28
|
+
%br
|
29
|
+
- if defined?(@toc)
|
30
|
+
%div#toc
|
31
|
+
= @toc
|
@@ -0,0 +1,101 @@
|
|
1
|
+
# Welcome
|
2
|
+
|
3
|
+
This is *Patricia*, a simple markup-based Wiki. You feed it a directory
|
4
|
+
full of markup files and it can do two things for you.
|
5
|
+
|
6
|
+
1. Serve the files for you dynamically; refreshing the page will always
|
7
|
+
fetch the current state of the markup file.
|
8
|
+
2. Generate an output directory full of static HTML files that you can
|
9
|
+
serve yourself.
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
To start serving your files dynamically, run
|
14
|
+
|
15
|
+
patricia /path/to/markup/dir -p 4321
|
16
|
+
|
17
|
+
`-p` will use a port of your choice. If you supply `-t`, hovering over
|
18
|
+
items in the sidebar will show a tooltip with the path to the associated
|
19
|
+
markup file or directory.
|
20
|
+
|
21
|
+
The `--css` and `--js` options allow you to use your own stylesheets and
|
22
|
+
JavaScipt files.
|
23
|
+
|
24
|
+
To see all available options, run `patricia --help`.
|
25
|
+
|
26
|
+
---------------------------------------------------------------------------
|
27
|
+
|
28
|
+
If you want to generate an output directory full of static HTML files, run
|
29
|
+
|
30
|
+
patricia /path/to/markup/dir /path/to/output/dir
|
31
|
+
|
32
|
+
Of course, you can also use `--css` and `--js` here, too. Don't forget to
|
33
|
+
serve those CSS and JavaScript asset files with the correct path, though
|
34
|
+
when actually serving the Wiki from your server/CDN.
|
35
|
+
|
36
|
+
## Links
|
37
|
+
|
38
|
+
Links are relative to the root of your markup directory, but the root
|
39
|
+
directory name itself can be left out.
|
40
|
+
|
41
|
+
Suppose you have a markup directory structure that looks like this:
|
42
|
+
|
43
|
+
|
44
|
+
.
|
45
|
+
my-flower-wiki
|
46
|
+
|-- small-flowers
|
47
|
+
| |-- bright-colors
|
48
|
+
| | |-- orange.md
|
49
|
+
| | |-- red.markdown
|
50
|
+
| | `-- yellow.rst
|
51
|
+
| |-- dark-colors
|
52
|
+
| | |-- blue.md
|
53
|
+
| | `-- violet.org
|
54
|
+
| `-- overview.pdf
|
55
|
+
`-- tall-flowers
|
56
|
+
|-- bright-colors
|
57
|
+
| |-- orange.md
|
58
|
+
| |-- red.markdown
|
59
|
+
| `-- yellow.rst
|
60
|
+
`-- dark-colors
|
61
|
+
|-- blue.md
|
62
|
+
`-- violet.org
|
63
|
+
|
64
|
+
To link from `my-flower-wiki/small-flowers/brigh-colors/red.md` to
|
65
|
+
`my-flower-wiki/tall-flowers/dark-colors/blue.md`, you would specify a link
|
66
|
+
with the **full path**, but **without the markup file extension**:
|
67
|
+
|
68
|
+
[Tall dark blue flower](/tall-flowers/dark-colors/blue)
|
69
|
+
|
70
|
+
## Images
|
71
|
+
|
72
|
+
Images, like links, use the **full path**, but, unlike links,
|
73
|
+
**do include the file extension**:
|
74
|
+
|
75
|
+

|
76
|
+
|
77
|
+
## PDFs/videos/text files/...
|
78
|
+
|
79
|
+
Static files work just like images, specifiy the **full path** and
|
80
|
+
**do include the file extension**:
|
81
|
+
|
82
|
+
[Overview PDF](tall-flowers/overview.pdf)
|
83
|
+
|
84
|
+
## Installation
|
85
|
+
|
86
|
+
You already have Patricia, but if you want to make a friend a Patricia
|
87
|
+
user, run:
|
88
|
+
|
89
|
+
gem install patricia
|
90
|
+
|
91
|
+
---------------------------------------------------------------------------
|
92
|
+
|
93
|
+
## Sidebar
|
94
|
+
|
95
|
+
- The search box is case-insensitive, but otherwise RegEx-aware.
|
96
|
+
|
97
|
+
- The sidebar can be widened. Click `Widen sidebar` or hit the `w` key.
|
98
|
+
|
99
|
+
- Press `?` to get a list of all keyboard shortcuts.
|
100
|
+
|
101
|
+
---------------------------------------------------------------------------
|
data/lib/patricia.rb
ADDED
data/patricia/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
data/patricia.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'patricia/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "patricia"
|
8
|
+
spec.version = Patricia::VERSION
|
9
|
+
spec.authors = ["nounch"]
|
10
|
+
spec.email = [""]
|
11
|
+
spec.summary = "Minimal markup-based Wiki"
|
12
|
+
spec.description = "Renders markup Wiki pages in the browser or \
|
13
|
+
generates static files. Hierarchical tree navigation for all pages is \
|
14
|
+
provided."
|
15
|
+
spec.homepage = ""
|
16
|
+
spec.license = "MIT"
|
17
|
+
|
18
|
+
spec.files = `git ls-files -z`.split("\x0")
|
19
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
20
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
24
|
+
spec.add_development_dependency "rake"
|
25
|
+
end
|
data/spec/app_spec.rb
ADDED
@@ -0,0 +1,195 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'rack/test'
|
3
|
+
require 'yaml'
|
4
|
+
require_relative '../lib/patricia/patricia'
|
5
|
+
require_relative '../lib/patricia/app'
|
6
|
+
require_relative 'test_helpers'
|
7
|
+
|
8
|
+
|
9
|
+
RSpec.configure do |c|
|
10
|
+
c.include TestHelpers
|
11
|
+
end
|
12
|
+
|
13
|
+
|
14
|
+
describe "PatriciaApp::App" do
|
15
|
+
include Rack::Test::Methods
|
16
|
+
|
17
|
+
def app
|
18
|
+
PatriciaApp::App
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "Use default CSS and JavaScript" do
|
22
|
+
|
23
|
+
before(:each) do
|
24
|
+
config = {
|
25
|
+
:css_dir => nil,
|
26
|
+
:js_dir => nil,
|
27
|
+
:tooltips => false,
|
28
|
+
}
|
29
|
+
load_config(config)
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
describe "Rendering markup language Wiki files as HTML page" do
|
34
|
+
|
35
|
+
after(:each) do
|
36
|
+
# Check for the existence of the sidebar
|
37
|
+
expect(last_response.body).to include('toc')
|
38
|
+
expect(last_response.body).to include('p-sidebar')
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
describe "Markup language: Markdown" do
|
43
|
+
it "reads a Markdown file and renders it as HTML upon a GET \
|
44
|
+
request" do
|
45
|
+
get '/colors/blue'
|
46
|
+
expect(last_response).to be_ok
|
47
|
+
expect(last_response.body)
|
48
|
+
.to include('c40445cd-f06a-461c-9008-9ca890d893d1')
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe "Markup language: Org" do
|
53
|
+
it "reads an Org file and renders it as HTML upon a GET request" do
|
54
|
+
get '/colors/bright-orange'
|
55
|
+
expect(last_response).to be_ok
|
56
|
+
expect(last_response.body)
|
57
|
+
.to include('37ed608c-7c67-4a48-99ae-d351b576269d')
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe "Markup language: Textile" do
|
62
|
+
it "reads a Textile file and renders it as HTML upon a GET \
|
63
|
+
request" do
|
64
|
+
get '/colors/dark-yellow'
|
65
|
+
expect(last_response).to be_ok
|
66
|
+
expect(last_response.body)
|
67
|
+
.to include('46dbe50e-be4a-42b9-8796-50ddf302ead0')
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
describe "Markup language: reStructuredText" do
|
72
|
+
it "reads a reStructuredText file and renders it as HTML upon a GET \
|
73
|
+
request" do
|
74
|
+
get '/colors/light-pink'
|
75
|
+
expect(last_response).to be_ok
|
76
|
+
expect(last_response.body)
|
77
|
+
.to include('8c180fdb-6db8-404d-ba7c-0fe8487234a3')
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
|
83
|
+
describe "Return static files" do
|
84
|
+
describe "Static file: PNG image" do
|
85
|
+
it "returns a PNG image uppon a GET request" do
|
86
|
+
get '/colors/red.md'
|
87
|
+
expect(last_response).to be_ok
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
describe "Static file: markup file" do
|
92
|
+
it "returns a Markdown file uppon a GET request" do
|
93
|
+
get '/colors/red.md'
|
94
|
+
expect(last_response).to be_ok
|
95
|
+
end
|
96
|
+
|
97
|
+
it "returns an Org file uppon a GET request" do
|
98
|
+
get '/colors/bright-orange.org'
|
99
|
+
expect(last_response).to be_ok
|
100
|
+
end
|
101
|
+
|
102
|
+
it "returns a Textile file uppon a GET request" do
|
103
|
+
get '/colors/dark-yellow.textile'
|
104
|
+
expect(last_response).to be_ok
|
105
|
+
end
|
106
|
+
|
107
|
+
it "returns a reStructuredText file uppon a GET request" do
|
108
|
+
get '/colors/light-pink.rst'
|
109
|
+
expect(last_response).to be_ok
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
describe "Static file: CSS file" do
|
114
|
+
it "returns a CSS file uppon a GET request" do
|
115
|
+
get '/patricia.css'
|
116
|
+
expect(last_response).to be_ok
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
describe "Static file: JavaScript file" do
|
121
|
+
it "returns a JavaScript file uppon a GET request" do
|
122
|
+
get '/patricia.js'
|
123
|
+
expect(last_response).to be_ok
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
# Diverse
|
129
|
+
|
130
|
+
describe "Page search" do
|
131
|
+
it "returns a list of pages with the search query provided by a \
|
132
|
+
POST request" do
|
133
|
+
post '/patricia/search', {:search_query =>
|
134
|
+
'color', :case_sensitive => false}
|
135
|
+
expect(last_response).to be_ok
|
136
|
+
end
|
137
|
+
|
138
|
+
it "displays links to all the pages found for the last search query \
|
139
|
+
upon a GET request" do
|
140
|
+
get '/patricia/search'
|
141
|
+
expect(last_response).to be_ok
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
end
|
146
|
+
|
147
|
+
describe "Use custom CSS and JavaScript" do
|
148
|
+
before(:each) do
|
149
|
+
config = {
|
150
|
+
:css_dir => File.join(File.dirname(__FILE__),
|
151
|
+
'assets/stylesheets/'),
|
152
|
+
:js_dir => File.join(File.dirname(__FILE__),
|
153
|
+
'assets/javascripts/'),
|
154
|
+
:tooltips => false,
|
155
|
+
}
|
156
|
+
load_config(config)
|
157
|
+
end
|
158
|
+
|
159
|
+
describe "Static file: Custom CSS file" do
|
160
|
+
it "returns a CSS file uppon a GET request" do
|
161
|
+
get '/red.css'
|
162
|
+
expect(last_response).to be_ok
|
163
|
+
expect(last_response.body).to include('background-color')
|
164
|
+
expect(last_response.body).to include('red')
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
describe "Static file: Custom CSS file" do
|
169
|
+
it "returns a CSS file uppon a GET request" do
|
170
|
+
get '/green.css'
|
171
|
+
expect(last_response).to be_ok
|
172
|
+
expect(last_response.body).to include('background-color')
|
173
|
+
expect(last_response.body).to include('green')
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
describe "Static file: Custom JavaScript file" do
|
178
|
+
it "returns a JavaScript file uppon a GET request" do
|
179
|
+
get '/one.js'
|
180
|
+
expect(last_response).to be_ok
|
181
|
+
expect(last_response.body).to include('console.log')
|
182
|
+
expect(last_response.body).to include('one')
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
describe "Static file: Custom JavaScript file" do
|
187
|
+
it "returns a JavaScript file uppon a GET request" do
|
188
|
+
get '/two.js'
|
189
|
+
expect(last_response).to be_ok
|
190
|
+
expect(last_response.body).to include('console.log')
|
191
|
+
expect(last_response.body).to include('two')
|
192
|
+
end
|
193
|
+
end
|
194
|
+
end
|
195
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
console.log('one');
|
@@ -0,0 +1 @@
|
|
1
|
+
console.log('two');
|
@@ -0,0 +1,123 @@
|
|
1
|
+
require 'sinatra'
|
2
|
+
require_relative '../lib/patricia/patricia'
|
3
|
+
|
4
|
+
|
5
|
+
describe "Patricia::Wiki" do
|
6
|
+
before(:all) do
|
7
|
+
pwd = File.dirname(__FILE__)
|
8
|
+
css_dir = File.join(pwd, 'assets/stylesheets/')
|
9
|
+
js_dir = File.join(pwd, 'assets/javascripts/')
|
10
|
+
css = Dir[css_dir + '/**/*.css']
|
11
|
+
.collect { |x| x.sub(/#{css_dir}/, '') }
|
12
|
+
js = Dir[js_dir + '/**/*.js'].collect { |x| x.sub(/#{js_dir}/, '') }
|
13
|
+
markup_dir = File.join(pwd, 'random-test-wiki')
|
14
|
+
@output_dir = File.join(pwd, 'output')
|
15
|
+
|
16
|
+
@patricia = Patricia::Wiki.new(markup_dir, :@output_dir =>
|
17
|
+
@output_dir, :css => css, :js => js)
|
18
|
+
@patricia.render
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "Rendering a markup dir to HTMl and writes it to an output \
|
22
|
+
directory containing static HTML files" do
|
23
|
+
it "contains the correct output for a Markdown input file" do
|
24
|
+
output = File.read(File.join(@output_dir, 'colors/blue/index.html'))
|
25
|
+
expect(output).to include('c40445cd-f06a-461c-9008-9ca890d893d1')
|
26
|
+
expect(output).to include('blue')
|
27
|
+
expect(output).to include('id="toc"')
|
28
|
+
expect(output).to include('id="content"')
|
29
|
+
end
|
30
|
+
|
31
|
+
it "contains the correct output for an Org input file" do
|
32
|
+
output =
|
33
|
+
File.read(File.join(@output_dir, 'colors/bright-orange/index.html'))
|
34
|
+
expect(output).to include('37ed608c-7c67-4a48-99ae-d351b576269d')
|
35
|
+
expect(output).to include('bright')
|
36
|
+
expect(output).to include('orange')
|
37
|
+
expect(output).to include('id="toc"')
|
38
|
+
expect(output).to include('id="content"')
|
39
|
+
end
|
40
|
+
|
41
|
+
it "contains the correct output for an Textile input file" do
|
42
|
+
output =
|
43
|
+
File.read(File.join(@output_dir, 'colors/dark-yellow/index.html'))
|
44
|
+
expect(output).to include('46dbe50e-be4a-42b9-8796-50ddf302ead0')
|
45
|
+
expect(output).to include('yellow')
|
46
|
+
expect(output).to include('id="toc"')
|
47
|
+
expect(output).to include('id="content"')
|
48
|
+
end
|
49
|
+
|
50
|
+
it "contains the correct output for an reStructuredText input file" do
|
51
|
+
output =
|
52
|
+
File.read(File.join(@output_dir, 'colors/light-pink/index.html'))
|
53
|
+
expect(output).to include('8c180fdb-6db8-404d-ba7c-0fe8487234a3')
|
54
|
+
expect(output).to include('pink')
|
55
|
+
expect(output).to include('id="toc"')
|
56
|
+
expect(output).to include('id="content"')
|
57
|
+
end
|
58
|
+
|
59
|
+
it "confirms that there is a static file copied over to the output \
|
60
|
+
directory" do
|
61
|
+
exists = File.exists?(File.join(@output_dir, 'colors/image.png'))
|
62
|
+
expect(exists).to be(true)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
|
67
|
+
describe "Helpers" do
|
68
|
+
describe "Patricia::Wiki#_css_tags" do
|
69
|
+
it "link tag markup for a list of resource paths" do
|
70
|
+
paths =
|
71
|
+
[
|
72
|
+
'javascripts/one.css',
|
73
|
+
'javascripts/two.css',
|
74
|
+
'javascripts/three.css',
|
75
|
+
]
|
76
|
+
css_tags = @patricia._css_tags(paths)
|
77
|
+
output = <<-CSSTAGS
|
78
|
+
|
79
|
+
<link rel="stylesheet" href="javascripts/one.css" type="text/css">
|
80
|
+
<link rel="stylesheet" href="javascripts/two.css" type="text/css">
|
81
|
+
<link rel="stylesheet" href="javascripts/three.css" type="text/css">
|
82
|
+
CSSTAGS
|
83
|
+
expect(css_tags).to eq(output.gsub(/\n$/, ''))
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
describe "Patricia::Wiki#_js_tags" do
|
88
|
+
it "script tag markup for a list of resource paths" do
|
89
|
+
paths =
|
90
|
+
[
|
91
|
+
'stylesheets/one.js',
|
92
|
+
'stylesheets/two.js',
|
93
|
+
'stylesheets/three.js',
|
94
|
+
]
|
95
|
+
js_tags = @patricia._css_tags(paths)
|
96
|
+
output = <<-JSTAGS
|
97
|
+
|
98
|
+
<link rel="stylesheet" href="stylesheets/one.js" type="text/css">
|
99
|
+
<link rel="stylesheet" href="stylesheets/two.js" type="text/css">
|
100
|
+
<link rel="stylesheet" href="stylesheets/three.js" type="text/css">
|
101
|
+
JSTAGS
|
102
|
+
expect(js_tags).to eq(output.gsub(/\n$/, ''))
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
describe "Patricia::Wiki#_without_extension" do
|
107
|
+
it "returns a file path without its extension" do
|
108
|
+
output = @patricia._without_extension('/path/to/file.txt')
|
109
|
+
expected_output = '/path/to/file'
|
110
|
+
expect(output).to eq(expected_output)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
describe "Patricia::Wiki#_without_input_dir" do
|
115
|
+
it "returns a path without the input markup directory" do
|
116
|
+
subpath = '/subpath/to/file'
|
117
|
+
path = File.join(@patricia.input_dir, subpath)
|
118
|
+
output = @patricia._without_input_dir(path)
|
119
|
+
expect(output).to eq(subpath)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
* TODO Orange
|
2
|
+
|
3
|
+
37ed608c-7c67-4a48-99ae-d351b576269d
|
4
|
+
|
5
|
+
This is *orange*.
|
6
|
+
|
7
|
+
** Info :info:knowledge:diverse:
|
8
|
+
|
9
|
+
Orange is a bright color.
|
10
|
+
|
11
|
+
** Code :code:source:programming:
|
12
|
+
|
13
|
+
#+begin_src ruby
|
14
|
+
class Cloud
|
15
|
+
def rain(intensity)
|
16
|
+
puts "Raining with intensity #{speed}"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
#+end_src
|