doctype 5 html lang=(attr :lang, 'en' unless attr? :nolang)

head
  meta charset="utf-8"
  - [:description, :keywords, :author, :copyright].each do |key|
    - if attr? key
      meta name=key content=(attr key)

  title=((doctitle :sanitize => true) || (attr 'untitled-label'))
  meta name="apple-mobile-web-app-capable" content="yes"
  meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"
  meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" 

  link href="#{revealjsdir}/lib/css/theme-v2-#{revealjsfontfamily}.css" rel="stylesheet"
  link href="#{revealjsdir}/lib/css/theme-output.css" rel="stylesheet"
  - if attr? :icons, 'font'
    - if attr? 'iconfont-remote'
      link rel='stylesheet' href=(attr 'iconfont-cdn', 'https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css')
    - else
      link rel='stylesheet' href=(attr :revealjs_vendor_stylesdir, "#{revealjsdir}/lib/css/#{attr 'iconfont-name', 'font-awesome'}.css")
  - if attr? :revealjs_customtheme
    link rel='stylesheet' href=(attr :revealjs_customtheme) id='theme'
  - else
    link rel='stylesheet' href='#{revealjsdir}/lib/css/#{attr 'revealjs_theme', 'gpe'}.css' id='theme'

  - case attr 'source-highlighter'
  - when 'coderay'
    - if (attr 'coderay-css', 'class') == 'class'
      - if @safe >= Asciidoctor::SafeMode::SECURE || (attr? :linkcss)
        link rel='stylesheet' href=normalize_web_path('asciidoctor-coderay.css', (attr :stylesdir, ''))
      - else
        style=Asciidoctor::HTML5.default_coderay_stylesheet
  - when 'pygments'
    - if (attr 'pygments-css', 'class') == 'class'
      - if @safe >= Asciidoctor::SafeMode::SECURE || (attr? :linkcss)
        link rel='stylesheet' href=normalize_web_path('asciidoctor-pygments.css', (attr :stylesdir, ''))
      - else
        style=Asciidoctor::HTML5.pygments_stylesheet(attr 'pygments-style')
  - when 'highlightjs'
    - if attr? 'highlightjs-remote'
      link rel='stylesheet' href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/#{attr 'highlightjs-theme', 'default'}.min.css"
    - else
      link rel='stylesheet' href="#{attr :revealjsdir}/lib/css/highlightjs/#{attr 'highlightjs-theme', 'default'}.min.css"
  - when 'prettify'
    link rel='stylesheet' href="#{attr :prettifydir, 'https://cdnjs.cloudflare.com/ajax/libs/prettify/r298'}/#{attr 'prettify-theme', 'prettify'}.min.css"
    script src="#{attr :prettifydir, 'https://cdnjs.cloudflare.com/ajax/libs/prettify/r298'}/prettify.min.js"
    script document.addEventListener('DOMContentLoaded', prettyPrint)
// If the query includes 'print-pdf', use the PDF print sheet
javascript:
  document.write( '<link rel="stylesheet" href="#{revealjsdir}/lib/css/print/' + ( window.location.search.match( /print-pdf/gi ) ? 'pdf' : 'paper' ) + '.css" type="text/css" media="print">' );
body class="theme-font-liberation"
  .reveal
    // - if attr? :header_image_path
    //   .header
    //     img src=image_uri(attr :header_image_path)
    // Any section element inside of this container is displayed as a slide
    .slides
      =content
  script src="#{revealjsdir}/lib/js/head.min.js"
  script src="#{revealjsdir}/lib/js/reveal.min.js"
  - if attr? :script
    script src="#{attr :scriptsdir, ''}/#{attr :script}"
  - if attr? :scripts
    - scripts = (attr :scripts)
    - scripts.split(',').each do |script|
      script src="#{attr :scriptsdir, ''}/#{script.strip}"

  javascript:
    // Full list of configuration options available here:
    // https://github.com/hakimel/reveal.js#configuration
    Reveal.initialize({

      controls: #{attr 'revealjs_controls', 'true'},
      // Display a presentation progress bar
      progress: #{attr 'revealjs_progress', 'true'},
      // Display the page number of the current slide
      slideNumber: #{attr 'revealjs_slidenumber', 'true'},
      // Push each slide change to the browser history
      history: #{attr 'revealjs_history', 'true'},
      // Enable keyboard shortcuts for navigation
      keyboard: #{attr 'revealjs_keyboard', 'true'},
      // Enable the slide overview mode
      overview: #{attr 'revealjs_overview', 'true'},
      // Vertical centering of slides
      center: #{attr 'revealjs_center', 'false'},
      // Enables touch navigation on devices with touch input
      touch: #{attr 'revealjs_touch', 'true'},
      // Loop the presentation
      loop: #{attr 'revealjs_loop', 'false'},
      // Change the presentation direction to be RTL
      rtl: #{attr 'revealjs_rtl', 'false'},
      // Turns fragments on and off globally
      fragments: #{attr 'revealjs_fragments', 'true'},
      // Flags if the presentation is running in an embedded mode,
      // i.e. contained within a limited portion of the screen
      embedded: #{attr 'revealjs_embedded', 'false'},
      // Number of milliseconds between automatically proceeding to the
      // next slide, disabled when set to 0, this value can be overwritten
      // by using a data-autoslide attribute on your slides
      autoSlide: #{attr 'revealjs_autoslide', 0},
      // Stop auto-sliding after user input
      autoSlideStoppable: #{attr 'revealjs_autoslidestoppable', 'true'},
      // Enable slide navigation via mouse wheel
      mouseWheel: #{attr 'revealjs_mousewheel', 'false'},
      // Hides the address bar on mobile devices
      hideAddressBar: #{attr 'revealjs_hideaddressbar', 'true'},
      // Opens links in an iframe preview overlay
      previewLinks: #{attr 'revealjs_previewlinks', 'false'},
      // Transition style (e.g., none, fade, slide, convex, concave, zoom)
      transition: Reveal.getQueryHash().transition || '#{attr 'revealjs_transition', 'none'}',
      // Transition speed (e.g., default, fast, slow)
      transitionSpeed: '#{attr 'revealjs_transitionspeed', 'default'}',
      // Transition style for full page slide backgrounds (e.g., none, fade, slide, convex, concave, zoom)
      backgroundTransition: '#{attr 'revealjs_backgroundtransition', 'fade'}',
      // Number of slides away from the current that are visible
      viewDistance: #{attr 'revealjs_viewdistance', 3},
      // Parallax background image (e.g., "'https://s3.amazonaws.com/hakim-static/reveal-js/reveal-parallax-1.jpg'")
      parallaxBackgroundImage: '#{attr 'revealjs_parallaxbackgroundimage', ''}',
      // Parallax background size in CSS syntax (e.g., "2100px 900px")
      parallaxBackgroundSize: '#{attr 'revealjs_parallaxbackgroundsize', ''}',
      // Optional libraries used to extend on reveal.js

      margin: #{attr 'revealjs_margin', 0.2},
      marginTop: '#{attr 'revealjs_margintop', ''}', // Top position of the slide : percentage or px
      marginLeft: '#{attr 'revealjs_marginleft', ''}', // Left position of the slide : percentage or px

      width: #{attr 'revealjs_width', 960},
      height: #{attr 'revealjs_height', 700},
      minScale: #{attr 'revealjs_minscale', 0.2},
      maxScale: #{attr 'revealjs_maxscale', 1},

      // Theme (e.g., beige, black, blood, league, moon, night, serif, simple, sky, solarized, white)
      // NOTE setting the theme in the config no longer works in reveal.js 3.x
      theme: Reveal.getQueryHash().theme || '#{attr 'revealjs_theme', 'gpe2'}',

      notes: {},

      // Optional libraries used to extend on reveal.js
      dependencies: [
        {
          src: '#{revealjsdir}/lib/plugin/markdown/marked.js', condition: function () {
          return !!document.querySelector('[data-markdown]');
        }
        },
        {
          src: '#{revealjsdir}/lib/plugin/markdown/markdown.js', condition: function () {
          return !!document.querySelector('[data-markdown]');
        }
        },
        {
          src: '#{revealjsdir}/lib/plugin/highlight/highlight.js', async: true, condition: function () {
          return !!document.querySelector('pre code');
        },
          callback: function () {
            hljs.initHighlightingOnLoad();
          }
        },
        { // DOES NOT WORK ANYMORE
          src: '#{revealjsdir}/lib/plugin/zoom-js/zoom.js', async: true, condition: function () {
          return !!document.body.classList;
        }
        },
        {
          src: '#{revealjsdir}/lib/plugin/notes/notes.js', async: true, condition: function () {
          return !!document.body.classList;
        }
        }
      ]
       // TODO : Add a parameter to enable/disable REMOTE
       // { src: 'revealjs/plugin/remotes/remotes.js', async: true, condition: function() { return !!document.body.classList; } },
     });