darkmouun 2.1.0 → 2.1.1
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a2c3b66f4fb9ab93a3c8671b722b770baed774650dfc2ce0d84d300198d5c30
|
4
|
+
data.tar.gz: 98b7467119e5af5bd55f0b5e309db72fb3063a40eb2577a907319b87d2ddd24c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 818936002fd0553e472bbf6cf3b533d80659729db7c066dbed502c42c44c17497a0e83722ae86b887b1575c68c2e4546d75ff1775f0e4fc80a0ecb90f6d78904
|
7
|
+
data.tar.gz: 3ce4f78657b946b1f23f8f73c4eb218ebc77a7ec70cf58387ab005f2357e96b481fbee0b3daca212bcf129837a36ee5ae4a7f235ab4d72c428fcc7ea2bcc6a69
|
@@ -1,11 +1,18 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
|
1
|
+
# -*- coding: utf-8; frozen_string_literal: true -*-
|
2
|
+
#
|
3
|
+
#--
|
4
|
+
# Copyright (C) 2009-2019 Thomas Leitner <t_leitner@gmx.at>
|
5
|
+
#
|
6
|
+
# This file is part of kramdown which is licensed under the MIT.
|
7
|
+
#++
|
8
|
+
#
|
4
9
|
|
5
10
|
module Kramdown
|
6
11
|
module Parser
|
7
12
|
class Kramdown
|
8
13
|
|
14
|
+
# Parse the string +str+ and extract all attributes and add all found attributes to the hash
|
15
|
+
# +opts+.
|
9
16
|
def parse_attribute_list(str, opts)
|
10
17
|
return if str.strip.empty? || str.strip == ':'
|
11
18
|
style_attr = []
|
@@ -16,8 +23,7 @@ module Kramdown
|
|
16
23
|
elsif id_and_or_class
|
17
24
|
id_and_or_class.scan(ALD_TYPE_ID_OR_CLASS).each do |id_attr, class_attr|
|
18
25
|
if class_attr
|
19
|
-
opts[IAL_CLASS_ATTR] =
|
20
|
-
opts[IAL_CLASS_ATTR].lstrip!
|
26
|
+
opts[IAL_CLASS_ATTR] = "#{opts[IAL_CLASS_ATTR]} #{class_attr}".lstrip
|
21
27
|
else
|
22
28
|
opts['id'] = id_attr
|
23
29
|
end
|
@@ -34,7 +40,7 @@ module Kramdown
|
|
34
40
|
end
|
35
41
|
end
|
36
42
|
(opts['style'] = style_attr.join(' ')) unless style_attr.empty?
|
37
|
-
warning("No or invalid attributes found in IAL/ALD content: #{str}") if attrs.
|
43
|
+
warning("No or invalid attributes found in IAL/ALD content: #{str}") if attrs.empty?
|
38
44
|
end
|
39
45
|
|
40
46
|
ALD_TYPE_STYLE_ATTR = /%((?:--)?#{ALD_ID_NAME}:)\s*?((?:\\\}|\\;|[^\};])*?;)/
|
@@ -1,10 +1,20 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
1
|
+
# -*- coding: utf-8; frozen_string_literal: true -*-
|
2
|
+
#
|
3
|
+
#--
|
4
|
+
# Copyright (C) 2009-2019 Thomas Leitner <t_leitner@gmx.at>
|
5
|
+
#
|
6
|
+
# This file is part of kramdown which is licensed under the MIT.
|
7
|
+
#++
|
8
|
+
#
|
2
9
|
|
3
10
|
require 'kramdown/parser/kramdown/escaped_chars'
|
4
11
|
|
5
12
|
module Kramdown
|
6
13
|
module Parser
|
7
14
|
class Kramdown
|
15
|
+
|
16
|
+
# Parse the link at the current scanner position. This method is used to parse normal links as
|
17
|
+
# well as image links, plain spans.
|
8
18
|
def parse_link
|
9
19
|
start_line_number = @src.current_line_number
|
10
20
|
result = @src.scan(LINK_START)
|
@@ -16,7 +26,7 @@ module Kramdown
|
|
16
26
|
# no nested links allowed
|
17
27
|
if link_type == :a && (@tree.type == :img || @tree.type == :a ||
|
18
28
|
@stack.any? {|t, _| t && (t.type == :img || t.type == :a) })
|
19
|
-
|
29
|
+
add_text(result)
|
20
30
|
return
|
21
31
|
end
|
22
32
|
el = Element.new(link_type, nil, nil, location: start_line_number)
|
@@ -24,7 +34,7 @@ module Kramdown
|
|
24
34
|
count = 1
|
25
35
|
found = parse_spans(el, LINK_BRACKET_STOP_RE) do
|
26
36
|
count += (@src[1] ? -1 : 1)
|
27
|
-
count - el.children.select {|c| c.type == :img
|
37
|
+
count - el.children.select {|c| c.type == :img }.size == 0
|
28
38
|
end
|
29
39
|
unless found
|
30
40
|
@src.revert_pos(saved_pos)
|
@@ -36,55 +46,65 @@ module Kramdown
|
|
36
46
|
|
37
47
|
# reference style link or no link url
|
38
48
|
if @src.scan(LINK_INLINE_ID_RE) || !@src.check(/\(/)
|
49
|
+
emit_warning = !@src[1]
|
39
50
|
link_id = normalize_link_id(@src[1] || alt_text)
|
40
51
|
if @link_defs.key?(link_id)
|
41
52
|
link_def = @link_defs[link_id]
|
42
53
|
add_link(el, link_def[0], link_def[1], alt_text,
|
43
54
|
link_def[2] && link_def[2].options[:ial])
|
44
55
|
else
|
56
|
+
if emit_warning
|
57
|
+
warning("No link definition for link ID '#{link_id}' found on line #{start_line_number}")
|
58
|
+
end
|
45
59
|
@src.revert_pos(saved_pos)
|
46
|
-
|
60
|
+
if @src.check(/./) == ']'
|
61
|
+
add_text(result)
|
62
|
+
else
|
63
|
+
parse_span
|
64
|
+
end
|
47
65
|
end
|
48
66
|
return
|
49
67
|
end
|
50
68
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
69
|
+
# link url in parentheses
|
70
|
+
if @src.scan(/\(<(.*?)>/)
|
71
|
+
link_url = @src[1]
|
72
|
+
if @src.scan(/\)/)
|
73
|
+
add_link(el, link_url, nil, alt_text)
|
74
|
+
return
|
75
|
+
end
|
76
|
+
else
|
77
|
+
link_url = +''
|
78
|
+
nr_of_brackets = 0
|
79
|
+
while (temp = @src.scan_until(LINK_PAREN_STOP_RE))
|
80
|
+
link_url << temp
|
81
|
+
if @src[2]
|
82
|
+
nr_of_brackets -= 1
|
83
|
+
break if nr_of_brackets == 0
|
84
|
+
elsif @src[1]
|
85
|
+
nr_of_brackets += 1
|
86
|
+
else
|
87
|
+
break
|
88
|
+
end
|
89
|
+
end
|
90
|
+
link_url = link_url[1..-2]
|
91
|
+
link_url.strip!
|
74
92
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
93
|
+
if nr_of_brackets == 0
|
94
|
+
add_link(el, link_url, nil, alt_text)
|
95
|
+
return
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
if @src.scan(LINK_INLINE_TITLE_RE)
|
100
|
+
add_link(el, link_url, @src[2], alt_text)
|
101
|
+
else
|
102
|
+
@src.revert_pos(saved_pos)
|
103
|
+
add_text(result)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
# define_parser(:link, LINK_START, '!?\[')
|
80
107
|
|
81
|
-
if @src.scan(LINK_INLINE_TITLE_RE)
|
82
|
-
add_link(el, link_url, @src[2], alt_text)
|
83
|
-
else
|
84
|
-
@src.revert_pos(saved_pos)
|
85
|
-
add_text(result)
|
86
|
-
end
|
87
|
-
end
|
88
108
|
end
|
89
109
|
end
|
90
110
|
end
|
data/lib/darkmouun/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: darkmouun
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Akinori Ichigo
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-09-
|
11
|
+
date: 2021-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -125,7 +125,7 @@ metadata:
|
|
125
125
|
homepage_uri: https://github.com/akinori-ichigo/darkmouun
|
126
126
|
source_code_uri: https://github.com/akinori-ichigo/darkmouun
|
127
127
|
changelog_uri: https://github.com/akinori-ichigo/darkmouun
|
128
|
-
post_install_message:
|
128
|
+
post_install_message:
|
129
129
|
rdoc_options: []
|
130
130
|
require_paths:
|
131
131
|
- lib
|
@@ -141,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
141
|
version: '0'
|
142
142
|
requirements: []
|
143
143
|
rubygems_version: 3.1.6
|
144
|
-
signing_key:
|
144
|
+
signing_key:
|
145
145
|
specification_version: 4
|
146
146
|
summary: The Processting tool from Markdown to HTML
|
147
147
|
test_files: []
|