mtlite 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/mtlite.rb +24 -10
- metadata +36 -31
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8ad72548b1d62cf4ae3af016f02824293b60dd03562902ffe36219df39197ffb
|
4
|
+
data.tar.gz: 5fb92f9b5a325a5638027ae704f3d33b1cf75ee05227268206c9b5f431bd9ad8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f364bdc994d39b8fb0202830ff74af6ebf5b10e72d66d447e132871158fd9fdb130a3f0441781818550f23f93604bb781aa361d96d26dda8138d6fc34201afb
|
7
|
+
data.tar.gz: b4ea6f85c444e48ef708320d67bd84bc896c45e187ffe9dbba0880c0cb05c306baeec0d7e2704f395b9a41b979d3818dbf393e701349951192b88176427ccd53
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/mtlite.rb
CHANGED
@@ -19,7 +19,7 @@ class MTLite
|
|
19
19
|
|
20
20
|
end
|
21
21
|
|
22
|
-
def to_html()
|
22
|
+
def to_html(para: false, ignore_domainlabel: false)
|
23
23
|
|
24
24
|
raw_msg = @raw_msg.clone
|
25
25
|
# if it looks like an MtLite list make it an MtLite list
|
@@ -37,11 +37,12 @@ class MTLite
|
|
37
37
|
# convert square brackets to unicode check boxes
|
38
38
|
# replaces a [] with a unicode checkbox,
|
39
39
|
# and [x] with a unicode checked checkbox
|
40
|
-
raw_msg = raw_msg.gsub(/\[\s*\]/,'☐').gsub(/\[x\]/,'☑')
|
40
|
+
raw_msg = raw_msg.gsub(/\[\s*\](?= )/,'☐').gsub(/\[x\]/,'☑')
|
41
41
|
|
42
42
|
# convert fractions using their associated unicode character
|
43
43
|
# i.e. 1/4, 1/2, 3/4
|
44
|
-
raw_msg = raw_msg.gsub('
|
44
|
+
raw_msg = raw_msg.gsub('\b1/4\b','¼').gsub('\b1/2\b','½')\
|
45
|
+
.gsub('\b3/4\b','¾')
|
45
46
|
|
46
47
|
# add strikethru to completed items
|
47
48
|
# e.g. -milk cow- becomes <del>milk cow</del>
|
@@ -49,11 +50,15 @@ class MTLite
|
|
49
50
|
x.sub(/-([&\w]+.*\w+)-/,'<del>\1</del>')
|
50
51
|
end
|
51
52
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
53
|
+
unless ignore_domainlabel then
|
54
|
+
|
55
|
+
# append a domain label after the URL
|
56
|
+
raw_msg.gsub!(/(?:^\[|\s\[)[^\]]+\]\((https?:\/\/[^\s]+)/) do |x|
|
57
|
+
s2 = x[/https?:\/\/([^\/]+)/,1].split(/\./)
|
58
|
+
r = s2.length >= 3 ? s2[1..-1] : s2
|
59
|
+
"%s [%s]" % [x, r.join('.')]
|
60
|
+
end
|
61
|
+
|
57
62
|
end
|
58
63
|
|
59
64
|
# generate html lists from mtlite 1-liner lists
|
@@ -73,11 +78,20 @@ class MTLite
|
|
73
78
|
|
74
79
|
end
|
75
80
|
|
76
|
-
msg = RDiscount.new(raw_msg).to_html
|
81
|
+
msg = RDiscount.new(raw_msg).to_html
|
82
|
+
msg.gsub!(/<\/?p[^>]*>/,'') unless para
|
77
83
|
|
78
84
|
regex = %r([\w\-/?=.#\(\)]+)
|
79
85
|
# generate anchor tags for URLs which don't have anchor tags
|
80
86
|
msg.gsub!(/(?:^(https?:#{regex})|\s(https?:#{regex}))/,' <a href="\2">\2</a>')
|
87
|
+
|
88
|
+
msg.gsub!(/(?<=\>)https?:#{regex}/) do |x|
|
89
|
+
url = x
|
90
|
+
url2 = url.sub(/^https?:\/\//,'').sub(/^www\./,'')
|
91
|
+
url3 = url2.length > 33 ? url2[0..33] + '...' : url2
|
92
|
+
#" <a href='#{url}'>#{url3}</a>"
|
93
|
+
end
|
94
|
+
|
81
95
|
# add the target attribute to make all hyperlinks open in a new browser tab
|
82
96
|
msg.gsub!(/<a /,'<a target="_blank" ')
|
83
97
|
|
@@ -128,4 +142,4 @@ class MTLite
|
|
128
142
|
|
129
143
|
end
|
130
144
|
|
131
|
-
end
|
145
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mtlite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -10,28 +10,32 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
/
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
13
|
+
MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
|
14
|
+
YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMjEwMjIzMTQ1MzMwWhcN
|
15
|
+
MjIwMjIzMTQ1MzMwWjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
|
16
|
+
cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQDPICvX
|
17
|
+
ekFtCC7T84fjH1kM3eAgM4M8+0D/nWMUTL+aZjmNJUhnknZLGX+ltHYMoj+1jX8E
|
18
|
+
x0HJqxkKpbOmr1oIj6/iF6Ns1bOamtn9qin5fpvfk6Db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tV9hBiE8GRODZL0uFwL4Cl2EjDBAIbjtqh2fUy1T6A/u7Y23eVL+cnelk/YT
|
34
|
+
f6uxrTojqd8rUrVvqz0lhaTd1eoT6kd/u2r7YbzLnvraDnBwiuFAPticmw7JuVpZ
|
35
|
+
RpkfFZne43vM6SRQRvmVREEMpk57Mub1ccA9v5eElBuZbfyEO5eMYSc88DkxHCkr
|
36
|
+
sfZbXuL/o5TgPyPL7UYvUyoJ
|
33
37
|
-----END CERTIFICATE-----
|
34
|
-
date:
|
38
|
+
date: 2021-02-23 00:00:00.000000000 Z
|
35
39
|
dependencies:
|
36
40
|
- !ruby/object:Gem::Dependency
|
37
41
|
name: rdiscount
|
@@ -57,24 +61,24 @@ dependencies:
|
|
57
61
|
name: embiggen
|
58
62
|
requirement: !ruby/object:Gem::Requirement
|
59
63
|
requirements:
|
60
|
-
- - "~>"
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: '0.1'
|
63
64
|
- - ">="
|
64
65
|
- !ruby/object:Gem::Version
|
65
66
|
version: 0.1.0
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0.1'
|
66
70
|
type: :runtime
|
67
71
|
prerelease: false
|
68
72
|
version_requirements: !ruby/object:Gem::Requirement
|
69
73
|
requirements:
|
70
|
-
- - "~>"
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
version: '0.1'
|
73
74
|
- - ">="
|
74
75
|
- !ruby/object:Gem::Version
|
75
76
|
version: 0.1.0
|
77
|
+
- - "~>"
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0.1'
|
76
80
|
description:
|
77
|
-
email:
|
81
|
+
email: digital.robertson@gmail.com
|
78
82
|
executables: []
|
79
83
|
extensions: []
|
80
84
|
extra_rdoc_files: []
|
@@ -100,8 +104,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
104
|
version: '0'
|
101
105
|
requirements: []
|
102
106
|
rubyforge_project:
|
103
|
-
rubygems_version: 2.
|
107
|
+
rubygems_version: 2.7.10
|
104
108
|
signing_key:
|
105
109
|
specification_version: 4
|
106
|
-
summary:
|
110
|
+
summary: Martile Lite generates HTML ideally from 1 line of a condensed kind of markdown
|
111
|
+
language.
|
107
112
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|