clwiki 3.2.6 → 3.3.2

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: 88f3646fc174c186690fa0704bf8eea487dd0b9aa04192d1dada2048215a84b1
4
- data.tar.gz: 19e1e949c5db182f1ccd98069f9a6bbe8b251db3d3cd557d7229c1d4204f0d75
3
+ metadata.gz: a48a499dff277e3edadd047bb0640cbc41ded713baa5699d61af0a8a90fa6c22
4
+ data.tar.gz: 3359f86f9dfe77c17ee77f99c12ba80e11c7819d2a9c5708b096213bda0bdcc2
5
5
  SHA512:
6
- metadata.gz: adb5a002ccaaf9eb214008caf18922f55e4f1c64aea000f46cc15815c7d0b72d54b36ba78440aba9a2e4d95740453c0de1b6a0d5ee04e8f2cc1c99403519e423
7
- data.tar.gz: 7de2d1f85a2f7b42aeea640da0822c6a81a269a4ee7f07d5efacfccee5e649ce801f01fa8bbd585e21fc4265657ffc0ad98f4e605d4754424bab64df591add23
6
+ metadata.gz: 6e527090fcb89733c91ae4345b97756469d54754312b474f80d93b01028a0c26aaeffa0c148fb075d35e0fb21757765052f65cb2be6e300113645d3f6e59706f
7
+ data.tar.gz: cad24e201ee77c7cacdcd223fd3b00bb49ed7f41fc93f4803b85bd193e9d4b4475d40981df180fd27b552dcbb192616c54aadf7bcfb0661811f46baefd20d716
@@ -8,8 +8,21 @@ module ClWiki
8
8
 
9
9
  def self.format_content(content, page)
10
10
  if content
11
+ # I wanted to bring this in, similar to my last change to
12
+ # format_pre_blockquote.rb. But somehow this is impacting how
13
+ # @content.each_line works in convert_newline_to_br leading to
14
+ # unexpected results there. I can't figure it out right now and this
15
+ # isn't that important, so I'm not going to do it right now.
16
+
17
+ # Remove 0 or 1 newline at the front of the block
18
+ # content.gsub!(/\[\]\n?/, '<blockquote>')
19
+
20
+ # Remove 0 to 2 newlines after the block to keep things tidy.
21
+ # content.gsub!(%r{\[/\]\n{0,2}}, '</blockquote>')
22
+
11
23
  content.gsub!(/\[\]/, '<blockquote>')
12
24
  content.gsub!(%r{\[/\]}, '</blockquote>')
25
+
13
26
  content
14
27
  end
15
28
  end
@@ -8,10 +8,21 @@ module ClWiki
8
8
  %r{\[p\].*?\[/p\]}mi
9
9
  end
10
10
 
11
+ # Only matched text is passed in, and whatever is returned is used (i.e. you
12
+ # don't have to use gsub! you're not modifying the page's) ivar of content.
11
13
  def self.format_content(content, page)
12
14
  content = CGI.escapeHTML(content)
13
- content.gsub!(/\[p\]/i, '<blockquote><pre>')
14
- content.gsub!(%r{\[/p\]}i, '</pre></blockquote>')
15
+
16
+ # Remove 0 or 1 newline at the front of the block, to remove the
17
+ # almost-always-there first newline and prevent a gap always at the top of
18
+ # every block, but allow additional newlines if the page really wants
19
+ # newlines at the top of the block
20
+ content.gsub!(/\[p\]\n?/i, '<blockquote><pre>')
21
+
22
+ # Remove 0 to 2 newlines after the block, to remove unnecessary blank
23
+ # lines in most cases, but keep 3 or more, to allow the page to
24
+ # intentionally put some blank space after something if necessary.
25
+ content.gsub!(%r{\[/p\]\n{0,2}}i, '</pre></blockquote>')
15
26
  end
16
27
  end
17
28
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ClWiki
4
- VERSION = '3.2.6'
4
+ VERSION = '3.3.2'
5
5
  end