Skip to content
Permalink
Browse files

add Anotra UI

  • Loading branch information...
Joan
Joan committed May 6, 2019
1 parent 3499d6d commit 584df08a48e915320ee6a2c7c3904528b632cf2a
Showing with 41 additions and 2 deletions.
  1. +1 −1 documentation/antora.yml
  2. +37 −0 lib/copy-to-clipboard.js
  3. +3 −1 site.yml
@@ -1,4 +1,4 @@
name: docs
name: openshiftknative-docs
title: Knative on OpenShift
version: master
nav:
@@ -0,0 +1,37 @@
const BlockCopyToClipboardMacro = (() => {
const $context = Symbol("context");
const superclass = Opal.module(null, "Asciidoctor").Extensions
.BlockMacroProcessor;
const scope = Opal.klass(
Opal.module(null, "Antora"),
superclass,
"BlockCopyToClipboardMacro",
function() {}
);

Opal.defn(scope, "$initialize", function initialize(name, config, context) {
Opal.send(
this,
Opal.find_super_dispatcher(this, "initialize", initialize),
[name, config]
);
this[$context] = context;
});

Opal.defn(scope, "$process", function(parent, target, attrs) {
const t = target.startsWith(":") ? target.substr(1) : target;
//console.log("target:", t);
const createHtmlFragment = html => this.createBlock(parent, "pass", html);
const html = `<button class="copybtn" title="Copy to clipboard" data-clipboard-target="#${t}"><i class="fa fa-copy"></i></button><br/>`;
parent.blocks.push(createHtmlFragment(html));
});

return scope;
})();

module.exports.register = (registry, context) => {
registry.blockMacro(
BlockCopyToClipboardMacro.$new("copyToClipboard", Opal.hash(), context)
);
};

@@ -13,8 +13,10 @@ content:
start_path: documentation

asciidoc:
attributes:
tutorial-namespace: openshiftknative
extensions:
- ./tab-block.js
- ./lib/copy-to-clipboard.js

ui:
bundle:

0 comments on commit 584df08

Please sign in to comment.
You can’t perform that action at this time.