teepee 0.7.7 → 0.7.8
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 +4 -4
- data/lib/teepee/actionable-commander.rb +1 -1
- data/lib/teepee/command-parser.rb +6 -2
- data/lib/teepee/commander.rb +19 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d4c46f3b0b0f37c3ce936555bbfae80774c89a0
|
4
|
+
data.tar.gz: d63d77136cf1a0a52c95e23577819427127030a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc847c01ec8104372ae6364e298ddb70895a992a8abc22ed8258dfd3122a12d47913a88133a570f92746660ef9637367ff6430957534f7d51a175bece6cf5db9
|
7
|
+
data.tar.gz: a6cd7debb19dd2cc9bf6e19aabbddd28835f926a9e362ed6374cb1c4910fc9b6339f98f187c5df40c572271ea56ea9f918cad645578acc81b48d510a9ba73000
|
@@ -94,8 +94,6 @@ module Teepee
|
|
94
94
|
"strikethrough",
|
95
95
|
"strikeout"
|
96
96
|
@@commander.del expressions
|
97
|
-
when "i"
|
98
|
-
@@commander.i
|
99
97
|
when "italic",
|
100
98
|
"textit",
|
101
99
|
"it"
|
@@ -222,6 +220,10 @@ module Teepee
|
|
222
220
|
"table-cell",
|
223
221
|
"table_cell"
|
224
222
|
@@commander.table_data expressions
|
223
|
+
when "link",
|
224
|
+
"href",
|
225
|
+
"url"
|
226
|
+
@@commander.link expressions
|
225
227
|
when "user",
|
226
228
|
"user-id",
|
227
229
|
"user_id"
|
@@ -250,6 +252,8 @@ module Teepee
|
|
250
252
|
"bookmark_folder-id",
|
251
253
|
"bookmark-folder_id"
|
252
254
|
@@commander.bookmarks_folder_id first_word_token
|
255
|
+
when "i" # sqrt(-1), not yet supported
|
256
|
+
@@commander.i
|
253
257
|
when "pi"
|
254
258
|
@@commander.pi
|
255
259
|
when "e"
|
data/lib/teepee/commander.rb
CHANGED
@@ -35,6 +35,8 @@
|
|
35
35
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
36
36
|
# POSSIBILITY OF SUCH DAMAGE.
|
37
37
|
|
38
|
+
require 'uri'
|
39
|
+
|
38
40
|
require 'active_support/all'
|
39
41
|
require 'monkey-patch'
|
40
42
|
|
@@ -45,6 +47,12 @@ include ERB::Util
|
|
45
47
|
|
46
48
|
module Teepee
|
47
49
|
class Commander
|
50
|
+
def valid_uri? uri
|
51
|
+
(!! (u = URI.parse(uri))) and not u.scheme.nil?
|
52
|
+
rescue URI::InvalidURIError
|
53
|
+
false
|
54
|
+
end
|
55
|
+
|
48
56
|
def command_error message
|
49
57
|
%{<span style="color: red">[#{message}]</span>}
|
50
58
|
end
|
@@ -314,6 +322,17 @@ module Teepee
|
|
314
322
|
ensure_numeric Math::lgamma(n).first
|
315
323
|
end
|
316
324
|
|
325
|
+
def link expressions
|
326
|
+
uri, *desc = expressions
|
327
|
+
uri = html_safe uri.to_s
|
328
|
+
if not valid_uri? uri
|
329
|
+
command_error "Not a valid URI."
|
330
|
+
else
|
331
|
+
desc = [uri] if desc.empty?
|
332
|
+
html_tag :a, desc, {href: uri}
|
333
|
+
end
|
334
|
+
end
|
335
|
+
|
317
336
|
def link_id id
|
318
337
|
id_command_handler id, :Link
|
319
338
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: teepee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christopher Mark Gore
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|