martile 0.5.5 → 0.5.7

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
  SHA1:
3
- metadata.gz: ea4f12176f1cff0764da037483033aa613e1c2fc
4
- data.tar.gz: beaa6bd47586fe4b05151f5cfe3e952f01f7b565
3
+ metadata.gz: 4d5dcafb1eb5451255287cc3e5b280b697ba3bd4
4
+ data.tar.gz: 80eb8369b64d549a42556106869e48b49bc0436a
5
5
  SHA512:
6
- metadata.gz: 50169a9c2fbbea01c982450f0d3f339b7e19e222017eab87cb526e70c80422334195f0adc90dc145c5b5d43668709aafc62d553de548df65f02deacc9103a336
7
- data.tar.gz: 1e76c601d3d7a1543ed3f8d46d9fe625b81d5d4ce4dba069229fa000d2be11fbb416ef2517dc58e17b176fe196ac347bec45570d999affdc3754e0e8af28c3d6
6
+ metadata.gz: b5e35f095658e716611f87bd9ad792ee7f4379c548c3f96a8c23e1e7ac2246d9343c43cdb00c6253043eae2e6643c971987349bb738bf3adbae66398a60132ce
7
+ data.tar.gz: 3692bf95bb65b2a69527319c573df636838e8dd9ee1c2764562d48f43d443db12f1306f9bd8cef31782d6ce927df3ec2ddc12311d899d3eecdf6b3ec12fe16d3
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
@@ -1,3 +1,4 @@
1
- hI
2
- >d9^� |/A��Ԁ��=`��5+����s��C��k26>�@���鿚� F��<d|/���&H�p��S��ȷ��є��P��ϼ|F��|�WAy���_.Έ�3xI͗���h�cl�A)*���O2 �ߡ؄��%��w�u
3
- �K�Bݻ�� �*�z{hI�ټq�#d�����4nf�Q_J%A���i��7��X5�gB
1
+ TJ�P��ry�Y(�L��^SQ�wl.r�ugxy�X�bG��YlFF�k[zi��1u�����6L��i
2
+
3
+ 0��J=�U!}
4
+ &1+�٨e�,#��:�²��5X[�n:j�ǿZ��L�
data/lib/martile.rb CHANGED
@@ -8,65 +8,13 @@ require 'dynarex'
8
8
  require 'rdiscount'
9
9
 
10
10
 
11
- # bug fix: 20-Mar-2015: HTML and XML elements should not be filtered out of
12
- # the section() method
13
- # feature: Added the unicode checkbox feature from the Mtlite gem
14
- # bug fix: 14-Mar-2015: A section can now be
15
- # written without an error occurring
16
- # bug fix: 11-Mar-2015: Escapes angle brackets within a code block *before*
17
- # the string is passed to Rexle
18
- # bug fix: A new line character is now added after the creation
19
- # of the code block tags
20
- # bug fix: 01-Mar-2015: code_block_to_html() now only searches strings which
21
- # are outside of angle brackets
22
- # bug fix: 10-Dec-2014: Generation of pre tags using // can now only happen
23
- # when the // appears at the beginning of the line
24
- # feature: 30-Oct-2014: A section can now be between a set of equal signs at
25
- # the beginning of the line
26
- # e.g.
27
- # =
28
- # inside a section
29
- # =
30
- # bug fix: 07-Oct-2014: Smartlink tested for new cases
31
- # feature: 27-Sep-2014: 1. A smartlink can now be used
32
- # e.g. ?link http://someurl?
33
- # 2. pre tags can now be created from 2 pairs of slash
34
- # tags, before and after the pre tag content e.g.
35
- # //
36
- # testing
37
- # //
38
- # feature: 24-Sep-2014: A kind of markdown list can now be created inside
39
- # of <ol> or <ul> tags
40
- # bug fix: 16-Apr-2014: Words containing an underscore should no longer be
41
- # transformed to an underline tag
42
- # bug fix: 03-Apr-2014: XML or HTML elements should now be filtered out
43
- # of any transformations.
44
- # feature: 31-Mar-2014: Added an _underline_ feature.
45
- # bug fix: 01-Mar-2014: A Dynarex_to_table statement between 2 HTML blocks
46
- # is now handled properly.
47
- # bug fix: 01-Mar-2014: Multiple pre tags within a string can now be handled
48
- # feature: 12-Oct-2013: escaped the non-code content of <pre> blocks
49
- # feature: 04-Oct-2013: angle brackets within <pre><code> blocks are
50
- # escaped automatically
51
- # feature: 03-Oct-2013: HTML tags now handled
52
- # bug fix: 25-Sep-2013: removed the new line statement from the join command.
53
- # headings etc. should no longer be split with a new line
54
- # feature: 12-Aug-2013: unordered_list supported
55
- # feature: 31-Mar-2013: markdown inside a martile ordered list
56
- # is now converted to HTML
57
- # bug fix: 02-Nov-2012: within dynarex_to_table URLs containing a
58
- # dash now work
59
- # bug fix: 20-Sep-2012: in ordered_list_to_html it now cuts off from
60
- # parsing headings
61
- # bug fix: 04-Aug-2012; replaced \s with a space in regex patterns
62
- # modified: 28-Mar-2012; Added dynarex_to_table
63
- # modified: 28-Aug-2011; Added escaping of HTML within a code block
64
-
65
11
  class Martile
66
12
 
67
13
  attr_reader :to_html
68
14
 
69
- def initialize(raw_s)
15
+ def initialize(raw_s, ignore_domainlabel: nil)
16
+
17
+ @ignore_domainlabel = ignore_domainlabel
70
18
 
71
19
  s = slashpre raw_s
72
20
  #puts 's : ' + s.inspect
@@ -92,7 +40,7 @@ class Martile
92
40
  #s10 = apply_filter(s9) {|x| section x }
93
41
  s10 = section s9
94
42
 
95
- s11 = apply_filter(s10) {|x| mtlite_utils x }
43
+ s11 = apply_filter(s10) {|x| mtlite_utils x }
96
44
 
97
45
  #puts 's8 : ' + s8.inspect
98
46
 
@@ -230,7 +178,17 @@ class Martile
230
178
  # convert square brackets to unicode check boxes
231
179
  # replaces a [] with a unicode checkbox,
232
180
  # and [x] with a unicode checked checkbox
233
- s.gsub(/\[\s*\]/,'&#9744;').gsub(/\[x\]/,'&#9745;')
181
+ s2 = s.gsub(/\[\s*\]/,'&#9744;').gsub(/\[x\]/,'&#9745;')
182
+
183
+ s2.gsub(/(?:^\[|\s\[)[^\]]+\]\((https?:\/\/[^\s]+)/) do |x|
184
+
185
+ next x if @ignore_domainlabel and x[/#{@ignore_domainlabel}/]
186
+
187
+ s2 = x[/https?:\/\/([^\/]+)/,1].split(/\./)
188
+ r = s2.length >= 3 ? s2[1..-1] : s2
189
+ "%s <span class='domain'>[%s]</span>" % [x, r.join('.')]
190
+ end
191
+
234
192
  end
235
193
 
236
194
  def ordered_list_to_html(s)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: martile
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.5.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  fnr5l+RI/6f8lfxBNgDrktGB/RwPkOyWtyKk1tu9CWgHmptxL0JglikCXg5MzuZI
32
32
  tZzXOvXUoUf1VQ==
33
33
  -----END CERTIFICATE-----
34
- date: 2015-03-20 00:00:00.000000000 Z
34
+ date: 2015-03-21 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rdiscount
metadata.gz.sig CHANGED
@@ -1 +1 @@
1
- DV�����dDt N9��vQc4G5��߷%��6v���fB��jt����n)�fI2D|hK8Z��lT�a������,?�u۴�k�r��L���׶����e�����X
1
+ ������L]���"G��o��M7_��0�"�������g��vR�ɹ�L"�/&� ��� ֻ�0i%S$��33�;��cH��L��,=n� %t �R�T�J��X�����z ��g�ĉ�!��6��6&�c�� �rq|������.��P��`M�ꅱv�zpo�޸lEQ��e6�º�(��'����_w��9B^e@�`�"�י�)*��b͵M�\\�W��/����6B