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: a0e5ba37ba1ee837c723ff67a384a4104f24aa592c1b33d4fa328faaf089a539
4
- data.tar.gz: 72e1fbe968e1a41b657918349ea2692516ece783fabfaf762e1ab7cab10b7264
3
+ metadata.gz: 4a2c3b66f4fb9ab93a3c8671b722b770baed774650dfc2ce0d84d300198d5c30
4
+ data.tar.gz: 98b7467119e5af5bd55f0b5e309db72fb3063a40eb2577a907319b87d2ddd24c
5
5
  SHA512:
6
- metadata.gz: e208d87f52f188804fd3b25e28313f5d257e703984dc3f8d4091b09c7010e14721d9d64eae1ec799c37fe97ea990d260b8ad686f33f5f2bd19a3c2a54f5ce861
7
- data.tar.gz: 0f58155fc090699282ca2020b48eb1a39d78c2bb6b31b619248d98b141bc2c7f8588b6d74540c9bb899e41a2c0bdf9f07f4244121ba0a6da8a8b0c71107fe17c
6
+ metadata.gz: 818936002fd0553e472bbf6cf3b533d80659729db7c066dbed502c42c44c17497a0e83722ae86b887b1575c68c2e4546d75ff1775f0e4fc80a0ecb90f6d78904
7
+ data.tar.gz: 3ce4f78657b946b1f23f8f73c4eb218ebc77a7ec70cf58387ab005f2357e96b481fbee0b3daca212bcf129837a36ee5ae4a7f235ab4d72c428fcc7ea2bcc6a69
@@ -1,11 +1,18 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- require 'kramdown'
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] = (opts[IAL_CLASS_ATTR] || '') << " #{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.length == 0
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
- parse_span
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 || c.type == :span }.size == 0
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
- parse_span
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
- # link url in parentheses
52
- if @src.scan(/\(<(.*?)>/)
53
- link_url = @src[1]
54
- if @src.scan(/\)/)
55
- add_link(el, link_url, nil, alt_text)
56
- return
57
- end
58
- else
59
- link_url = +''
60
- nr_of_brackets = 0
61
- while (temp = @src.scan_until(LINK_PAREN_STOP_RE))
62
- link_url << temp
63
- if @src[2]
64
- nr_of_brackets -= 1
65
- break if nr_of_brackets == 0
66
- elsif @src[1]
67
- nr_of_brackets += 1
68
- else
69
- break
70
- end
71
- end
72
- link_url = link_url[1..-2]
73
- link_url.strip!
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
- if nr_of_brackets == 0
76
- add_link(el, link_url, nil, alt_text)
77
- return
78
- end
79
- end
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
@@ -1,3 +1,3 @@
1
1
  module Darkmouun
2
- VERSION = "2.1.0"
2
+ VERSION = "2.1.1"
3
3
  end
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.0
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-06 00:00:00.000000000 Z
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: []