wikitxt 0.1.3 → 0.1.4

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: d3b04ad6ac8b66425ee7374b81ca20cdcb39611ff5a57751eae0f3a54a5937fb
4
- data.tar.gz: a3f1748ed210269426e8f3a9256fd3b22574427d7f26983c437d773298e9a722
3
+ metadata.gz: ae4a4f273cffbd397b527c2059dff661b6086dbf98d12f5edbab7da4e95ef9d2
4
+ data.tar.gz: c7c4349c4984f0d106a539222fb3582de9ac4a7fae1cebefd48a2c2117888404
5
5
  SHA512:
6
- metadata.gz: a56d2d48bf432221678bfe940d784526d5957593c2ce9712777d10872d0fd5ea814a096aba8efd946501757f88d5131dd4e7acd46c871ef02fcae97e69d4bbc0
7
- data.tar.gz: '0383569f43fa4ea1e8d80fb079c62b1deb49c287d2df5afcac193aa3b8a5d96fc19319bd47030111949743d89d2e3cecbf4a61ee4d6fd70f888eb5f5c79fe763'
6
+ metadata.gz: 94758439145d08a34e9342fd201b6acd0676b1efc9df8b3c72342dfd9f61b06d6afb492b720945874b8976f8b2234216c3c5f37b4a57c1a659855758207eff06
7
+ data.tar.gz: 6c1e4560a9b07566d68886aeca57aeb850ea6db5dfee8f22bc088b55d50d6831a92c55bdb2fd346a3be9595b54733a55f7b056fc3372259efe66787efee6acdd
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- wikitxt (0.1.2)
4
+ wikitxt (0.1.3)
5
5
  thor (~> 1.3)
6
6
  webrick (~> 1.8)
7
7
 
@@ -0,0 +1,3 @@
1
+ <% pages.each do |page| %>
2
+ <div class="line"><a href="/<%= page %>.html"><%= page %></a></div>
3
+ <% end %>
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"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Wikitxt
4
- VERSION = "0.1.3"
4
+ VERSION = "0.1.4"
5
5
  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.3
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 .