article_json 0.1.0 → 0.2.0

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.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -1
  3. data/CODE_OF_CONDUCT.md +46 -0
  4. data/README.md +145 -1
  5. data/lib/article_json/article.rb +31 -2
  6. data/lib/article_json/configuration.rb +56 -0
  7. data/lib/article_json/elements/paragraph.rb +14 -0
  8. data/lib/article_json/elements/text.rb +13 -0
  9. data/lib/article_json/export/amp/custom_element_library_resolver.rb +55 -0
  10. data/lib/article_json/export/amp/elements/base.rb +36 -0
  11. data/lib/article_json/export/amp/elements/embed.rb +97 -0
  12. data/lib/article_json/export/amp/elements/heading.rb +11 -0
  13. data/lib/article_json/export/amp/elements/image.rb +30 -0
  14. data/lib/article_json/export/amp/elements/list.rb +11 -0
  15. data/lib/article_json/export/amp/elements/paragraph.rb +11 -0
  16. data/lib/article_json/export/amp/elements/quote.rb +11 -0
  17. data/lib/article_json/export/amp/elements/text.rb +11 -0
  18. data/lib/article_json/export/amp/elements/text_box.rb +11 -0
  19. data/lib/article_json/export/amp/exporter.rb +36 -0
  20. data/lib/article_json/export/common/html/elements/base.rb +111 -0
  21. data/lib/article_json/export/common/html/elements/embed.rb +34 -0
  22. data/lib/article_json/export/common/html/elements/heading.rb +23 -0
  23. data/lib/article_json/export/common/html/elements/image.rb +36 -0
  24. data/lib/article_json/export/common/html/elements/list.rb +36 -0
  25. data/lib/article_json/export/common/html/elements/paragraph.rb +29 -0
  26. data/lib/article_json/export/common/html/elements/quote.rb +32 -0
  27. data/lib/article_json/export/common/html/elements/shared/caption.rb +32 -0
  28. data/lib/article_json/export/common/html/elements/shared/float.rb +19 -0
  29. data/lib/article_json/export/common/html/elements/text.rb +57 -0
  30. data/lib/article_json/export/common/html/elements/text_box.rb +29 -0
  31. data/lib/article_json/export/common/html/exporter.rb +31 -0
  32. data/lib/article_json/export/html/elements/base.rb +14 -43
  33. data/lib/article_json/export/html/elements/embed.rb +1 -18
  34. data/lib/article_json/export/html/elements/heading.rb +1 -9
  35. data/lib/article_json/export/html/elements/image.rb +1 -23
  36. data/lib/article_json/export/html/elements/list.rb +1 -15
  37. data/lib/article_json/export/html/elements/paragraph.rb +1 -7
  38. data/lib/article_json/export/html/elements/quote.rb +1 -19
  39. data/lib/article_json/export/html/elements/text.rb +1 -34
  40. data/lib/article_json/export/html/elements/text_box.rb +1 -15
  41. data/lib/article_json/export/html/exporter.rb +6 -11
  42. data/lib/article_json/import/google_doc/html/embedded_vimeo_video_parser.rb +4 -4
  43. data/lib/article_json/import/google_doc/html/node_analyzer.rb +24 -2
  44. data/lib/article_json/import/google_doc/html/parser.rb +16 -7
  45. data/lib/article_json/import/google_doc/html/shared/caption.rb +7 -0
  46. data/lib/article_json/import/google_doc/html/text_parser.rb +4 -1
  47. data/lib/article_json/utils/additional_element_placer.rb +66 -0
  48. data/lib/article_json/utils/o_embed_resolver/facebook_video.rb +1 -1
  49. data/lib/article_json/utils/o_embed_resolver/slideshare.rb +1 -1
  50. data/lib/article_json/utils/o_embed_resolver/youtube_video.rb +1 -1
  51. data/lib/article_json/utils.rb +1 -0
  52. data/lib/article_json/version.rb +1 -1
  53. data/lib/article_json.rb +25 -2
  54. metadata +31 -6
  55. data/lib/article_json/export/html/elements/shared/caption.rb +0 -22
  56. data/lib/article_json/export/html/elements/shared/float.rb +0 -17
@@ -3,29 +3,7 @@ module ArticleJSON
3
3
  module HTML
4
4
  module Elements
5
5
  class Image < Base
6
- include Shared::Caption
7
- include Shared::Float
8
-
9
- # @return [Nokogiri::HTML::Node]
10
- def export
11
- create_element(:figure, node_opts).tap do |figure|
12
- figure.add_child(image_node)
13
- figure.add_child(caption_node(:figcaption))
14
- end
15
- end
16
-
17
- private
18
-
19
- # @return [Nokogiri::HTML::Node]
20
- def image_node
21
- create_element(:img, src: @element.source_url)
22
- end
23
-
24
- # @return [Hash]
25
- def node_opts
26
- return if floating_class.nil?
27
- { class: floating_class }
28
- end
6
+ include ArticleJSON::Export::Common::HTML::Elements::Image
29
7
  end
30
8
  end
31
9
  end
@@ -3,21 +3,7 @@ module ArticleJSON
3
3
  module HTML
4
4
  module Elements
5
5
  class List < Base
6
- def export
7
- create_element(tag_name).tap do |list|
8
- @element.content.each do |child_element|
9
- item = create_element(:li)
10
- item.add_child(Paragraph.new(child_element).export)
11
- list.add_child(item)
12
- end
13
- end
14
- end
15
-
16
- private
17
-
18
- def tag_name
19
- @element.list_type == :ordered ? :ol : :ul
20
- end
6
+ include ArticleJSON::Export::Common::HTML::Elements::List
21
7
  end
22
8
  end
23
9
  end
@@ -3,13 +3,7 @@ module ArticleJSON
3
3
  module HTML
4
4
  module Elements
5
5
  class Paragraph < Base
6
- def export
7
- create_element(:p).tap do |p|
8
- @element.content.each do |child_element|
9
- p.add_child(Text.new(child_element).export)
10
- end
11
- end
12
- end
6
+ include ArticleJSON::Export::Common::HTML::Elements::Paragraph
13
7
  end
14
8
  end
15
9
  end
@@ -3,25 +3,7 @@ module ArticleJSON
3
3
  module HTML
4
4
  module Elements
5
5
  class Quote < Base
6
- include Shared::Caption
7
- include Shared::Float
8
-
9
- def export
10
- create_element(:aside, node_opts).tap do |aside|
11
- @element.content.each do |child_element|
12
- aside.add_child(Base.new(child_element).export)
13
- end
14
- aside.add_child(caption_node(:small))
15
- end
16
- end
17
-
18
- private
19
-
20
- # @return [Hash]
21
- def node_opts
22
- return if floating_class.nil?
23
- { class: floating_class }
24
- end
6
+ include ArticleJSON::Export::Common::HTML::Elements::Quote
25
7
  end
26
8
  end
27
9
  end
@@ -3,40 +3,7 @@ module ArticleJSON
3
3
  module HTML
4
4
  module Elements
5
5
  class Text < Base
6
- # @return [Nokogiri::HTML::Node]
7
- def export
8
- return bold_and_italic_node if @element.bold && @element.italic
9
- return bold_node if @element.bold
10
- return italic_node if @element.italic
11
- content_node
12
- end
13
-
14
- private
15
-
16
- # @return [Nokogiri::HTML::Node]
17
- def italic_node
18
- create_element(:em).tap { |em| em.add_child(content_node) }
19
- end
20
-
21
- # @return [Nokogiri::HTML::Node]
22
- def bold_node
23
- create_element(:strong).tap do |strong|
24
- strong.add_child(content_node)
25
- end
26
- end
27
-
28
- # @return [Nokogiri::HTML::Node]
29
- def bold_and_italic_node
30
- create_element(:strong).tap do |strong|
31
- strong.add_child(italic_node)
32
- end
33
- end
34
-
35
- # @return [Nokogiri::HTML::Node]
36
- def content_node
37
- return create_text_node(@element.content) if @element.href.nil?
38
- create_element(:a, @element.content, href: @element.href)
39
- end
6
+ include ArticleJSON::Export::Common::HTML::Elements::Text
40
7
  end
41
8
  end
42
9
  end
@@ -3,21 +3,7 @@ module ArticleJSON
3
3
  module HTML
4
4
  module Elements
5
5
  class TextBox < Base
6
- include Shared::Float
7
-
8
- def export
9
- create_element(:div, node_opts).tap do |div|
10
- @element.content.each do |child_element|
11
- div.add_child(Base.new(child_element).export)
12
- end
13
- end
14
- end
15
-
16
- private
17
-
18
- def node_opts
19
- { class: ['text-box', floating_class].compact.join(' ') }
20
- end
6
+ include ArticleJSON::Export::Common::HTML::Elements::TextBox
21
7
  end
22
8
  end
23
9
  end
@@ -2,19 +2,14 @@ module ArticleJSON
2
2
  module Export
3
3
  module HTML
4
4
  class Exporter
5
- # @param [Array[ArticleJSON::Elements::Base]] elements
6
- def initialize(elements)
7
- @elements = elements
8
- end
5
+ include ArticleJSON::Export::Common::HTML::Exporter
9
6
 
10
- # Generate a string with the HTML representation of all elements
11
- # @return [String]
12
- def html
13
- doc = Nokogiri::HTML.fragment('')
14
- @elements.each do |element|
15
- doc.add_child(Elements::Base.new(element).export)
7
+ class << self
8
+ # Return the module namespace this class is nested in
9
+ # @return [Module]
10
+ def namespace
11
+ ArticleJSON::Export::HTML
16
12
  end
17
- doc.to_html(save_with: 0)
18
13
  end
19
14
  end
20
15
  end
@@ -15,10 +15,10 @@ module ArticleJSON
15
15
  # @return [Regexp]
16
16
  def url_regexp
17
17
  %r{
18
- ^\S* # all protocols & sub domains
19
- vimeo\.com # domain
20
- .*[\#/] # optional path
21
- (?<id>[\d]+) # numerical id
18
+ ^\S* # all protocols & sub domains
19
+ vimeo\.com # domain
20
+ .*([\#/]|clip_id=) # optional path & param
21
+ (?<id>[\d]+) # numerical id
22
22
  }xi
23
23
  end
24
24
  end
@@ -23,14 +23,15 @@ module ArticleJSON
23
23
  # @return [Boolean]
24
24
  def empty?
25
25
  return @is_empty if defined? @is_empty
26
- @is_empty = node.inner_text.strip.empty? && !image? && !hr?
26
+ @is_empty = node.inner_text.strip.empty? && !image? && !hr? && !br?
27
27
  end
28
28
 
29
29
  # Check if the node is a header tag between <h1> and <h5>
30
30
  # @return [Boolean]
31
31
  def heading?
32
32
  return @is_heading if defined? @is_heading
33
- @is_heading = %w(h1 h2 h3 h4 h5).include?(node.name)
33
+ @is_heading =
34
+ !quote? && !text_box? && %w(h1 h2 h3 h4 h5).include?(node.name)
34
35
  end
35
36
 
36
37
  # Check if the node is a horizontal line (i.e. `<hr>`)
@@ -89,6 +90,14 @@ module ArticleJSON
89
90
  @is_embed = EmbeddedParser.supported?(node)
90
91
  end
91
92
 
93
+ # Check if the node is a linebreak. A span only containing whitespaces
94
+ # and <br> tags is considered a linebreak.
95
+ # @return [Boolean]
96
+ def br?
97
+ return @is_br if defined? @is_br
98
+ @is_br = node.name == 'br' || only_includes_brs?
99
+ end
100
+
92
101
  # Determine the type of this node
93
102
  # The type is one of the elements supported by article_json.
94
103
  # @return [Symbol]
@@ -104,6 +113,19 @@ module ArticleJSON
104
113
  return :embed if embed?
105
114
  :unknown
106
115
  end
116
+
117
+ private
118
+
119
+ # Return true if the node only contains <br> nodes and empty text
120
+ # @return [Boolean]
121
+ def only_includes_brs?
122
+ return false unless node.inner_text.strip.empty?
123
+ tags = node.children.map(&:name)
124
+ # Check if it only contains <br> and text nodes
125
+ return false unless tags.all? { |tag| %w(br text).include? tag }
126
+ # Check if at least one is a `<br>` node
127
+ tags.include?('br')
128
+ end
107
129
  end
108
130
  end
109
131
  end
@@ -53,11 +53,13 @@ module ArticleJSON
53
53
  HeadingParser.new(node: @current_node.node).element
54
54
  end
55
55
 
56
- # @return [ArticleJSON::Elements::Paragraph]
56
+ # @return [ArticleJSON::Elements::Paragraph|nil]
57
57
  def parse_paragraph
58
- ParagraphParser
59
- .new(node: @current_node.node, css_analyzer: @css_analyzer)
60
- .element
58
+ paragraph =
59
+ ParagraphParser
60
+ .new(node: @current_node.node, css_analyzer: @css_analyzer)
61
+ .element
62
+ paragraph unless paragraph.blank?
61
63
  end
62
64
 
63
65
  # @return [ArticleJSON::Elements::List]
@@ -72,7 +74,7 @@ module ArticleJSON
72
74
  ImageParser
73
75
  .new(
74
76
  node: @current_node.node,
75
- caption_node: @body_enumerator.next,
77
+ caption_node: next_node,
76
78
  css_analyzer: @css_analyzer
77
79
  )
78
80
  .element
@@ -96,7 +98,7 @@ module ArticleJSON
96
98
  def parse_embed
97
99
  EmbeddedParser.build(
98
100
  node: @current_node.node,
99
- caption_node: @body_enumerator.next,
101
+ caption_node: next_node,
100
102
  css_analyzer: @css_analyzer
101
103
  )
102
104
  end
@@ -105,12 +107,19 @@ module ArticleJSON
105
107
  # @return [Array[Nokogiri::HTML::Node]]
106
108
  def nodes_until_hr
107
109
  nodes = []
108
- until NodeAnalyzer.new(@body_enumerator.peek).hr?
110
+ until !body_has_more_nodes? ||
111
+ NodeAnalyzer.new(@body_enumerator.peek).hr?
109
112
  nodes << @body_enumerator.next
110
113
  end
111
114
  nodes
112
115
  end
113
116
 
117
+ # Return the next node if available, and advance the enumerator
118
+ # @return [Nokogiri::HTML::Node]
119
+ def next_node
120
+ body_has_more_nodes? ? @body_enumerator.next : nil
121
+ end
122
+
114
123
  # @return [Boolean]
115
124
  def body_has_more_nodes?
116
125
  @body_enumerator.peek
@@ -7,11 +7,18 @@ module ArticleJSON
7
7
  # Parse the caption node
8
8
  # @return [Array[ArticleJSON::Elements::Text]]
9
9
  def caption
10
+ return empty_caption if @caption_node.nil?
10
11
  ArticleJSON::Import::GoogleDoc::HTML::TextParser.extract(
11
12
  node: @caption_node,
12
13
  css_analyzer: @css_analyzer
13
14
  )
14
15
  end
16
+
17
+ private
18
+
19
+ def empty_caption
20
+ [ArticleJSON::Elements::Text.new(content: '&nbsp;')]
21
+ end
15
22
  end
16
23
  end
17
24
  end
@@ -13,7 +13,10 @@ module ArticleJSON
13
13
  # The content of the text node, w/o any markup
14
14
  # @return [String]
15
15
  def content
16
- @node.inner_text
16
+ @node.children
17
+ .map { |child| child.name == 'br' ? "\n" : child.inner_text }
18
+ .join('')
19
+ .gsub(/\s*\n\s*/, "\n") # Only keep a single consecutive linebreak
17
20
  end
18
21
 
19
22
  # Check if the text node is styled as bold
@@ -0,0 +1,66 @@
1
+ module ArticleJSON
2
+ module Utils
3
+ # This class allows the user to place additional elements within an article.
4
+ # It distributes elements over the whole article and ensures that an
5
+ # additional element is only ever placed between two paragraph elements. If
6
+ # there are not enough spaces, the remaining additional elements will be
7
+ # appended to the existing article elements.
8
+ class AdditionalElementPlacer
9
+ # @param [ArticleJSON::Article] article
10
+ # @param [Array[Object]] additional_elements
11
+ def initialize(article, additional_elements)
12
+ @elements = article.elements.dup
13
+ @additional_elements = additional_elements
14
+ end
15
+
16
+ # Distribute additional elements evenly throughout the article elements
17
+ # @return [Array[ArticleJSON::Elements::Base|Object]]
18
+ def merge_elements
19
+ indexes = indexes_for_additional_elements
20
+
21
+ if indexes.count < @additional_elements.count
22
+ @elements.push(*@additional_elements[indexes.count..-1])
23
+ end
24
+
25
+ indexes
26
+ .reverse
27
+ .zip(@additional_elements[0...indexes.count].reverse)
28
+ .each { |index, element| @elements.insert(index, element) }
29
+
30
+ @elements
31
+ end
32
+
33
+ private
34
+
35
+ # Find indexes within article elements where there is a paragraph on the
36
+ # current and on the next node
37
+ # @return [Array[Integer]]
38
+ def indexes_between_paragraphs
39
+ @elements
40
+ .each_cons(2) # iterate over elements in consecutive sets of 2
41
+ .with_index
42
+ .each_with_object([]) do |((current, following), index), possibilities|
43
+ if current.type == :paragraph && following.type == :paragraph
44
+ possibilities << index + 1
45
+ end
46
+ end
47
+ end
48
+
49
+ # Return evenly spread indexes of positions to insert a given number of
50
+ # additional elements
51
+ # @return [Array[Integer]]
52
+ def indexes_for_additional_elements
53
+ indexes = indexes_between_paragraphs
54
+ insert_every = indexes.count / @additional_elements.count
55
+
56
+ # in case there are more elements to add than available positions:
57
+ insert_every = 1 if insert_every == 0
58
+
59
+ indexes
60
+ .reject
61
+ .with_index { |_, index| (index + 1) % insert_every != 0 }
62
+ .take(@additional_elements.count)
63
+ end
64
+ end
65
+ end
66
+ end
@@ -13,7 +13,7 @@ module ArticleJSON
13
13
  # The video URL of the element
14
14
  # @return [String]
15
15
  def video_url
16
- "facebook.com/facebook/videos/#{@element.embed_id}"
16
+ "https://www.facebook.com/facebook/videos/#{@element.embed_id}"
17
17
  end
18
18
  end
19
19
  end
@@ -14,7 +14,7 @@ module ArticleJSON
14
14
  # @return [String]
15
15
  def slide_url
16
16
  handle, slug = @element.embed_id.split('/', 2)
17
- "www.slideshare.net/#{handle}/#{slug}"
17
+ "https://www.slideshare.net/#{handle}/#{slug}"
18
18
  end
19
19
  end
20
20
  end
@@ -13,7 +13,7 @@ module ArticleJSON
13
13
  # The video URL of the element
14
14
  # @return [String]
15
15
  def video_url
16
- "youtube.com/watch?v=#{@element.embed_id}"
16
+ "https://www.youtube.com/watch?v=#{@element.embed_id}"
17
17
  end
18
18
  end
19
19
  end
@@ -9,3 +9,4 @@ require_relative 'utils/o_embed_resolver/slideshare'
9
9
  require_relative 'utils/o_embed_resolver/tweet'
10
10
  require_relative 'utils/o_embed_resolver/vimeo_video'
11
11
  require_relative 'utils/o_embed_resolver/youtube_video'
12
+ require_relative 'utils/additional_element_placer'
@@ -1,3 +1,3 @@
1
1
  module ArticleJSON
2
- VERSION = '0.1.0'
2
+ VERSION = '0.2.0'
3
3
  end
data/lib/article_json.rb CHANGED
@@ -39,8 +39,19 @@ require_relative 'article_json/import/google_doc/html/embedded_slideshare_parser
39
39
  require_relative 'article_json/import/google_doc/html/embedded_tweet_parser'
40
40
  require_relative 'article_json/import/google_doc/html/parser'
41
41
 
42
- require_relative 'article_json/export/html/elements/shared/caption'
43
- require_relative 'article_json/export/html/elements/shared/float'
42
+ require_relative 'article_json/export/common/html/elements/shared/caption'
43
+ require_relative 'article_json/export/common/html/elements/shared/float'
44
+ require_relative 'article_json/export/common/html/elements/base'
45
+ require_relative 'article_json/export/common/html/elements/text'
46
+ require_relative 'article_json/export/common/html/elements/heading'
47
+ require_relative 'article_json/export/common/html/elements/paragraph'
48
+ require_relative 'article_json/export/common/html/elements/list'
49
+ require_relative 'article_json/export/common/html/elements/image'
50
+ require_relative 'article_json/export/common/html/elements/quote'
51
+ require_relative 'article_json/export/common/html/elements/text_box'
52
+ require_relative 'article_json/export/common/html/elements/embed'
53
+ require_relative 'article_json/export/common/html/exporter'
54
+
44
55
  require_relative 'article_json/export/html/elements/base'
45
56
  require_relative 'article_json/export/html/elements/text'
46
57
  require_relative 'article_json/export/html/elements/heading'
@@ -52,4 +63,16 @@ require_relative 'article_json/export/html/elements/quote'
52
63
  require_relative 'article_json/export/html/elements/embed'
53
64
  require_relative 'article_json/export/html/exporter'
54
65
 
66
+ require_relative 'article_json/export/amp/elements/base'
67
+ require_relative 'article_json/export/amp/elements/text'
68
+ require_relative 'article_json/export/amp/elements/paragraph'
69
+ require_relative 'article_json/export/amp/elements/list'
70
+ require_relative 'article_json/export/amp/elements/heading'
71
+ require_relative 'article_json/export/amp/elements/quote'
72
+ require_relative 'article_json/export/amp/elements/text_box'
73
+ require_relative 'article_json/export/amp/elements/image'
74
+ require_relative 'article_json/export/amp/elements/embed'
75
+ require_relative 'article_json/export/amp/custom_element_library_resolver'
76
+ require_relative 'article_json/export/amp/exporter'
77
+
55
78
  require_relative 'article_json/article'
metadata CHANGED
@@ -1,14 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: article_json
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
- - "@dsager"
7
+ - Daniel Sager
8
+ - Manu Campos
9
+ - Nicolas Fricke
8
10
  autorequire:
9
11
  bindir: bin
10
12
  cert_chain: []
11
- date: 2017-09-20 00:00:00.000000000 Z
13
+ date: 2017-11-03 00:00:00.000000000 Z
12
14
  dependencies:
13
15
  - !ruby/object:Gem::Dependency
14
16
  name: nokogiri
@@ -106,6 +108,7 @@ extensions: []
106
108
  extra_rdoc_files: []
107
109
  files:
108
110
  - CHANGELOG.md
111
+ - CODE_OF_CONDUCT.md
109
112
  - LICENSE
110
113
  - README.md
111
114
  - bin/article_json_export_google_doc.rb
@@ -124,6 +127,29 @@ files:
124
127
  - lib/article_json/elements/quote.rb
125
128
  - lib/article_json/elements/text.rb
126
129
  - lib/article_json/elements/text_box.rb
130
+ - lib/article_json/export/amp/custom_element_library_resolver.rb
131
+ - lib/article_json/export/amp/elements/base.rb
132
+ - lib/article_json/export/amp/elements/embed.rb
133
+ - lib/article_json/export/amp/elements/heading.rb
134
+ - lib/article_json/export/amp/elements/image.rb
135
+ - lib/article_json/export/amp/elements/list.rb
136
+ - lib/article_json/export/amp/elements/paragraph.rb
137
+ - lib/article_json/export/amp/elements/quote.rb
138
+ - lib/article_json/export/amp/elements/text.rb
139
+ - lib/article_json/export/amp/elements/text_box.rb
140
+ - lib/article_json/export/amp/exporter.rb
141
+ - lib/article_json/export/common/html/elements/base.rb
142
+ - lib/article_json/export/common/html/elements/embed.rb
143
+ - lib/article_json/export/common/html/elements/heading.rb
144
+ - lib/article_json/export/common/html/elements/image.rb
145
+ - lib/article_json/export/common/html/elements/list.rb
146
+ - lib/article_json/export/common/html/elements/paragraph.rb
147
+ - lib/article_json/export/common/html/elements/quote.rb
148
+ - lib/article_json/export/common/html/elements/shared/caption.rb
149
+ - lib/article_json/export/common/html/elements/shared/float.rb
150
+ - lib/article_json/export/common/html/elements/text.rb
151
+ - lib/article_json/export/common/html/elements/text_box.rb
152
+ - lib/article_json/export/common/html/exporter.rb
127
153
  - lib/article_json/export/html/elements/base.rb
128
154
  - lib/article_json/export/html/elements/embed.rb
129
155
  - lib/article_json/export/html/elements/heading.rb
@@ -131,8 +157,6 @@ files:
131
157
  - lib/article_json/export/html/elements/list.rb
132
158
  - lib/article_json/export/html/elements/paragraph.rb
133
159
  - lib/article_json/export/html/elements/quote.rb
134
- - lib/article_json/export/html/elements/shared/caption.rb
135
- - lib/article_json/export/html/elements/shared/float.rb
136
160
  - lib/article_json/export/html/elements/text.rb
137
161
  - lib/article_json/export/html/elements/text_box.rb
138
162
  - lib/article_json/export/html/exporter.rb
@@ -155,6 +179,7 @@ files:
155
179
  - lib/article_json/import/google_doc/html/text_box_parser.rb
156
180
  - lib/article_json/import/google_doc/html/text_parser.rb
157
181
  - lib/article_json/utils.rb
182
+ - lib/article_json/utils/additional_element_placer.rb
158
183
  - lib/article_json/utils/o_embed_resolver/base.rb
159
184
  - lib/article_json/utils/o_embed_resolver/facebook_video.rb
160
185
  - lib/article_json/utils/o_embed_resolver/slideshare.rb
@@ -182,7 +207,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
182
207
  version: '0'
183
208
  requirements: []
184
209
  rubyforge_project:
185
- rubygems_version: 2.5.1
210
+ rubygems_version: 2.6.12
186
211
  signing_key:
187
212
  specification_version: 4
188
213
  summary: JSON Format for News Articles & Ruby Gem
@@ -1,22 +0,0 @@
1
- module ArticleJSON
2
- module Export
3
- module HTML
4
- module Elements
5
- module Shared
6
- module Caption
7
- # Generate the caption node
8
- # @param [String] tag_name
9
- # @return [Nokogiri::HTML::Node]
10
- def caption_node(tag_name)
11
- create_element(tag_name).tap do |caption|
12
- @element.caption.each do |child_element|
13
- caption.add_child(Text.new(child_element).export)
14
- end
15
- end
16
- end
17
- end
18
- end
19
- end
20
- end
21
- end
22
- end
@@ -1,17 +0,0 @@
1
- module ArticleJSON
2
- module Export
3
- module HTML
4
- module Elements
5
- module Shared
6
- module Float
7
- # The element's floating class, if necessary
8
- # @return [String]
9
- def floating_class
10
- "float-#{@element.float}" unless @element.float.nil?
11
- end
12
- end
13
- end
14
- end
15
- end
16
- end
17
- end