wikitxt 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +26 -2
- data/README.md +25 -8
- data/lib/wikitxt/cli.rb +10 -8
- data/lib/wikitxt/server.rb +30 -0
- data/lib/wikitxt/version.rb +1 -1
- data/lib/wikitxt/views/index.erb +3 -0
- data/lib/{html/layout.html.erb → wikitxt/views/layout.erb} +1 -0
- data/wikitxt.gemspec +3 -1
- metadata +35 -7
- data/Guardfile +0 -4
- data/lib/html/index.html.erb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47a7f8a4f7884dc145db8acf0da6b5fd903557d7f159ebd52f58caf61e562973
|
4
|
+
data.tar.gz: 9d1ee801e37d098694d897352c320009d88024c13c57d75c13d593ca4eaddf75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d44e3f321afc81084d90310da0b2a538b31db20c32a88113934dfb644844e4626b4e4307813292a756e92570330dea6c77626114386043e08e2dba59fc6aa4e5
|
7
|
+
data.tar.gz: ebcaf7464d7ee0405c03eb6372b522bcfa74a790872c45189fd8a410b85625bd5d18ec2f56e4ce63ace5bc73f272c670a6aec0e00f686930ddd9629447b80ae9
|
data/Gemfile.lock
CHANGED
@@ -1,13 +1,16 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
wikitxt (0.1.
|
4
|
+
wikitxt (0.1.5)
|
5
|
+
rackup (~> 2.1)
|
6
|
+
rerun (~> 0.14)
|
7
|
+
sinatra (~> 4.0)
|
5
8
|
thor (~> 1.3)
|
6
|
-
webrick (~> 1.8)
|
7
9
|
|
8
10
|
GEM
|
9
11
|
remote: https://rubygems.org/
|
10
12
|
specs:
|
13
|
+
base64 (0.2.0)
|
11
14
|
coderay (1.1.3)
|
12
15
|
diff-lcs (1.5.1)
|
13
16
|
ffi (1.16.3)
|
@@ -30,6 +33,8 @@ GEM
|
|
30
33
|
rb-inotify (~> 0.9, >= 0.9.10)
|
31
34
|
lumberjack (1.2.10)
|
32
35
|
method_source (1.0.0)
|
36
|
+
mustermann (3.0.0)
|
37
|
+
ruby2_keywords (~> 0.0.1)
|
33
38
|
nenv (0.3.0)
|
34
39
|
notiffany (0.1.3)
|
35
40
|
nenv (~> 0.1)
|
@@ -37,10 +42,21 @@ GEM
|
|
37
42
|
pry (0.14.2)
|
38
43
|
coderay (~> 1.1)
|
39
44
|
method_source (~> 1.0)
|
45
|
+
rack (3.0.10)
|
46
|
+
rack-protection (4.0.0)
|
47
|
+
base64 (>= 0.1.0)
|
48
|
+
rack (>= 3.0.0, < 4)
|
49
|
+
rack-session (2.0.0)
|
50
|
+
rack (>= 3.0.0)
|
51
|
+
rackup (2.1.0)
|
52
|
+
rack (>= 3)
|
53
|
+
webrick (~> 1.8)
|
40
54
|
rake (13.2.1)
|
41
55
|
rb-fsevent (0.11.2)
|
42
56
|
rb-inotify (0.10.1)
|
43
57
|
ffi (~> 1.0)
|
58
|
+
rerun (0.14.0)
|
59
|
+
listen (~> 3.0)
|
44
60
|
rspec (3.13.0)
|
45
61
|
rspec-core (~> 3.13.0)
|
46
62
|
rspec-expectations (~> 3.13.0)
|
@@ -54,10 +70,18 @@ GEM
|
|
54
70
|
diff-lcs (>= 1.2.0, < 2.0)
|
55
71
|
rspec-support (~> 3.13.0)
|
56
72
|
rspec-support (3.13.1)
|
73
|
+
ruby2_keywords (0.0.5)
|
57
74
|
shellany (0.0.1)
|
75
|
+
sinatra (4.0.0)
|
76
|
+
mustermann (~> 3.0)
|
77
|
+
rack (>= 3.0.0, < 4)
|
78
|
+
rack-protection (= 4.0.0)
|
79
|
+
rack-session (>= 2.0.0, < 3)
|
80
|
+
tilt (~> 2.0)
|
58
81
|
spoon (0.0.6)
|
59
82
|
ffi
|
60
83
|
thor (1.3.1)
|
84
|
+
tilt (2.3.0)
|
61
85
|
webrick (1.8.1)
|
62
86
|
|
63
87
|
PLATFORMS
|
data/README.md
CHANGED
@@ -8,6 +8,23 @@ Most lightweight markup language and personal knowledge manager or wiki platform
|
|
8
8
|
|
9
9
|
![screenshot](https://github.com/kawakamimoeki/wikitxt/blob/main/docs/screenshot.png)
|
10
10
|
|
11
|
+
Wikitxt is a lightweight markup language and a tool for composing Wiki . The syntax of #Wikitxt can be converted to HTML and viewed in a browser. When converted to HTML, files can be interlinked.
|
12
|
+
|
13
|
+
Wikitxt is based on the format of lists and paragraphs. Most information can be expressed in list format, and the choice between lists and paragraphs is always changing as you write.
|
14
|
+
|
15
|
+
Text decoration is limited to mutual links using hashtags. By utilizing the decoration of mutual links, you can intentionally increase the number of pages in the wiki.
|
16
|
+
|
17
|
+
In summary, it's like this:
|
18
|
+
|
19
|
+
- Lists
|
20
|
+
- Based on the idea that most information can be expressed in lists
|
21
|
+
- Paragraphs
|
22
|
+
- Paragraphs always have the potential to be listed. They can easily be converted to lists.
|
23
|
+
- Paragraphs can also serve as headings.
|
24
|
+
- Mutual Links
|
25
|
+
- Text decoration is limited to links.
|
26
|
+
- Words you want to emphasize should be expressed as wiki pages.
|
27
|
+
|
11
28
|
## Installation
|
12
29
|
|
13
30
|
Install the gem and add to the application's Gemfile by executing:
|
@@ -73,12 +90,6 @@ Wikitxt.to_html(text)
|
|
73
90
|
|
74
91
|
### Server
|
75
92
|
|
76
|
-
`wiki/index.txt`:
|
77
|
-
|
78
|
-
```
|
79
|
-
Link to #sample .
|
80
|
-
```
|
81
|
-
|
82
93
|
`wiki/sample.txt`:
|
83
94
|
|
84
95
|
```
|
@@ -101,10 +112,16 @@ Cras at tortor urna. Maecenas nec iaculis nulla.
|
|
101
112
|
```
|
102
113
|
|
103
114
|
```
|
104
|
-
$ wikitxt s
|
115
|
+
$ wikitxt s wiki
|
105
116
|
```
|
106
117
|
|
107
|
-
Access to http://localhost:
|
118
|
+
Access to http://localhost:4567 .
|
119
|
+
|
120
|
+
### Build
|
121
|
+
|
122
|
+
```
|
123
|
+
$ wikitxt build wiki
|
124
|
+
```
|
108
125
|
|
109
126
|
## Development
|
110
127
|
|
data/lib/wikitxt/cli.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require "thor"
|
2
|
-
require 'webrick'
|
3
2
|
require 'erb'
|
4
3
|
require 'fileutils'
|
5
4
|
|
@@ -7,9 +6,15 @@ module Wikitxt
|
|
7
6
|
class CLI < Thor
|
8
7
|
package_name "wikitxt"
|
9
8
|
map "s" => :server
|
9
|
+
map "b" => :build
|
10
10
|
|
11
|
-
desc "server
|
11
|
+
desc "server PATH", "start wiki site"
|
12
12
|
def server(path)
|
13
|
+
system("DIR=\"#{path}\" ruby #{File.join(__dir__, "server.rb")}")
|
14
|
+
end
|
15
|
+
|
16
|
+
desc "build PATH", "build wiki site"
|
17
|
+
def build(path)
|
13
18
|
files = Dir.glob(File.join(path, "*.txt"))
|
14
19
|
pages = []
|
15
20
|
files.each do |file|
|
@@ -17,18 +22,15 @@ module Wikitxt
|
|
17
22
|
body = Wikitxt.to_html(text)
|
18
23
|
title = File.basename(file, ".txt")
|
19
24
|
pages << title
|
20
|
-
html = ERB.new(File.read(File.join(__dir__, "
|
25
|
+
html = ERB.new(File.read(File.join(__dir__, "views", "layout.erb"))).result_with_hash({ body: body, title: title })
|
21
26
|
Dir.mkdir("dist") unless Dir.exist?("dist")
|
22
27
|
File.write(File.join("dist", "#{title}.html"), html)
|
23
28
|
end
|
24
|
-
index = ERB.new(File.read(File.join(__dir__, "
|
25
|
-
html = ERB.new(File.read(File.join(__dir__, "
|
29
|
+
index = ERB.new(File.read(File.join(__dir__, "views", "index.erb"))).result_with_hash({ pages: pages })
|
30
|
+
html = ERB.new(File.read(File.join(__dir__, "views", "layout.erb"))).result_with_hash({ body: index, title: "Index" })
|
26
31
|
File.write(File.join("dist", "index.html"), html)
|
27
32
|
images = Dir.glob(File.join(path, "*.{png,jpg,jpeg}"))
|
28
33
|
FileUtils.cp(images, "dist")
|
29
|
-
server = WEBrick::HTTPServer.new :Port => 8000, :DocumentRoot => "dist"
|
30
|
-
trap 'INT' do server.shutdown end
|
31
|
-
server.start
|
32
34
|
end
|
33
35
|
end
|
34
36
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'sinatra'
|
2
|
+
require 'wikitxt'
|
3
|
+
|
4
|
+
get "/" do
|
5
|
+
pages = Dir.glob(File.join(ENV["DIR"], "*.txt")).map { File.basename(_1, ".txt") }
|
6
|
+
title = "Index"
|
7
|
+
body = ERB.new(File.read(File.join(__dir__, "views", "index.erb"))).result_with_hash({ pages: pages })
|
8
|
+
ERB.new(File.read(File.join(__dir__, "views", "layout.erb"))).result_with_hash({ body: body, title: title })
|
9
|
+
end
|
10
|
+
|
11
|
+
get "/:page" do
|
12
|
+
page = params[:page]
|
13
|
+
|
14
|
+
if page.match?(/\.(png|jpeg|jpg)/)
|
15
|
+
pass unless File.exist?(File.join(ENV["DIR"], page))
|
16
|
+
send_file File.join(ENV["DIR"], page)
|
17
|
+
end
|
18
|
+
|
19
|
+
page = File.basename(page, ".html")
|
20
|
+
file = File.join(ENV["DIR"], "#{page}.txt")
|
21
|
+
pass unless File.exist?(file)
|
22
|
+
text = File.read(file)
|
23
|
+
title = File.basename(file, ".txt")
|
24
|
+
body = Wikitxt.to_html(text)
|
25
|
+
ERB.new(File.read(File.join(__dir__, "views", "layout.erb"))).result_with_hash({ body: body, title: title })
|
26
|
+
end
|
27
|
+
|
28
|
+
not_found do
|
29
|
+
ERB.new(File.read(File.join(__dir__, "views", "layout.erb"))).result_with_hash({ body: "Not found", title: "Not found" })
|
30
|
+
end
|
data/lib/wikitxt/version.rb
CHANGED
data/wikitxt.gemspec
CHANGED
@@ -27,6 +27,8 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.require_paths = ["lib"]
|
28
28
|
|
29
29
|
spec.add_dependency "thor", "~> 1.3"
|
30
|
-
spec.add_dependency "
|
30
|
+
spec.add_dependency "sinatra", "~> 4.0"
|
31
|
+
spec.add_dependency "rerun", "~> 0.14"
|
32
|
+
spec.add_dependency "rackup", "~> 2.1"
|
31
33
|
|
32
34
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wikitxt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Moeki Kawakami
|
@@ -25,19 +25,47 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: sinatra
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '4.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '4.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rerun
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.14'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.14'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rackup
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.1'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.1'
|
41
69
|
description: Most lightweight markup language and personal knowledge manager or wiki
|
42
70
|
platform.
|
43
71
|
email:
|
@@ -52,20 +80,20 @@ files:
|
|
52
80
|
- CODE_OF_CONDUCT.md
|
53
81
|
- Gemfile
|
54
82
|
- Gemfile.lock
|
55
|
-
- Guardfile
|
56
83
|
- LICENSE.txt
|
57
84
|
- README.md
|
58
85
|
- Rakefile
|
59
86
|
- docs/screenshot.png
|
60
87
|
- exe/wikitxt
|
61
|
-
- lib/html/index.html.erb
|
62
|
-
- lib/html/layout.html.erb
|
63
88
|
- lib/wikitxt.rb
|
64
89
|
- lib/wikitxt/cli.rb
|
65
90
|
- lib/wikitxt/node.rb
|
66
91
|
- lib/wikitxt/parser.rb
|
67
92
|
- lib/wikitxt/renderer.rb
|
93
|
+
- lib/wikitxt/server.rb
|
68
94
|
- lib/wikitxt/version.rb
|
95
|
+
- lib/wikitxt/views/index.erb
|
96
|
+
- lib/wikitxt/views/layout.erb
|
69
97
|
- samples/Wikitxt.txt
|
70
98
|
- samples/woman.jpg
|
71
99
|
- wikitxt.gemspec
|
data/Guardfile
DELETED
data/lib/html/index.html.erb
DELETED