/ OPTIONS PROCESSING / hide slides on %conceal, %notitle and named "!" - titleless = (title = self.title) == '!' - hide_title = (titleless || (option? :notitle) || (option? :conceal)) - vertical_slides = find_by(context: :section) {|section| section.level == 2 } / extracting block image attributes to find an image to use as a / background_image attribute - data_background_image, data_background_size, data_background_repeat, data_background_position, data_background_transition = nil / process the first image block in the current section that acts as a background - section_images = blocks.map do |block| - if (ctx = block.context) == :image - ['background', 'canvas'].include?(block.attributes[1]) ? block : [] - elsif ctx == :section - [] - else - block.find_by(context: :image) {|image| ['background', 'canvas'].include?(image.attributes[1]) } || [] - if (bg_image = section_images.flatten.first) - data_background_image = image_uri(bg_image.attr 'target') / make sure no crash on nil and default values make sense - data_background_size = bg_image.attr 'size' - data_background_repeat = bg_image.attr 'repeat' - data_background_transition = bg_image.attr 'transition' - data_background_position = bg_image.attr 'position' / background-image section attribute overrides the image one - if attr? 'background-image' - data_background_image = image_uri(attr 'background-image') - if attr? 'background-video' - data_background_video = media_uri(attr 'background-video') - if attr? 'background-color' - data_background_color = attr 'background-color' - parent_section_with_vertical_slides = @level == 1 && !vertical_slides.empty? - content_for :footnotes - slide_footnotes = slide_footnotes(self) - if document.footnotes? && !(parent.attr? 'nofootnotes') && !slide_footnotes.empty? .footnotes - slide_footnotes.each do |footnote| .footnote = "#{footnote.index}. #{footnote.text}" - content_for :section section(id=(titleless ? nil : id) class=roles data-transition=(attr 'transition') data-transition-speed=(attr 'transition-speed') data-background-color=data_background_color data-background-image=data_background_image data-background-size=(data_background_size || attr('background-size')) data-background-repeat=(data_background_repeat || attr('background-repeat')) data-background-transition=(data_background_transition || attr('background-transition')) data-background-position=(data_background_position || attr('background-position')) data-background-iframe=(attr "background-iframe") data-background-video=data_background_video data-background-video-loop=((attr? 'background-video-loop') || (option? 'loop')) data-background-video-muted=((attr? 'background-video-muted') || (option? 'muted')) data-background-opacity=(attr "background-opacity") data-autoslide=(attr "autoslide") data-state=(attr 'state') data-auto-animate=((attr? 'auto-animate') || (option? 'auto-animate')) data-auto-animate-easing=((attr 'auto-animate-easing') || (option? 'auto-animate-easing')) data-auto-animate-unmatched=((attr 'auto-animate-unmatched') || (option? 'auto-animate-unmatched')) data-auto-animate-duration=((attr 'auto-animate-duration') || (option? 'auto-animate-duration')) data-auto-animate-id=(attr 'auto-animate-id') data-auto-animate-restart=((attr? 'auto-animate-restart') || (option? 'auto-animate-restart'))) - unless hide_title h2=section_title - if parent_section_with_vertical_slides - unless (_blocks = blocks - vertical_slides).empty? div.slide-content - _blocks.each do |block| =block.convert - yield_content :footnotes - else - unless (_content = content.chomp).empty? div.slide-content =_content - yield_content :footnotes - clear_slide_footnotes / RENDERING / render parent section of vertical slides set - if parent_section_with_vertical_slides section - yield_content :section - vertical_slides.each do |subsection| =subsection.convert / render standalone slides (or vertical slide subsection) - else - if @level >= 3 / dynamic tags which maps with level h level=(@level) =title =content.chomp - else - yield_content :section