Skip to content

Commit 934b59d

Browse files
committed
add missing site files after merge
1 parent 31b6c1d commit 934b59d

11 files changed

+400
-0
lines changed

dev-site.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
runtime:
2+
cache_dir: ./.cache/antora
3+
4+
site:
5+
title: Knative Tutorial
6+
url: https://redhat-developer-demos.github.io/knative-tutorial
7+
start_page: knative-tutorial::index.adoc
8+
9+
content:
10+
sources:
11+
- url: .
12+
branches: HEAD
13+
start_path: documentation
14+
- url: ../knative-tutorial-module-basics
15+
branches: HEAD
16+
- url: ../knative-tutorial-module-build
17+
branches: HEAD
18+
- url: ../knative-tutorial-module-camelk
19+
branches: HEAD
20+
asciidoc:
21+
attributes:
22+
tutorial-namespace: knativetutorial
23+
#workshop: true
24+
title: Knative Tutorial
25+
workshop-domain: guru.devx.red
26+
release-version: release/0.7.x
27+
openshift-console-url: https://console-openshift-console.apps.example.com
28+
etherpad-url: http://example.com
29+
extensions:
30+
- ./lib/copy-to-clipboard.js
31+
- ./lib/tab-block.js
32+
ui:
33+
bundle:
34+
url: ../rhd-tutorial-ui/build/ui-bundle.zip
35+
supplemental_files: ./supplemental-ui
36+
output:
37+
dir: ./gh-pages

gulpfile.babel.js

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/*jshint esversion: 6 */
2+
3+
import { series, watch } from "gulp";
4+
import { remove } from "fs-extra";
5+
import { readFileSync } from "fs";
6+
import {load as yamlLoad} from "yaml-js";
7+
import generator from "@antora/site-generator-default";
8+
import browserSync from "browser-sync";
9+
10+
const filename = "dev-site.yml";
11+
const server = browserSync.create();
12+
const args = ["--playbook", filename];
13+
14+
//Watch Paths
15+
function watchGlobs() {
16+
let json_content = readFileSync(`${__dirname}/${filename}`, "UTF-8");
17+
let yaml_content = yamlLoad(json_content);
18+
let dirs = yaml_content.content.sources.map(source => [
19+
`${source.url}/**/**.yml`,
20+
`${source.url}/**/**.adoc`,
21+
`${source.url}/**/**.hbs`
22+
]);
23+
dirs.push(["dev-site.yml"]);
24+
dirs = [].concat(...dirs);
25+
//console.log(dirs);
26+
return dirs;
27+
}
28+
29+
const siteWatch = () => watch(watchGlobs(), series(build, reload));
30+
31+
const removeSite = done => remove("gh-pages", done);
32+
const removeCache = done => remove(".cache", done);
33+
34+
function build(done) {
35+
generator(args, process.env)
36+
.then(() => {
37+
done();
38+
})
39+
.catch(err => {
40+
console.log(err);
41+
done();
42+
});
43+
}
44+
45+
function workshopSite(done){
46+
generator(["--pull", "--stacktrace","--playbook","workshop-site.yaml"], process.env)
47+
.then(() => {
48+
done();
49+
})
50+
.catch(err => {
51+
console.log(err);
52+
done();
53+
});
54+
}
55+
56+
function reload(done) {
57+
server.reload();
58+
done();
59+
}
60+
61+
function serve(done) {
62+
server.init({
63+
server: {
64+
baseDir: "./gh-pages"
65+
}
66+
});
67+
done();
68+
}
69+
70+
const _build = build;
71+
export { _build as build };
72+
const _clean = series(removeSite, removeCache);
73+
export { _clean as clean };
74+
const _default = series(_clean, build, serve, siteWatch);
75+
export { _default as default };
76+
//build workshop docs
77+
const _wsite = series(_clean, workshopSite);
78+
export { _wsite as workshopSite };

lib/copy-to-clipboard.js

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
const BlockCopyToClipboardMacro = (() => {
2+
const $context = Symbol("context");
3+
const superclass = Opal.module(null, "Asciidoctor").Extensions
4+
.BlockMacroProcessor;
5+
const scope = Opal.klass(
6+
Opal.module(null, "Antora"),
7+
superclass,
8+
"BlockCopyToClipboardMacro",
9+
function() {}
10+
);
11+
12+
Opal.defn(scope, "$initialize", function initialize(name, config, context) {
13+
Opal.send(
14+
this,
15+
Opal.find_super_dispatcher(this, "initialize", initialize),
16+
[name, config]
17+
);
18+
this[$context] = context;
19+
});
20+
21+
Opal.defn(scope, "$process", function(parent, target, attrs) {
22+
const t = target.startsWith(":") ? target.substr(1) : target;
23+
//console.log("target:", t);
24+
const createHtmlFragment = html => this.createBlock(parent, "pass", html);
25+
const html = `<button class="copybtn float-right" title="Copy to clipboard" data-clipboard-target="#${t}"><i class="fa fa-clipboard"></i></button><br/>`;
26+
parent.blocks.push(createHtmlFragment(html));
27+
});
28+
29+
return scope;
30+
})();
31+
32+
module.exports.register = (registry, context) => {
33+
registry.blockMacro(
34+
BlockCopyToClipboardMacro.$new("copyToClipboard", Opal.hash(), context)
35+
);
36+
};

lib/tab-block.js

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
/* Copyright (c) 2018 OpenDevise, Inc.
2+
*
3+
* This Source Code Form is subject to the terms of the Mozilla Public
4+
* License, v. 2.0. If a copy of the MPL was not distributed with this
5+
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6+
7+
/**
8+
* Extends the AsciiDoc syntax to support a tabset. The tabset is created from
9+
* a dlist enclosed in an example block that is marked with the tabs style.
10+
*
11+
* Usage:
12+
*
13+
* [tabs]
14+
* ====
15+
* Tab A::
16+
* +
17+
* --
18+
* Contents of tab A.
19+
* --
20+
* Tab B::
21+
* +
22+
* --
23+
* Contents of tab B.
24+
* --
25+
* ====
26+
*
27+
* @author Dan Allen <[email protected]>
28+
*/
29+
const IdSeparatorCh = "-";
30+
const ExtraIdSeparatorsRx = /^-+|-+$|-(-)+/g;
31+
const InvalidIdCharsRx = /[^a-zA-Z0-9_]/g;
32+
const List = Opal.const_get_local(Opal.module(null, "Asciidoctor"), "List");
33+
const ListItem = Opal.const_get_local(
34+
Opal.module(null, "Asciidoctor"),
35+
"ListItem"
36+
);
37+
38+
const generateId = (str, idx) =>
39+
`tabset${idx}_${str
40+
.toLowerCase()
41+
.replace(InvalidIdCharsRx, IdSeparatorCh)
42+
.replace(ExtraIdSeparatorsRx, "$1")}`;
43+
44+
function tabsBlock() {
45+
this.onContext("example");
46+
this.process((parent, reader, attrs) => {
47+
const createHtmlFragment = html => this.createBlock(parent, "pass", html);
48+
const tabsetIdx = parent.getDocument().counter("idx-tabset");
49+
const nodes = [];
50+
nodes.push(createHtmlFragment('<div class="tabset is-loading">'));
51+
const container = this.parseContent(
52+
this.createBlock(parent, "open"),
53+
reader
54+
);
55+
const sourceTabs = container.getBlocks()[0];
56+
if (
57+
!(
58+
sourceTabs &&
59+
sourceTabs.getContext() === "dlist" &&
60+
sourceTabs.getItems().length
61+
)
62+
)
63+
return;
64+
const tabs = List.$new(parent, "ulist");
65+
tabs.addRole("tabs");
66+
const panes = {};
67+
sourceTabs.getItems().forEach(([[title], details]) => {
68+
const tab = ListItem.$new(tabs);
69+
tabs.$append(tab);
70+
const id = generateId(title.getText(), tabsetIdx);
71+
tab.text = `[[${id}]]${title.text}`;
72+
let blocks = details.getBlocks();
73+
const numBlocks = blocks.length;
74+
if (numBlocks) {
75+
if (blocks[0].context === "open" && numBlocks === 1)
76+
blocks = blocks[0].getBlocks();
77+
panes[id] = blocks.map(block => (block.parent = parent) && block);
78+
}
79+
});
80+
nodes.push(tabs);
81+
nodes.push(createHtmlFragment('<div class="content">'));
82+
Object.entries(panes).forEach(([id, blocks]) => {
83+
nodes.push(
84+
createHtmlFragment(`<div class="tab-pane" aria-labelledby="${id}">`)
85+
);
86+
nodes.push(...blocks);
87+
nodes.push(createHtmlFragment("</div>"));
88+
});
89+
nodes.push(createHtmlFragment("</div>"));
90+
nodes.push(createHtmlFragment("</div>"));
91+
parent.blocks.push(...nodes);
92+
});
93+
}
94+
95+
function register(registry, context) {
96+
registry.block("tabs", tabsBlock);
97+
}
98+
99+
module.exports.register = register;

package.json

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "knative-tutorial-site",
3+
"description": "Knative Tutorial Documentation Site",
4+
"homepage": "https://redhat-developer-demos.github.io/knative-tutorial",
5+
"author": {"email": "[email protected]","name": "Kamesh Sampath","url": "https://twitter.com/@kamesh_sampath"},
6+
"dependencies": {
7+
"@antora/cli": "2.0.0",
8+
"@antora/site-generator-default": "2.0.0",
9+
"@babel/cli": "^7.5.5",
10+
"@babel/core": "^7.5.5",
11+
"@babel/polyfill": "^7.4.4",
12+
"@babel/preset-env": "^7.5.5",
13+
"@babel/register": "^7.5.5",
14+
"browser-sync": "^2.26.7",
15+
"fs-extra": "^8.1.0",
16+
"gulp": "^4.0.0",
17+
"yaml-js": "^0.2.3"
18+
},
19+
"devDependencies": {},
20+
"scripts": {
21+
"dev": "gulp",
22+
"clean": "gulp clean",
23+
"workshop": "gulp workshopSite"
24+
},
25+
"repository": {
26+
"type": "git",
27+
"url": "git+https://github.com/redhat-developer-demos/knative-tutorial.git"
28+
},
29+
"license": "Apache-2.0",
30+
"babel": {
31+
"presets": [
32+
"@babel/preset-env"
33+
]
34+
}
35+
}

site.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
runtime:
2+
cache_dir: ./.cache/antora
3+
4+
site:
5+
title: Knative Tutorial
6+
url: https://redhat-developer-demos.github.io/knative-tutorial
7+
start_page: knative-tutorial::index.adoc
8+
9+
content:
10+
sources:
11+
- url: [email protected]:redhat-developer-demos/knative-tutorial.git
12+
tags: []
13+
branches: release/0.7.x
14+
start_path: documentation
15+
- url: [email protected]:redhat-developer-demos/knative-tutorial-module-basics.git
16+
tags: []
17+
branches: release/0.7.x
18+
- url: [email protected]:redhat-developer-demos/knative-tutorial-module-camelk.git
19+
tags: []
20+
branches: release/0.5
21+
asciidoc:
22+
attributes:
23+
tutorial-namespace: knativetutorial
24+
title: Knative Tutorial
25+
release-version: release/0.7.x
26+
extensions:
27+
- ./lib/copy-to-clipboard.js
28+
- ./lib/tab-block.js
29+
ui:
30+
bundle:
31+
url: https://github.com/redhat-developer-demos/rhd-tutorial-ui/releases/download/v0.0.4/ui-bundle.zip
32+
supplemental_files: ./supplemental-ui
33+
output:
34+
dir: ./gh-pages

staging.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
runtime:
2+
cache_dir: ./.cache/antora
3+
4+
site:
5+
title: Knative Tutorial
6+
url: https://redhat-developer-docs.github.io/knative-tutorial
7+
start_page: knative-tutorial::index.adoc
8+
9+
content:
10+
sources:
11+
- url: [email protected]:redhat-developer-demos/knative-tutorial.git
12+
tags: []
13+
branches: master
14+
start_path: documentation
15+
- url: [email protected]:redhat-developer-docs/knative-tutorial-module-camelk.git
16+
tags: []
17+
branches: master
18+
asciidoc:
19+
attributes:
20+
tutorial-namespace: knativetutorial
21+
extensions:
22+
- ./lib/copy-to-clipboard.js
23+
ui:
24+
bundle:
25+
url: https://gitlab.com/antora/antora-ui-default/-/jobs/artifacts/master/raw/build/ui-bundle.zip?job=bundle-stable
26+
snapshot: true
27+
supplemental_files: ./supplemental-ui
28+
output:
29+
dir: ./gh-pages

supplemental-ui/img/favicon.ico

1.12 KB
Binary file not shown.
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<nav class="rhd-footer-nav" aria-label="Secondary Navigation" role="navigation">
2+
<ul class="rhd-menu">
3+
<li class="menu-item menu-item--expanded">
4+
<h3 class="section-toggle">GitHub</h3>
5+
<ul class="rhd-menu">
6+
<li class="menu-item">
7+
<a href="https://github.com/redhat-developer-demos/knative-tutorial" title="Knative Tutorial">Knative
8+
Tutorial</a>
9+
</li>
10+
<li class="menu-item">
11+
<a href="https://github.com/redhat-developer-demos/knative-tutorial/issues" title="Issue Tracker">Issue
12+
Tracker</a>
13+
</li>
14+
<li class="menu-item">
15+
<a href="https://github.com/openshift-cloud-functions/Documentation" title="Issue Tracker">OpenShift Cloud Functions</a>
16+
</li>
17+
</ul>
18+
</li>
19+
</ul>
20+
</nav>

0 commit comments

Comments
 (0)