sparx 0.1.6 → 0.1.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 +4 -4
- data/lib/sparx/inline_processor.rb +5 -2
- data/lib/sparx/parser.rb +1 -0
- data/lib/sparx/version.rb +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6df589ca932c9cc27064c7f2815841c74d09d9fda9b5f1bfe499686df0b7e7f4
|
|
4
|
+
data.tar.gz: d617255b06db7eca4173ff1afc2922db832b2ddb9a84f86f51ff54e9424d0bc5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a54ff727a8b7a8497ad7c49bc248aab4cdd78164b35221a51e7d9841fb92fff2dee02ecaeba6e1573d6c95606ab3cd09efc5075d76ab8a6e59bb73c3a12f3906
|
|
7
|
+
data.tar.gz: f85a71c38409b880aa9bc29046fb94b2b6a8895a9f00a093a66eb85d4f9333f2ef9595f7f40e6b52fcd1e8ac0e3e79a7f544ff99d021b9078bf2cb0256bb7ebb
|
|
@@ -20,6 +20,7 @@ module Sparx
|
|
|
20
20
|
DOUBLE_NEWLINE = /\n\s*\n/.freeze
|
|
21
21
|
FORMAT_PROTECT = /([*\/-]+\[[^\]]*\])/.freeze
|
|
22
22
|
LINK_PROTECT = /(\[[^\]]*\]\(?[^\s\)]+\)?)/.freeze
|
|
23
|
+
HR = /^[ \t]*-{3,}[ \t]*$/.freeze
|
|
23
24
|
private
|
|
24
25
|
def self.process_inline_code(content); content.gsub(/`([^`]+)`/) { "<code>#{$1}</code>" }; end
|
|
25
26
|
def self.process_small_tags(content, recursive_processor = nil); content.gsub(/s\[(.*?)\]/m) { "<small>#{recursive_processor ? recursive_processor.call($1, {}, {}) : $1}</small>" }; end
|
|
@@ -178,14 +179,16 @@ end
|
|
|
178
179
|
def self.wrap_paragraphs_if_needed(text, original_text)
|
|
179
180
|
return text unless original_text.match?(DOUBLE_NEWLINE)
|
|
180
181
|
placeholder_names = (CONTAINER_SPECS.values.map { |s| s[:placeholder] } + LIST_SPECS.values.map { |s| s[:placeholder] }).uniq.join('|')
|
|
181
|
-
block_element_regex = /\A(<(ul|ol|table|blockquote|pre|h\d|div|details|section|img|dl|aside|figure)|(#{placeholder_names}))/i
|
|
182
|
+
block_element_regex = /\A(<(ul|ol|table|blockquote|pre|h\d|div|details|section|img|dl|aside|figure|hr)|(#{placeholder_names}))/i
|
|
182
183
|
text.split(PARAGRAPH_SPLIT).map { |block|
|
|
183
184
|
block.strip!
|
|
184
185
|
block.empty? ? nil : (block =~ block_element_regex ? block : "<p>#{block}</p>")
|
|
185
186
|
}.compact.join("\n\n")
|
|
186
187
|
end
|
|
187
188
|
|
|
188
|
-
|
|
189
|
+
def self.process_horizontal_rules(text)
|
|
190
|
+
text.gsub(HR, "<hr>")
|
|
191
|
+
end
|
|
189
192
|
def self.escape_html_content_except_syntax(text)
|
|
190
193
|
placeholders = {}
|
|
191
194
|
|
data/lib/sparx/parser.rb
CHANGED
|
@@ -52,6 +52,7 @@ end
|
|
|
52
52
|
def self.parse_styles(text, citations, numbered_citations)
|
|
53
53
|
return "" if text.nil?
|
|
54
54
|
text = process_code_blocks(text)
|
|
55
|
+
text = process_horizontal_rules(text)
|
|
55
56
|
text = process_headings(text, citations, numbered_citations)
|
|
56
57
|
text = process_tables(text)
|
|
57
58
|
# KEEP this but FIX the recursion:
|
data/lib/sparx/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sparx
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Steven Garcia
|
|
8
|
+
autorequire:
|
|
8
9
|
bindir: bin
|
|
9
10
|
cert_chain: []
|
|
10
|
-
date:
|
|
11
|
+
date: 2025-12-08 00:00:00.000000000 Z
|
|
11
12
|
dependencies:
|
|
12
13
|
- !ruby/object:Gem::Dependency
|
|
13
14
|
name: rake
|
|
@@ -86,6 +87,7 @@ metadata:
|
|
|
86
87
|
homepage_uri: https://github.com/activestylus/sparx
|
|
87
88
|
source_code_uri: https://github.com/activestylus/sparx
|
|
88
89
|
changelog_uri: https://github.com/activestylus/sparx/blob/main/CHANGELOG.md
|
|
90
|
+
post_install_message:
|
|
89
91
|
rdoc_options: []
|
|
90
92
|
require_paths:
|
|
91
93
|
- lib
|
|
@@ -100,7 +102,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
100
102
|
- !ruby/object:Gem::Version
|
|
101
103
|
version: '0'
|
|
102
104
|
requirements: []
|
|
103
|
-
rubygems_version: 3.
|
|
105
|
+
rubygems_version: 3.0.3.1
|
|
106
|
+
signing_key:
|
|
104
107
|
specification_version: 4
|
|
105
108
|
summary: A friendly markup language for the modern web
|
|
106
109
|
test_files: []
|