asciidoctor / asciidoctor-doctest

:hammer: Test suite for Asciidoctor backends
MIT License
12 stars 16 forks source link

Attribute docinfo support #24

Open obilodeau opened 4 years ago

obilodeau commented 4 years ago

It looks like this library doesn't support working with docinfo attributes. The converter added docinfo support here: https://github.com/asciidoctor/asciidoctor-reveal.js/pull/324/

Test:

// .docinfo-shared
// Demonstration of docinfo attribute and we provide only head and footer values
// :include: //head/*[last()] | //div[@class="slides"]/*[last()]
// :header_footer:
= Docinfo shared
:docinfo: shared

== Tweet

// placeholder
[#tweet]
--
--

With docinfo-revealjs.html:

<meta name="generator" content="Asciidoctor reveal.js">
<style>
  #tweet {
    display: flex;
    justify-content: center;
  }
</style>

and docinfo-footer-revealjs.html:

<script src="https://platform.twitter.com/widgets.js"></script>
<script>
  twttr.widgets.createTweet(
    '1214773648776744962',
    document.getElementById('tweet'),
    {
      theme: 'white'
    }
  );
</script>

Generated output:

<!-- .docinfo-shared -->
<script>
  var link = document.createElement( 'link' );
  link.rel = 'stylesheet';
  link.type = 'text/css';
  link.href = window.location.search.match( /print-pdf/gi ) ? "reveal.js/css/print/pdf.css" : "reveal.js/css/print/paper.css";
  document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
<section id="_tweet">
  <h2>Tweet</h2>
  <div class="openblock" id="tweet">
    <div class="content"></div>
  </div>
</section>

Instead of:

<style>
  #tweet {
    display: flex;
    justify-content: center;
  }
</style>
<script>
  twttr.widgets.createTweet(
    '1214773648776744962',
    document.getElementById('tweet'),
    {
      theme: 'white'
    }
  );
</script>

I looked at the code trying to understand what was missing and I couldn't figure it out quickly. Can someone point me in the right direction?