Skip to content

Commit

Permalink
Merge pull request #2 from iasql/issue-1755
Browse files Browse the repository at this point in the history
fixes for rpc
  • Loading branch information
yrobla authored Jan 5, 2023
2 parents 6cc9ce5 + a49e3be commit 7d64d31
Show file tree
Hide file tree
Showing 20 changed files with 66 additions and 21 deletions.
2 changes: 2 additions & 0 deletions dist/lib/render-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const escape_1 = __importDefault(require("./resources/helpers/escape"));
const hierarchy_1 = __importDefault(require("./resources/helpers/hierarchy"));
const if_is_reference_1 = __importDefault(require("./resources/helpers/if-is-reference"));
const if_is_equal_1 = __importDefault(require("./resources/helpers/if-is-equal"));
const if_is_table_1 = __importDefault(require("./resources/helpers/if-is-table"));
const if_named_anchors_1 = __importDefault(require("./resources/helpers/if-named-anchors"));
const if_show_breadcrumbs_1 = __importDefault(require("./resources/helpers/if-show-breadcrumbs"));
const if_show_named_anchors_1 = __importDefault(require("./resources/helpers/if-show-named-anchors"));
Expand Down Expand Up @@ -82,6 +83,7 @@ function registerHelpers(theme) {
(0, hierarchy_1.default)();
(0, if_is_reference_1.default)();
(0, if_is_equal_1.default)();
(0, if_is_table_1.default)();
(0, if_named_anchors_1.default)(theme);
(0, if_show_breadcrumbs_1.default)(theme);
(0, if_show_named_anchors_1.default)(theme);
Expand Down
1 change: 1 addition & 0 deletions dist/lib/resources/helpers/if-is-table.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default function (): void;
33 changes: 33 additions & 0 deletions dist/lib/resources/helpers/if-is-table.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const Handlebars = __importStar(require("handlebars"));
function default_1() {
Handlebars.registerHelper("ifIsTable", function (arg1, options) {
const str = arg1.name;
return !str.includes("Rpc") ? options.fn(this) : options.inverse(this);
});
}
exports.default = default_1;
1 change: 0 additions & 1 deletion dist/lib/resources/partials/header.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{{#ifShowBreadcrumbs}}

{{{breadcrumbs}}}

{{/ifShowBreadcrumbs}}
1 change: 0 additions & 1 deletion dist/lib/resources/partials/member.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@

{{#unless @last}}
{{#unless hasOwnDocument}}

{{/unless}}
{{/unless}}
1 change: 0 additions & 1 deletion dist/lib/resources/partials/members.group.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{{#if categories}}

{{#each categories}}

{{#unless @first}}
Expand Down
1 change: 0 additions & 1 deletion dist/lib/resources/partials/members.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{{#if categories}}

{{#each categories}}

{{#unless allChildrenHaveOwnDocument}}
Expand Down
4 changes: 2 additions & 2 deletions dist/lib/resources/templates/reflection.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

{{#with model}}

{{#ifIsEqual this.kind 128}}
{{#ifIsTable this}}
## Columns
{{/ifIsEqual}}
{{/ifIsTable}}

{{> main}}

Expand Down
2 changes: 1 addition & 1 deletion dist/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
exports.getPluginOptions = void 0;
const DEFAULT_PLUGIN_OPTIONS = {
id: "default",
id: "reference",
docsRoot: "docs",
out: "reference",
cleanOutputDir: true,
Expand Down
2 changes: 1 addition & 1 deletion dist/theme.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export declare class DocusaurusTheme extends MarkdownTheme {
onRendererEnd(renderer: RendererEvent): void;
getYamlItems(page: PageEvent<DeclarationReflection>): FrontMatter;
getSidebarLabel(page: PageEvent<DeclarationReflection>): string | undefined;
getSidebarPosition(page: PageEvent<DeclarationReflection>): "0.5" | "0" | null;
getSidebarPosition(page: PageEvent<DeclarationReflection>): "0" | "0.5" | null;
getId(page: PageEvent): string;
getTitle(page: PageEvent): any;
get mappings(): {
Expand Down
9 changes: 6 additions & 3 deletions dist/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ class DocusaurusTheme extends theme_1.MarkdownTheme {
getYamlItems(page) {
const pageId = this.getId(page);
const pageTitle = this.getTitle(page);
const sidebarLabel = this.getSidebarLabel(page);
const sidebarPosition = this.getSidebarPosition(page);
const sidebarLabel = "SQL";
const sidebarPosition = "0";
let items = {
id: pageId,
title: pageTitle,
Expand Down Expand Up @@ -164,7 +164,10 @@ class DocusaurusTheme extends theme_1.MarkdownTheme {
return readmeTitle;
}
let result = (0, front_matter_1.getPageTitle)(page);
result = result.replace("Class", "Table");
if (page.url.includes("rpcs"))
result = result.replace("Class", "Method");
else
result = result.replace("Class", "Table");
return result;
}
get mappings() {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "docusaurus-plugin-iasql",
"version": "0.1.1",
"version": "1.0.1",
"description": "A Docusaurus v2 plugin to build API documentation with TypeDoc for IaSQL.",
"main": "dist/index.js",
"files": [
Expand Down
2 changes: 2 additions & 0 deletions src/lib/render-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import escapeHelper from "./resources/helpers/escape";
import hierarchyHelper from "./resources/helpers/hierarchy";
import ifIsReference from "./resources/helpers/if-is-reference";
import ifIsEqual from "./resources/helpers/if-is-equal";
import ifIsTable from "./resources/helpers/if-is-table";
import ifNamedAnchors from "./resources/helpers/if-named-anchors";
import ifShowBreadcrumbsHelper from "./resources/helpers/if-show-breadcrumbs";
import ifShowNamedAnchorsHelper from "./resources/helpers/if-show-named-anchors";
Expand Down Expand Up @@ -65,6 +66,7 @@ export function registerHelpers(theme: MarkdownTheme) {
hierarchyHelper();
ifIsReference();
ifIsEqual();
ifIsTable();
ifNamedAnchors(theme);
ifShowBreadcrumbsHelper(theme);
ifShowNamedAnchorsHelper(theme);
Expand Down
8 changes: 8 additions & 0 deletions src/lib/resources/helpers/if-is-table.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import * as Handlebars from "handlebars";

export default function () {
Handlebars.registerHelper("ifIsTable", function (arg1, options) {
const str = arg1.name;
return !str.includes("Rpc") ? options.fn(this) : options.inverse(this);
});
}
1 change: 0 additions & 1 deletion src/lib/resources/partials/header.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{{#ifShowBreadcrumbs}}

{{{breadcrumbs}}}

{{/ifShowBreadcrumbs}}
1 change: 0 additions & 1 deletion src/lib/resources/partials/member.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@

{{#unless @last}}
{{#unless hasOwnDocument}}

{{/unless}}
{{/unless}}
1 change: 0 additions & 1 deletion src/lib/resources/partials/members.group.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{{#if categories}}

{{#each categories}}

{{#unless @first}}
Expand Down
1 change: 0 additions & 1 deletion src/lib/resources/partials/members.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{{#if categories}}

{{#each categories}}

{{#unless allChildrenHaveOwnDocument}}
Expand Down
4 changes: 2 additions & 2 deletions src/lib/resources/templates/reflection.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

{{#with model}}

{{#ifIsEqual this.kind 128}}
{{#ifIsTable this}}
## Columns
{{/ifIsEqual}}
{{/ifIsTable}}

{{> main}}

Expand Down
10 changes: 7 additions & 3 deletions src/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,11 @@ export class DocusaurusTheme extends MarkdownTheme {
getYamlItems(page: PageEvent<DeclarationReflection>): FrontMatter {
const pageId = this.getId(page);
const pageTitle = this.getTitle(page);
const sidebarLabel = this.getSidebarLabel(page);
const sidebarPosition = this.getSidebarPosition(page);
//const sidebarLabel = this.getSidebarLabel(page);
//const sidebarPosition = this.getSidebarPosition(page);
const sidebarLabel = "SQL";
const sidebarPosition = "0";

let items: FrontMatter = {
id: pageId,
title: pageTitle,
Expand Down Expand Up @@ -195,7 +198,8 @@ export class DocusaurusTheme extends MarkdownTheme {
let result = getPageTitle(page);

// rename class to table
result = result.replace("Class", "Table");
if (page.url.includes("rpcs")) result = result.replace("Class", "Method");
else result = result.replace("Class", "Table");
return result;
}

Expand Down

0 comments on commit 7d64d31

Please sign in to comment.