Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 17 additions & 10 deletions gulp.d/tasks/build-preview-pages.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
'use strict'

// NOTE remove patch after upgrading from asciidoctor.js to @asciidoctor/core
Error.call = (self, ...args) => {
const err = new Error(...args)
return Object.assign(self, { message: err.message, stack: err.stack })
}

const asciidoctor = require('asciidoctor.js')()
const Asciidoctor = require('@asciidoctor/core')()
const File = require('vinyl')
const fs = require('fs-extra')
const handlebars = require('handlebars')
Expand Down Expand Up @@ -65,7 +59,21 @@ module.exports =
merge(compileLayouts(src), registerPartials(src), registerHelpers(src), copyImages(previewSrc, previewDest))
),
])
.then(([baseUiModel, { layouts }]) => [{ ...baseUiModel, env: process.env }, layouts])
.then(([baseUiModel, { layouts }]) => {
const extensions = ((baseUiModel.asciidoc || {}).extensions || []).map((request) => {
ASCIIDOC_ATTRIBUTES[request.replace(/^@|\.js$/, '').replace(/[/]/g, '-') + '-loaded'] = ''
const extension = require(request)
extension.register.call(Asciidoctor.Extensions)
return extension
})
const asciidoc = { extensions }
for (const component of Object.values(baseUiModel.site.components)) {
for (const version of component.versions || []) version.asciidoc = asciidoc
}
baseUiModel = { ...baseUiModel, env: process.env }
delete baseUiModel.asciidoc
return [baseUiModel, layouts]
})
.then(([baseUiModel, layouts, iconDefs = new Map()]) =>
vfs
.src('**/*.adoc', { base: previewSrc, cwd: previewSrc })
Expand All @@ -84,7 +92,7 @@ module.exports =
uiModel.page = { layout: '404', title: 'Page Not Found' }
} else {
const pageModel = (uiModel.page = { ...uiModel.page })
const doc = asciidoctor.load(file.contents, { safe: 'safe', attributes: ASCIIDOC_ATTRIBUTES })
const doc = Asciidoctor.load(file.contents, { safe: 'safe', attributes: ASCIIDOC_ATTRIBUTES })
const attributes = doc.getAttributes()
pageModel.layout = doc.getAttribute('page-layout', 'default')
pageModel.title = doc.getDocumentTitle()
Expand Down Expand Up @@ -177,7 +185,6 @@ module.exports =
function loadSampleUiModel (src) {
return fs.readFile(ospath.join(src, 'ui-model.yml'), 'utf8').then((contents) => {
const uiModel = yaml.safeLoad(contents)
uiModel.env = process.env
if (process.env.DEPLOY_PRIME_URL) uiModel.site.url = process.env.DEPLOY_PRIME_URL
Object.entries(uiModel.site.components).forEach(([name, component]) => {
component.name = name
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"@fortawesome/free-regular-svg-icons": "~5.13",
"@fortawesome/free-solid-svg-icons": "~5.13",
"@octokit/rest": "~18.0",
"asciidoctor.js": "1.5.9",
"@asciidoctor/core": "~2.2",
"@asciidoctor/tabs": "1.0.0-beta.3",
"autoprefixer": "~9.8",
"browser-pack-flat": "~3.4",
"browserify": "~16.5",
Expand Down
115 changes: 25 additions & 90 deletions preview-src/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ From the menu:Couchbase Web Console[Buckets] menu, click the menu:Statistics[] l

.Here is some {sqlpp}
====
[source,sqlpp]
[,sqlpp]
----
SELECT * FROM `travel-sample` WHERE type = "airline" LIMIT 1;
CREATE PRIMARY INDEX ON `users` WITH {"defer_build": true};
Expand All @@ -32,7 +32,7 @@ BUILD INDEX ON `users`(`#primary`, `ix_name`, `ix_email`);

.Here is some W3 Extended Backus-Naur Format
====
[source,ebnf]
[,ebnf]
----
index-pair ::= '"' 'indexes' '"' ':' ( 'null'
| '"' index '"'
Expand Down Expand Up @@ -60,7 +60,7 @@ Then click the image:arrow-small-down.svg[,16,role=icon]image:arrow-small-up.svg

This section demonstrates the interactive, try it now feature of the docs.

[source.try-it,ruby]
[.try-it,ruby]
----
require 'couchbase'

Expand All @@ -79,7 +79,7 @@ rescue Couchbase::Error::DocumentNotFound
end
----

[source.try-it,java]
[.try-it,java]
----
import com.couchbase.client.core.error.DocumentNotFoundException;
import com.couchbase.client.java.*;
Expand Down Expand Up @@ -117,82 +117,17 @@ This section provides information on the server resources across the cluster.

Installation will vary based on your operation system.

// NOTE this HTML is generated by the tabs-block extension; never type this in a document directly!
++++
<div class="tabset is-loading">
<div class="ulist tabs">
<ul>
<li>
<p><a id="tabset1_ubuntu"></a>Ubuntu</p>
</li>
<li>
<p><a id="tabset1_red-hat"></a>Red Hat</p>
</li>
<li>
<p><a id="tabset1_debian"></a>Debian</p>
</li>
<li>
<p><a id="tabset1_test1"></a>Test1</p>
</li>
<li>
<p><a id="tabset1_test2"></a>Test2</p>
</li>
<li>
<p><a id="tabset1_test3"></a>Test3</p>
</li>
<li>
<p><a id="tabset1_test4"></a>Test4</p>
</li>
<li>
<p><a id="tabset1_test5"></a>Test5</p>
</li>
</ul>
</div>
<div class="content">
<div class="tab-pane is-active" aria-labelledby="tabset1_ubuntu">
<div class="paragraph">
<p>Content for Ubuntu tab.</p>
</div>
</div>
<div class="tab-pane" aria-labelledby="tabset1_red-hat">
<div class="paragraph">
<p>Content for Red Hat tab.</p>
</div>
</div>
<div class="tab-pane" aria-labelledby="tabset1_debian">
<div class="paragraph">
<p>Content for Debian tab.</p>
</div>
</div>
<div class="tab-pane" aria-labelledby="tabset1_test1">
<div class="paragraph">
<p>Content for test 1 tab.</p>
</div>
</div>
<div class="tab-pane" aria-labelledby="tabset1_test2">
<div class="paragraph">
<p>Content for test 2 tab.</p>
</div>
</div>
<div class="tab-pane" aria-labelledby="tabset1_test3">
<div class="paragraph">
<p>Content for test 3 tab.</p>
</div>
</div>
<div class="tab-pane" aria-labelledby="tabset1_test4">
<div class="paragraph">
<p>Content for test 4 tab.</p>
</div>
</div>
<div class="tab-pane" aria-labelledby="tabset1_test5">
<div class="paragraph">
<p>Content for test 5 tab.</p>
</div>
</div>
</div>
</div>
++++

[tabs]
====
Ubuntu:: Content for Ubuntu tab.
Red Hat:: Content for Red Hat tab.
Debian:: Content for Debian tab.
Test1:: Content for test 1 tab.
Test2:: Content for test 2 tab.
Test3:: Content for test 3 tab.
Test4:: Content for test 4 tab.
Test5:: Content for test 5 tab.
====

== Admonition Blocks

Expand Down Expand Up @@ -362,19 +297,19 @@ With the stream-based views, data returned when `stale` is set to `ok` is closer
The *Server Resources* statistics section displays the resource information on this server including swap usage, free RAM, CPU utilization percentage,and FTS RAM used.

.A query using the fluent API (lines are forced to wrap)
[source,java]
[,java]
----
[data-source-url=https://github.com/couchbase/docs-sdk-java/blob/20c44c9e7ca86ea475b7aa33c58d5670aa7c4495/modules/ROOT/pages/n1ql-queries-with-sdk.adoc#L53-L58]
Statement statement = select("fname", "lname", "age").from(i("default")).where(x("age").gt(x("$age"))); // <1>
Statement statement = select("fname", "lname", "age").from(i("default")).where(x("age").gt(x("$age"))); // <.>
JsonObject placeholderValues = JsonObject.create().put("age", 22);
q = N1qlQuery.parameterized(statement, placeholderValues); // <2>
for (N1qlQueryRow row : bkt.query(q)) { // <3>
q = N1qlQuery.parameterized(statement, placeholderValues); // <.>
for (N1qlQueryRow row : bkt.query(q)) { // <.>
System.out.println(row);
}
----
<1> Defines the query.
<2> Inserts placeholder values into the query.
<3> Runs the query.
<.> Defines the query.
<.> Inserts placeholder values into the query.
<.> Runs the query.

[#vbucket-stats]
== Monitoring `vBucket` Resources
Expand Down Expand Up @@ -501,7 +436,7 @@ POST http://nodename:8091/settings/viewUpdateDaemon
updateInterval=10000&updateMinChanges=7000
----

[source,json5, role="no-callouts"]
[.no-callouts,json5]
----
{
"_id": "_design/myddoc",
Expand All @@ -521,7 +456,7 @@ updateInterval=10000&updateMinChanges=7000
You can set this information when creating and updating design documents through the design document REST API.
To perform this operation using the `curl` tool:

[source,console]
[,console]
----
$ curl -X POST -v -d 'updateInterval=7000&updateMinChanges=7000' \
'http://Administrator:Password@192.168.0.72:8091/settings/viewUpdateDaemon'
Expand All @@ -539,7 +474,7 @@ Issues resolved in this release:
* https://issues.couchbase.com/browse/KAFKAC-82[KAFKAC-82]: [FEATURE] Implement log redaction for Kafka Connector
* https://issues.couchbase.com/browse/KAFKAC-90[KAFKAC-90]: [FEATURE] Source: Add config settings to enable compression

[source,xml]
[,xml]
----
<dependency>
<groupId>com.couchbase.client</groupId>
Expand Down
3 changes: 3 additions & 0 deletions preview-src/ui-model.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,6 @@ page:
content: Liber Recusabo
url: '#'
urlType: 'internal'
asciidoc:
extensions:
- '@asciidoctor/tabs'
Loading