clwiki 3.3.0 → 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: 051dbf9e39cf68f41e5c69a886a10557804c72e6e5db49ea07960c6276da83f1
4
- data.tar.gz: 467f17ad5a7c80f357507c4db86c5d508cb9206508fd0f2ea91ebfc5af56f118
3
+ metadata.gz: a48a499dff277e3edadd047bb0640cbc41ded713baa5699d61af0a8a90fa6c22
4
+ data.tar.gz: 3359f86f9dfe77c17ee77f99c12ba80e11c7819d2a9c5708b096213bda0bdcc2
5
5
  SHA512:
6
- metadata.gz: d5e2a0a569e6d24a7a80b19c78586a76fef848fe68415c6b22278fd008fcd90cb4af631a5fb87ee29e6c7f46d5071e286aad157552c39d74a1e1791c21410b03
7
- data.tar.gz: 5706ffbcb5220cb91a44eee7005eb5a9c14af1f89ae33d67f614ff688663def87610d66a987f6c2323c0fff48d4e8cc5b4b0a28c0cc0b1b354cdba6ce5a32592
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,12 +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\]\n/i, '<blockquote><pre>')
14
- content.gsub!(/\[p\]/i, '<blockquote><pre>')
15
- content.gsub!(%r{\[/p\]\n}i, '</pre></blockquote>')
16
- 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>')
17
26
  end
18
27
  end
19
28
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ClWiki
4
- VERSION = '3.3.0'
4
+ VERSION = '3.3.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clwiki
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.0
4
+ version: 3.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - chrismo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-22 00:00:00.000000000 Z
11
+ date: 2024-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bcrypt