wikitxt 0.1.7 → 0.1.9

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: 2d7d36aaac23a1d7ba85f0c1b966722702fb988545fa7f4f1550eb0bfad2423e
4
- data.tar.gz: 141d7bdcfe59efb10c1f3be0295c370fc9aaefbb94dd973cadb7968d76c13971
3
+ metadata.gz: d4681e7a7528c3ae501f20cb3b6ba334686e403bd54fbda8c07a62dc2826ec39
4
+ data.tar.gz: de019304d4c52ffcbe8b2cf8462023134842c7b6cd5cb346ee15e96ddd6dff63
5
5
  SHA512:
6
- metadata.gz: 0ad58a00cd43a4ded7bb066000774095e39eb52eba0a5fdd5ee1827868868a7e830efc836d7afaaedc04c0db59b22615e4c604b13a8de71b77a5b25dbdb29319
7
- data.tar.gz: 9b014e93d894663b6ac222361cd01b0906c84666f207917185a190a5cb10477c0a40e292af7f9b8daef6b11cba102309df414639c43c188f8fcd4194ef2db9b5
6
+ metadata.gz: 2bb59f7935afca149a4ea47bb0210eb26051acf04fc1e54037baf196c55fe8892378c3e35022063e5c92d609c1a86eb1ce5814c41900206eddbcdeb0eca87334
7
+ data.tar.gz: a0c849923b6381bad63c91fb7b8070f96075a7c1cab3cca15ce2d4020e201c68e05006e282e7882e1230fc633c8988064aa29fac704e6c1e772108b4c0a987d2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- wikitxt (0.1.7)
4
+ wikitxt (0.1.9)
5
5
  rackup (~> 2.1)
6
6
  sinatra (~> 4.0)
7
7
  thor (~> 1.3)
data/README.md CHANGED
@@ -71,13 +71,13 @@ Internal Images:
71
71
  External Links:
72
72
 
73
73
  ```
74
- #<https://example.com Example Domain>
74
+ https://example.com
75
75
  ```
76
76
 
77
77
  External Images:
78
78
 
79
79
  ```
80
- #<https://example.com/image.png Example Image>
80
+ https://example.com/image.png
81
81
  ```
82
82
 
83
83
  Pre Blocks:
data/lib/wikitxt/node.rb CHANGED
@@ -30,7 +30,7 @@ module Wikitxt
30
30
  def to_html
31
31
  <<~HTML
32
32
  <div class="line">
33
- <div class="dot" style="margin-left: #{attrs[:indent] * 5}px;"></div>
33
+ <div style="margin-left: #{attrs[:indent] * 10}px;"></div>
34
34
  <div class="list">#{Parser::Inline.new(self).to_html}</div>
35
35
  </div>
36
36
  HTML
@@ -45,13 +45,13 @@ module Wikitxt
45
45
 
46
46
  class LinkNode < BaseNode
47
47
  def to_html
48
- " <a href=\"#{attrs[:url]}\">#{CGI.escapeHTML(attrs[:title])}</a> "
48
+ " <a href=\"#{attrs[:url]}\">#{attrs[:title] ? CGI.escapeHTML(attrs[:title]) : attrs[:url]}</a> "
49
49
  end
50
50
  end
51
51
 
52
52
  class ImageNode < BaseNode
53
53
  def to_html
54
- "<img src=\"#{attrs[:url]}\" title=\"#{attrs[:title]}\" />"
54
+ "<img src=\"#{attrs[:url]}\" />"
55
55
  end
56
56
  end
57
57
 
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'uri'
4
+
3
5
  module Wikitxt
4
6
  class Parser
5
7
  class Block
@@ -51,15 +53,14 @@ module Wikitxt
51
53
  scanner = StringScanner.new(parent.attrs[:text])
52
54
 
53
55
  until scanner.eos? do
54
- if result = scanner.scan(/ ?#<.+>/)
56
+ if result = scanner.scan(URI.regexp(["http", "https"]))
55
57
  parent.children << pending if pending
56
58
  pending = nil
57
- match = result.match(/#<(?<title>.*) *(?<url>https?:\/\/.+\.\S+) *(?<title>.*)>/)
58
- if match[:url].match(/\.(png|jpg|jpeg|svg)/)
59
- parent.children << ImageNode.new(url: match[:url], title: match[:title])
59
+ if result.match(/\.(png|jpg|jpeg|svg)/)
60
+ parent.children << ImageNode.new(url: result)
60
61
  next
61
62
  end
62
- parent.children << LinkNode.new(url: match[:url], title: match[:title])
63
+ parent.children << LinkNode.new(url: result)
63
64
  next
64
65
  end
65
66
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Wikitxt
4
- VERSION = "0.1.7"
4
+ VERSION = "0.1.9"
5
5
  end
@@ -31,13 +31,6 @@
31
31
  min-height: 1rem;
32
32
  }
33
33
 
34
- .dot {
35
- width: 5px;
36
- height: 5px;
37
- background: #333;
38
- border-radius: 100%;
39
- }
40
-
41
34
  pre, code {
42
35
  background: #eee;
43
36
  margin: 0;
data/samples/Wikitxt.txt CHANGED
@@ -15,7 +15,7 @@ In summary, it's like this:
15
15
  Text decoration is limited to links.
16
16
  Words you want to emphasize should be expressed as wiki pages.
17
17
 
18
- Absolute url is parsed as external link: #<https://example.com Example Domain>
18
+ Absolute url is parsed as external link: https://example.com
19
19
 
20
20
  #woman.jpg
21
21
 
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.7
4
+ version: 0.1.9
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-13 00:00:00.000000000 Z
11
+ date: 2024-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor