diff --git a/dist/lib/render-utils.js b/dist/lib/render-utils.js index f99b4fd..9b0f2c6 100644 --- a/dist/lib/render-utils.js +++ b/dist/lib/render-utils.js @@ -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")); @@ -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); diff --git a/dist/lib/resources/helpers/if-is-table.d.ts b/dist/lib/resources/helpers/if-is-table.d.ts new file mode 100644 index 0000000..399a90f --- /dev/null +++ b/dist/lib/resources/helpers/if-is-table.d.ts @@ -0,0 +1 @@ +export default function (): void; diff --git a/dist/lib/resources/helpers/if-is-table.js b/dist/lib/resources/helpers/if-is-table.js new file mode 100644 index 0000000..6494dcf --- /dev/null +++ b/dist/lib/resources/helpers/if-is-table.js @@ -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; diff --git a/dist/lib/resources/partials/header.hbs b/dist/lib/resources/partials/header.hbs index 6a46ac2..7addc79 100644 --- a/dist/lib/resources/partials/header.hbs +++ b/dist/lib/resources/partials/header.hbs @@ -1,5 +1,4 @@ {{#ifShowBreadcrumbs}} - {{{breadcrumbs}}} {{/ifShowBreadcrumbs}} \ No newline at end of file diff --git a/dist/lib/resources/partials/member.hbs b/dist/lib/resources/partials/member.hbs index 225b828..f6e0ef2 100644 --- a/dist/lib/resources/partials/member.hbs +++ b/dist/lib/resources/partials/member.hbs @@ -12,6 +12,5 @@ {{#unless @last}} {{#unless hasOwnDocument}} - {{/unless}} {{/unless}} diff --git a/dist/lib/resources/partials/members.group.hbs b/dist/lib/resources/partials/members.group.hbs index 30f3f75..dc3ea84 100755 --- a/dist/lib/resources/partials/members.group.hbs +++ b/dist/lib/resources/partials/members.group.hbs @@ -1,5 +1,4 @@ {{#if categories}} - {{#each categories}} {{#unless @first}} diff --git a/dist/lib/resources/partials/members.hbs b/dist/lib/resources/partials/members.hbs index e953701..3b1092b 100644 --- a/dist/lib/resources/partials/members.hbs +++ b/dist/lib/resources/partials/members.hbs @@ -1,5 +1,4 @@ {{#if categories}} - {{#each categories}} {{#unless allChildrenHaveOwnDocument}} diff --git a/dist/lib/resources/templates/reflection.hbs b/dist/lib/resources/templates/reflection.hbs index 2298c71..6ed476c 100755 --- a/dist/lib/resources/templates/reflection.hbs +++ b/dist/lib/resources/templates/reflection.hbs @@ -10,9 +10,9 @@ {{#with model}} -{{#ifIsEqual this.kind 128}} +{{#ifIsTable this}} ## Columns -{{/ifIsEqual}} +{{/ifIsTable}} {{> main}} diff --git a/dist/options.js b/dist/options.js index 19b4d6b..27d0908 100644 --- a/dist/options.js +++ b/dist/options.js @@ -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, diff --git a/dist/theme.d.ts b/dist/theme.d.ts index 6faae6a..0a8f026 100644 --- a/dist/theme.d.ts +++ b/dist/theme.d.ts @@ -13,7 +13,7 @@ export declare class DocusaurusTheme extends MarkdownTheme { onRendererEnd(renderer: RendererEvent): void; getYamlItems(page: PageEvent): FrontMatter; getSidebarLabel(page: PageEvent): string | undefined; - getSidebarPosition(page: PageEvent): "0.5" | "0" | null; + getSidebarPosition(page: PageEvent): "0" | "0.5" | null; getId(page: PageEvent): string; getTitle(page: PageEvent): any; get mappings(): { diff --git a/dist/theme.js b/dist/theme.js index ccf4f25..7458561 100644 --- a/dist/theme.js +++ b/dist/theme.js @@ -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, @@ -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() { diff --git a/package.json b/package.json index 4109231..628eba6 100644 --- a/package.json +++ b/package.json @@ -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": [ diff --git a/src/lib/render-utils.ts b/src/lib/render-utils.ts index d77b508..409e48b 100644 --- a/src/lib/render-utils.ts +++ b/src/lib/render-utils.ts @@ -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"; @@ -65,6 +66,7 @@ export function registerHelpers(theme: MarkdownTheme) { hierarchyHelper(); ifIsReference(); ifIsEqual(); + ifIsTable(); ifNamedAnchors(theme); ifShowBreadcrumbsHelper(theme); ifShowNamedAnchorsHelper(theme); diff --git a/src/lib/resources/helpers/if-is-table.ts b/src/lib/resources/helpers/if-is-table.ts new file mode 100644 index 0000000..8a248e9 --- /dev/null +++ b/src/lib/resources/helpers/if-is-table.ts @@ -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); + }); +} diff --git a/src/lib/resources/partials/header.hbs b/src/lib/resources/partials/header.hbs index 6a46ac2..7addc79 100644 --- a/src/lib/resources/partials/header.hbs +++ b/src/lib/resources/partials/header.hbs @@ -1,5 +1,4 @@ {{#ifShowBreadcrumbs}} - {{{breadcrumbs}}} {{/ifShowBreadcrumbs}} \ No newline at end of file diff --git a/src/lib/resources/partials/member.hbs b/src/lib/resources/partials/member.hbs index 225b828..f6e0ef2 100644 --- a/src/lib/resources/partials/member.hbs +++ b/src/lib/resources/partials/member.hbs @@ -12,6 +12,5 @@ {{#unless @last}} {{#unless hasOwnDocument}} - {{/unless}} {{/unless}} diff --git a/src/lib/resources/partials/members.group.hbs b/src/lib/resources/partials/members.group.hbs index 30f3f75..dc3ea84 100755 --- a/src/lib/resources/partials/members.group.hbs +++ b/src/lib/resources/partials/members.group.hbs @@ -1,5 +1,4 @@ {{#if categories}} - {{#each categories}} {{#unless @first}} diff --git a/src/lib/resources/partials/members.hbs b/src/lib/resources/partials/members.hbs index e953701..3b1092b 100644 --- a/src/lib/resources/partials/members.hbs +++ b/src/lib/resources/partials/members.hbs @@ -1,5 +1,4 @@ {{#if categories}} - {{#each categories}} {{#unless allChildrenHaveOwnDocument}} diff --git a/src/lib/resources/templates/reflection.hbs b/src/lib/resources/templates/reflection.hbs index 2298c71..6ed476c 100755 --- a/src/lib/resources/templates/reflection.hbs +++ b/src/lib/resources/templates/reflection.hbs @@ -10,9 +10,9 @@ {{#with model}} -{{#ifIsEqual this.kind 128}} +{{#ifIsTable this}} ## Columns -{{/ifIsEqual}} +{{/ifIsTable}} {{> main}} diff --git a/src/theme.ts b/src/theme.ts index f2d4549..dcaf937 100644 --- a/src/theme.ts +++ b/src/theme.ts @@ -102,8 +102,11 @@ export class DocusaurusTheme extends MarkdownTheme { getYamlItems(page: PageEvent): 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, @@ -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; }