wikitxt 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/html/index.html.erb +3 -0
- data/lib/wikitxt/cli.rb +5 -0
- data/lib/wikitxt/version.rb +1 -1
- metadata +2 -2
- data/samples/index.txt +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae4a4f273cffbd397b527c2059dff661b6086dbf98d12f5edbab7da4e95ef9d2
|
4
|
+
data.tar.gz: c7c4349c4984f0d106a539222fb3582de9ac4a7fae1cebefd48a2c2117888404
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94758439145d08a34e9342fd201b6acd0676b1efc9df8b3c72342dfd9f61b06d6afb492b720945874b8976f8b2234216c3c5f37b4a57c1a659855758207eff06
|
7
|
+
data.tar.gz: 6c1e4560a9b07566d68886aeca57aeb850ea6db5dfee8f22bc088b55d50d6831a92c55bdb2fd346a3be9595b54733a55f7b056fc3372259efe66787efee6acdd
|
data/Gemfile.lock
CHANGED
data/lib/wikitxt/cli.rb
CHANGED
@@ -11,14 +11,19 @@ module Wikitxt
|
|
11
11
|
desc "server [PATH]", "start wiki site"
|
12
12
|
def server(path)
|
13
13
|
files = Dir.glob(File.join(path, "*.txt"))
|
14
|
+
pages = []
|
14
15
|
files.each do |file|
|
15
16
|
text = File.read(file)
|
16
17
|
body = Wikitxt.to_html(text)
|
17
18
|
title = File.basename(file, ".txt")
|
19
|
+
pages << title
|
18
20
|
html = ERB.new(File.read(File.join(__dir__, "../", "html", "layout.html.erb"))).result_with_hash({ body: body, title: title })
|
19
21
|
Dir.mkdir("dist") unless Dir.exist?("dist")
|
20
22
|
File.write(File.join("dist", "#{title}.html"), html)
|
21
23
|
end
|
24
|
+
index = ERB.new(File.read(File.join(__dir__, "../", "html", "index.html.erb"))).result_with_hash({ pages: pages })
|
25
|
+
html = ERB.new(File.read(File.join(__dir__, "../", "html", "layout.html.erb"))).result_with_hash({ body: index, title: "Index" })
|
26
|
+
File.write(File.join("dist", "index.html"), html)
|
22
27
|
images = Dir.glob(File.join(path, "*.{png,jpg,jpeg}"))
|
23
28
|
FileUtils.cp(images, "dist")
|
24
29
|
server = WEBrick::HTTPServer.new :Port => 8000, :DocumentRoot => "dist"
|
data/lib/wikitxt/version.rb
CHANGED
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.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Moeki Kawakami
|
@@ -58,6 +58,7 @@ files:
|
|
58
58
|
- Rakefile
|
59
59
|
- docs/screenshot.png
|
60
60
|
- exe/wikitxt
|
61
|
+
- lib/html/index.html.erb
|
61
62
|
- lib/html/layout.html.erb
|
62
63
|
- lib/wikitxt.rb
|
63
64
|
- lib/wikitxt/cli.rb
|
@@ -66,7 +67,6 @@ files:
|
|
66
67
|
- lib/wikitxt/renderer.rb
|
67
68
|
- lib/wikitxt/version.rb
|
68
69
|
- samples/Wikitxt.txt
|
69
|
-
- samples/index.txt
|
70
70
|
- samples/woman.jpg
|
71
71
|
- wikitxt.gemspec
|
72
72
|
homepage: https://github.com/kawakamimoeki/wikitxt
|
data/samples/index.txt
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
Link to #Wikitxt .
|