wikitxt 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2eaeacc8b39a05eb00223418346c4e191e990f22e8a5dac767af324c29b19ae9
4
- data.tar.gz: b791a01e0a07f3de3d698d9daa6a9ce2279d574dbcd2a651c40bc26588ca8dba
3
+ metadata.gz: b4db91ffe011ebcf64fb5bccb168e9385bc51671a20d3ea279795aecd51110cb
4
+ data.tar.gz: f74c13b996a67e1868ece5513b13bd0fe9b9a573d94606b8ac2219a2a538fd03
5
5
  SHA512:
6
- metadata.gz: b81ff24495f1ae4db65a5705395fbc7fa875687c119a9f8614b7a020cb2f7b7531c50c076fc7459d5d41243c8c65c6d457d6556d918f05979ae4cafedcf8290f
7
- data.tar.gz: 2fb36c6754f466dbeca2495fea46e03935f3031453a593e36914610adb53c5f6de81e331f0526ddbdcc2de3b7591fa1a503a3408cbacfac21200d7048e0a1705
6
+ metadata.gz: 47e59b7e06134f35ab00470e21421ea1f1ee1d9f99ef5f1655e1967bfa81145c7ff84a16067be9f7e4e33e99908b9ce0f23cefa532b1862832729dc6c0a05300
7
+ data.tar.gz: cd1e31f37452b34e0d27f33b632e80645ea230429df5c24f936de3ad193a1286e59ea3ce706c87f1c9ab132370a35637350b6eaea938a06436c234570f3a7085
data/Gemfile CHANGED
@@ -8,3 +8,7 @@ gemspec
8
8
  gem "rake", "~> 13.0"
9
9
 
10
10
  gem "rspec", "~> 3.0"
11
+
12
+ gem "guard"
13
+
14
+ gem "guard-process"
data/Gemfile.lock CHANGED
@@ -10,9 +10,37 @@ GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
12
  base64 (0.2.0)
13
+ coderay (1.1.3)
13
14
  diff-lcs (1.5.1)
15
+ ffi (1.16.3)
16
+ formatador (1.1.0)
17
+ guard (2.18.1)
18
+ formatador (>= 0.2.4)
19
+ listen (>= 2.7, < 4.0)
20
+ lumberjack (>= 1.0.12, < 2.0)
21
+ nenv (~> 0.1)
22
+ notiffany (~> 0.0)
23
+ pry (>= 0.13.0)
24
+ shellany (~> 0.0)
25
+ thor (>= 0.18.1)
26
+ guard-compat (1.2.1)
27
+ guard-process (1.2.1)
28
+ guard-compat (~> 1.2, >= 1.2.1)
29
+ spoon (~> 0.0.1)
30
+ listen (3.9.0)
31
+ rb-fsevent (~> 0.10, >= 0.10.3)
32
+ rb-inotify (~> 0.9, >= 0.9.10)
33
+ lumberjack (1.2.10)
34
+ method_source (1.0.0)
14
35
  mustermann (3.0.0)
15
36
  ruby2_keywords (~> 0.0.1)
37
+ nenv (0.3.0)
38
+ notiffany (0.1.3)
39
+ nenv (~> 0.1)
40
+ shellany (~> 0.0)
41
+ pry (0.14.2)
42
+ coderay (~> 1.1)
43
+ method_source (~> 1.0)
16
44
  rack (3.0.10)
17
45
  rack-protection (4.0.0)
18
46
  base64 (>= 0.1.0)
@@ -20,6 +48,9 @@ GEM
20
48
  rack-session (2.0.0)
21
49
  rack (>= 3.0.0)
22
50
  rake (13.2.1)
51
+ rb-fsevent (0.11.2)
52
+ rb-inotify (0.10.1)
53
+ ffi (~> 1.0)
23
54
  rspec (3.13.0)
24
55
  rspec-core (~> 3.13.0)
25
56
  rspec-expectations (~> 3.13.0)
@@ -34,20 +65,26 @@ GEM
34
65
  rspec-support (~> 3.13.0)
35
66
  rspec-support (3.13.1)
36
67
  ruby2_keywords (0.0.5)
68
+ shellany (0.0.1)
37
69
  sinatra (4.0.0)
38
70
  mustermann (~> 3.0)
39
71
  rack (>= 3.0.0, < 4)
40
72
  rack-protection (= 4.0.0)
41
73
  rack-session (>= 2.0.0, < 3)
42
74
  tilt (~> 2.0)
75
+ spoon (0.0.6)
76
+ ffi
43
77
  thor (1.3.1)
44
78
  tilt (2.3.0)
45
79
  webrick (1.8.1)
46
80
 
47
81
  PLATFORMS
48
82
  arm64-darwin-22
83
+ x86_64-linux
49
84
 
50
85
  DEPENDENCIES
86
+ guard
87
+ guard-process
51
88
  rake (~> 13.0)
52
89
  rspec (~> 3.0)
53
90
  wikitxt!
data/Guardfile ADDED
@@ -0,0 +1,4 @@
1
+ guard :process, name: 's', command: "exe/wikitxt s samples" do
2
+ watch('lib/html/layout.html.erb')
3
+ watch('lib/wikitxt/cli')
4
+ end
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Wikitxt
2
2
 
3
- Most lightweight wiki writen by plain text.
3
+ Most lightweight wiki written by plain text.
4
4
 
5
5
  ## Installation
6
6
 
@@ -0,0 +1,45 @@
1
+ <head>
2
+ <meta charset="UTF-8" />
3
+ </head>
4
+
5
+ <style>
6
+ body {
7
+ background: #ddd;
8
+ padding: 1rem;
9
+ }
10
+
11
+ .content {
12
+ max-width: 800px;
13
+ margin: 0 auto;
14
+ padding: 2rem;
15
+ background: #fff;
16
+ border-radius: 0.5rem;
17
+ }
18
+
19
+ .title {
20
+ margin-bottom: 2rem;
21
+ font-size: 2rem;
22
+ font-weight: bold;
23
+ }
24
+
25
+ .line {
26
+ display: flex;
27
+ align-items: center;
28
+ gap: 8px;
29
+ min-height: 1rem;
30
+ }
31
+
32
+ .dot {
33
+ width: 5px;
34
+ height: 5px;
35
+ background: #333;
36
+ border-radius: 100%;
37
+ }
38
+ </style>
39
+
40
+ <body>
41
+ <div class="content">
42
+ <div class="title"><%= title %></div>
43
+ <%= body %>
44
+ </div>
45
+ </body>
data/lib/wikitxt/cli.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require "thor"
2
2
  require 'webrick'
3
+ require 'erb'
3
4
 
4
5
  module Wikitxt
5
6
  class CLI < Thor
@@ -11,11 +12,11 @@ module Wikitxt
11
12
  files = Dir.glob(File.join(path, "*.txt"))
12
13
  files.each do |file|
13
14
  text = File.read(file)
14
- html = Wikitxt.to_html(text)
15
+ body = Wikitxt.to_html(text)
16
+ title = File.basename(file, ".txt")
17
+ html = ERB.new(File.read(File.join(__dir__, "../", "html", "layout.html.erb"))).result_with_hash({ body: body, title: title })
15
18
  Dir.mkdir("dist") unless Dir.exist?("dist")
16
- File.open(File.join("dist", "#{File.basename(file, ".txt")}.html"), "w+") do |f|
17
- f.write(html)
18
- end
19
+ File.write(File.join("dist", "#{title}.html"), html)
19
20
  end
20
21
  server = WEBrick::HTTPServer.new :Port => 8000, :DocumentRoot => "dist"
21
22
  trap 'INT' do server.shutdown end
data/lib/wikitxt/node.rb CHANGED
@@ -45,7 +45,7 @@ module Wikitxt
45
45
 
46
46
  class LinkNode < BaseNode
47
47
  def to_html
48
- "<a href=\"/#{attrs[:page]}.html\">#{attrs[:page]}</a>"
48
+ " <a href=\"/#{attrs[:page]}.html\">#{attrs[:page]}</a>"
49
49
  end
50
50
  end
51
51
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Wikitxt
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
data/samples/index.txt CHANGED
@@ -1 +1,3 @@
1
1
  Link to #sample .
2
+
3
+ これはテストです。
data/wikitxt.gemspec CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
8
8
  spec.authors = ["Moeki Kawakami"]
9
9
  spec.email = ["moeki.kawakami@icloud.com"]
10
10
 
11
- spec.summary = "Most lightweight wiki writen by plain text."
12
- spec.description = "Most lightweight wiki writen by plain text."
11
+ spec.summary = "Most lightweight wiki written by plain text."
12
+ spec.description = "Most lightweight wiki written by plain text."
13
13
  spec.homepage = "https://github.com/kawakamimoeki/wikitxt"
14
14
  spec.license = "MIT"
15
15
  spec.required_ruby_version = ">= 2.6.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wikitxt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Moeki Kawakami
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-04-12 00:00:00.000000000 Z
11
+ date: 2024-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra
@@ -52,7 +52,7 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.8'
55
- description: Most lightweight wiki writen by plain text.
55
+ description: Most lightweight wiki written by plain text.
56
56
  email:
57
57
  - moeki.kawakami@icloud.com
58
58
  executables:
@@ -65,10 +65,12 @@ files:
65
65
  - CODE_OF_CONDUCT.md
66
66
  - Gemfile
67
67
  - Gemfile.lock
68
+ - Guardfile
68
69
  - LICENSE.txt
69
70
  - README.md
70
71
  - Rakefile
71
72
  - exe/wikitxt
73
+ - lib/html/layout.html.erb
72
74
  - lib/wikitxt.rb
73
75
  - lib/wikitxt/cli.rb
74
76
  - lib/wikitxt/node.rb
@@ -102,5 +104,5 @@ requirements: []
102
104
  rubygems_version: 3.3.26
103
105
  signing_key:
104
106
  specification_version: 4
105
- summary: Most lightweight wiki writen by plain text.
107
+ summary: Most lightweight wiki written by plain text.
106
108
  test_files: []