--- /dev/null
+<?php if (isset($providerData->data)) : ?>
+ <style>.giscus-frame {min-height: 16em;}</style>
+ <script>
+ function giscus_load(button) {
+ let script = document.createElement("script");
+ <?php foreach ($providerData->data as $key => $val) : ?>
+ script.setAttribute("data-<?=$key?>", <?php var_export($val)?>);
+ <?php endforeach; ?>
+
+ script.src = "//giscus.app/client.js";
+ button.parentNode.replaceChild(script, button);
+ }
+ </script>
+ <button class="activator" onclick="giscus_load(this)">Show Comments from Github Discussions</button>
+<?php endif; ?>
<p style="white-space:pre-wrap"><?= $esc($text) ?></p>
<?php elseif (isset($refs)) : ?>
<?php foreach ($refs as $repo) : /* @var \mdref\Repo $repo */ ?>
- <?php foreach ($repo as $entry) : /* @var \mdref\Entry $entry */ ?>
+ <?php foreach ($repo as $root) : /* @var \mdref\Entry $root */ ?>
- <h2 id="<?= $anchor($entry->getTitle()) ?>">
- <a href="<?= $esc($entry->getName()) ?>"
- ><?= $esc($entry->getTitle()) ?></a></h2>
- <div><?= $quick($entry->getIntro()) ?></div>
+ <h2 id="<?= $anchor($root->getTitle()) ?>">
+ <a href="<?= $esc($root->getName()) ?>"
+ ><?= $esc($root->getTitle()) ?></a></h2>
+ <div><?= $quick($root->getIntro()) ?></div>
<?php if ($repo->hasStub($stub)) : ?>
<?php include __DIR__ . "/stub.phtml"; ?>
<?php endif; ?>
<?php else: ?>
<?php include __DIR__."/index.phtml" ?>
<?php endif; ?>
+ <?php if (isset($entry) && ($comments = $entry->getRepo()->getCommentProvider())) : ?>
+ <div class="comments">
+ <?php foreach ($comments as $providerName => $providerData) : ?>
+ <?php include __DIR__."/comments.$providerName.phtml" ?>
+ <?php endforeach; ?>
+
+ </div>
+ <?php endif; ?>
<footer>
<?php include __DIR__."/footer.phtml" ?>
</footer>
<?php if (isset($baseUrl)) : ?>
- <script src="index.js"></script>
+ <script src="index.js" defer></script>
<?php endif; ?>
</div>
<?= $file($entry->getPath()) ?>
-<?php if ($entry->isRoot() && $entry->getRepo()->hasStub($stub)) : ?>
+<?php if ($entry->isRoot() && $entry->getRepo()->hasStub($stub)) : $root = $entry; ?>
<h2 id="Editor.Stub:">Editor Stub:</h2>
<p>This extension provides a stub file four your editor's auto-completion.</p>
<?php include __DIR__ . "/stub.phtml"; ?>
<ul style="list-style-type: '»'">
<li>
<?php if (defined("REF2HTML") && constant("REF2HTML")) :?>
- <a href="<?= $entry->getName() ?>.stub.php"><?= $entry->getName() ?>.stub.php</a><br>
+ <a href="<?= $root->getName() ?>.stub.php"><?= $root->getName() ?>.stub.php</a><br>
<?php else : ?>
- <a href="stub?ref=<?= $entry->getName() ?>"><?= $entry->getName() ?>.stub.php</a><br>
+ <a href="stub?ref=<?= $root->getName() ?>"><?= $root->getName() ?>.stub.php</a><br>
<?php endif; ?>
<small>
Last modified: