Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

s9y-db importer permalink, tag, excerpt, and semantic HTML improvements #392

Merged
merged 20 commits into from
Apr 24, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix iframe translation
  • Loading branch information
Jude Anthony committed Jan 3, 2019
commit 9543006302f06d6d5a1dc4fd891acb65afe2d3d8
16 changes: 8 additions & 8 deletions lib/jekyll-import/importers/s9y_database.rb
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ def self.process_img_div(text)
caption = "<figcaption>#{captionElem.inner_html}</figcaption>" if captionElem

imageNode = imgcaption.at_css('img')
youtubeNode = imgcaption.at_css('iframe')
iframeNode = imgcaption.at_css('iframe')
if imageNode
# Extract image attributes
width = imageNode.attribute('width')
Expand All @@ -393,14 +393,14 @@ def self.process_img_div(text)
img = "<a href='#{big}'>#{img}</a>"
end
# Create figure source with caption, if any
inc = "<figure class='figure_#{float}'#{style}>#{mdb}#{img}#{caption}</figure>"
elsif youtubeNode
inc = "<figure class='figure-#{float}'#{style}>#{mdb}#{img}#{caption}</figure>"
elsif iframeNode
# Extract iframe attributes
width = youtubeNode.attribute('width')
height = youtubeNode.attribute('height')
src = youtubeNode.attribute('src').value.sub('http://www.youtube.com/embed/', '').strip
width = iframeNode.attribute('width')
height = iframeNode.attribute('height')
src = iframeNode.attribute('src').value.strip
# Create clean iframe source
img = "<iframe src='#{src}' width='#{width}' height=#{height} alt=#{alt}/>"
img = "<iframe src='#{src}' width='#{width}' height=#{height}></iframe>"
# Wrap in link, if any
if bigLink
big = bigLink.attribute('href')
Expand All @@ -410,7 +410,7 @@ def self.process_img_div(text)
end
# Build figure source
inc = <<~EOT
<figure class='figure_#{float}' style='#{style}'>
<figure class='figure-#{float}' style='#{style}'>
<!-- mdb='#{mdbnum}' -->
#{fig}#{caption}
</figure>
Expand Down