Skip to content

Commit

Permalink
added script for extract and generate api docs
Browse files Browse the repository at this point in the history
  • Loading branch information
igorkorsukov committed Sep 16, 2024
1 parent f307ef4 commit 83f5577
Show file tree
Hide file tree
Showing 72 changed files with 5,547 additions and 41 deletions.
35 changes: 0 additions & 35 deletions docs/apidocs/interactive.js

This file was deleted.

4 changes: 3 additions & 1 deletion tools/jsdoc/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
node_modules
package.json
package-lock.json
out
out
gen_apidocsrc
gen_apidoc
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 6 additions & 3 deletions tools/jsdoc/conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@
"plugins": ["plugins/markdown"],
"templates": {
"cleverLinks": false,
"monospaceLinks": false
"monospaceLinks": false,
"default": {
"outputSourceFiles": false
}
},
"opts": {
"template": "node_modules/docdash",
"template": "./template",
"encoding": "utf8",
"destination": "./out/",
"recurse": false,
Expand All @@ -33,4 +36,4 @@
"search": true
}

}
}
1 change: 1 addition & 0 deletions tools/jsdoc/jsdoc_extractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ async function main()

// parse args
var args = process.argv.slice(2);
console.log("args: ", args)
{
var i = -1;
while (true) {
Expand Down
1 change: 0 additions & 1 deletion tools/jsdoc/jsdoc_install.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env bash

npm install jsdoc
npm install docdash
25 changes: 24 additions & 1 deletion tools/jsdoc/jsdoc_run.sh
Original file line number Diff line number Diff line change
@@ -1 +1,24 @@
jsdoc ../../docs/apidocs ../../docs/apidocs/index.md -r -u ../../docs/apidocs/help -c ./conf.json -d ./out
#!/usr/bin/env bash

HERE="$(dirname ${BASH_SOURCE[0]})"
SRC_DIR=${HERE}/../../src
APIDOC_STATIC_DIR=${HERE}/apidocs_static

GEN_APIDOCSRC_DIR=${HERE}/gen_apidocsrc
GEN_APIDOCS_DIR=${HERE}/gen_apidoc

# Prepare docs
echo "Cleaning ${GEN_APIDOCSRC_DIR}"
rm -rf ${GEN_APIDOCSRC_DIR}
mkdir -p ${GEN_APIDOCSRC_DIR}

echo "Extracting docs..."
node ${HERE}/jsdoc_extractor.js -d ${SRC_DIR} -e .cpp -o ${GEN_APIDOCSRC_DIR}

echo "Copying static..."
cp -r ${APIDOC_STATIC_DIR}/* ${GEN_APIDOCSRC_DIR}/

echo "Generating docs..."
rm -rf ${GEN_APIDOCS_DIR}
mkdir -p ${GEN_APIDOCS_DIR}
jsdoc ${GEN_APIDOCSRC_DIR} ${GEN_APIDOCSRC_DIR}/index.md -r -u ${GEN_APIDOCSRC_DIR}/help -c ${HERE}/conf.json -d ${GEN_APIDOCS_DIR}
61 changes: 61 additions & 0 deletions tools/jsdoc/template/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# License

Docdash is free software, licensed under the Apache License, Version 2.0 (the
"License"). Commercial and non-commercial use are permitted in compliance with
the License.

Copyright (c) 2016 Clement Moron <[email protected]> and the
[contributors to docdash](https://github.com/clenemt/docdash/graphs/contributors).
All rights reserved.

You may obtain a copy of the License at:
http://www.apache.org/licenses/LICENSE-2.0

In addition, a copy of the License is included with this distribution.

As stated in Section 7, "Disclaimer of Warranty," of the License:

> Licensor provides the Work (and each Contributor provides its Contributions)
> on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
> express or implied, including, without limitation, any warranties or
> conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
> PARTICULAR PURPOSE. You are solely responsible for determining the
> appropriateness of using or redistributing the Work and assume any risks
> associated with Your exercise of permissions under this License.
The source code for docdash is available at:
https://github.com/clenemt/docdash

# Third-Party Software

Docdash includes or depends upon the following third-party software, either in
whole or in part. Each third-party software package is provided under its own
license.

## JSDoc 3

JSDoc 3 is free software, licensed under the Apache License, Version 2.0 (the
"License"). Commercial and non-commercial use are permitted in compliance with
the License.

Copyright (c) 2011-2016 Michael Mathews <[email protected]> and the
[contributors to JSDoc](https://github.com/jsdoc3/jsdoc/graphs/contributors).
All rights reserved.

You may obtain a copy of the License at:
http://www.apache.org/licenses/LICENSE-2.0

In addition, a copy of the License is included with this distribution.

As stated in Section 7, "Disclaimer of Warranty," of the License:

> Licensor provides the Work (and each Contributor provides its Contributions)
> on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
> express or implied, including, without limitation, any warranties or
> conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
> PARTICULAR PURPOSE. You are solely responsible for determining the
> appropriateness of using or redistributing the Work and assume any risks
> associated with Your exercise of permissions under this License.
The source code for JSDoc 3 is available at:
https://github.com/jsdoc3/jsdoc
142 changes: 142 additions & 0 deletions tools/jsdoc/template/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
# Docdash
[![Build Status](https://api.travis-ci.org/clenemt/docdash.png?branch=master)](https://travis-ci.org/clenemt/docdash) [![npm version](https://badge.fury.io/js/docdash.svg)](https://badge.fury.io/js/docdash) [![license](https://img.shields.io/npm/l/docdash.svg)](LICENSE.md)

A clean, responsive documentation template theme for JSDoc 4.

![docdash-screenshot](https://cloud.githubusercontent.com/assets/447956/13398144/4dde7f36-defd-11e5-8909-1a9013302cb9.png)

![docdash-screenshot-2](https://cloud.githubusercontent.com/assets/447956/13401057/e30effd8-df0a-11e5-9f51-66257ac38e94.jpg)

## Example
See http://clenemt.github.io/docdash/ for a sample demo. :rocket:

## Install

```bash
$ npm install docdash
```

## Usage
Clone repository to your designated `jsdoc` template directory, then:

```bash
$ jsdoc entry-file.js -t path/to/docdash
```

## Usage (npm)
In your projects `package.json` file add a new script:

```json
"script": {
"generate-docs": "node_modules/.bin/jsdoc -c jsdoc.json"
}
```

In your `jsdoc.json` file, add a template option.

```json
"opts": {
"template": "node_modules/docdash"
}
```

## Sample `jsdoc.json`
See the config file for the [fixtures](fixtures/fixtures.conf.json) or the sample below.

```json
{
"tags": {
"allowUnknownTags": false
},
"source": {
"include": "../js",
"includePattern": "\\.js$",
"excludePattern": "(node_modules/|docs)"
},
"plugins": [
"plugins/markdown"
],
"opts": {
"template": "assets/template/docdash/",
"encoding": "utf8",
"destination": "docs/",
"recurse": true,
"verbose": true
},
"templates": {
"cleverLinks": false,
"monospaceLinks": false
}
}
```

## Options
Docdash supports the following options:

```json5
{
"docdash": {
"static": [false|true], // Display the static members inside the navbar
"sort": [false|true], // Sort the methods in the navbar
"sectionOrder": [ // Order the main section in the navbar (default order shown here)
"Classes",
"Modules",
"Externals",
"Events",
"Namespaces",
"Mixins",
"Tutorials",
"Interfaces"
],
"disqus": "", // Shortname for your disqus (subdomain during site creation)
"openGraph": { // Open Graph options (mostly for Facebook and other sites to easily extract meta information)
"title": "", // Title of the website
"type": "website", // Type of the website
"image": "", // Main image/logo
"site_name": "", // Site name
"url": "" // Main canonical URL for the main page of the site
},
"meta": { // Meta information options (mostly for search engines that have not indexed your site yet)
"title": "", // Also will be used as postfix to actualy page title, prefixed with object/document name
"description": "", // Description of overal contents of your website
"keyword": "" // Keywords for search engines
},
"search": [false|true], // Display seach box above navigation which allows to search/filter navigation items
"commonNav": [false|true], // Group all html code for <nav> in a nav.inc.html fetched on each page (instead of include it in each html page, save {navSize}×{nb html pages} which can be huge on big project)
"collapse": [false|true|top], // Collapse navigation by default except current object's navigation of the current page, top for top level collapse
"wrap": [false|true], // Wrap long navigation names instead of trimming them
"typedefs": [false|true], // Include typedefs in menu
"navLevel": [integer], // depth level to show in navbar, starting at 0 (false or -1 to disable)
"private": [false|true], // set to false to not show @private in navbar
"removeQuotes": [none|all|trim],// Remove single and double quotes, trim removes only surrounding ones
"scripts": [], // Array of external (or relative local copied using templates.default.staticFiles.include) js or css files to inject into HTML,
"ShortenTypes": [false|true], // If set to true this will resolve the display name of all types as the shortened name only (after the final period).
"menu": { // Adding additional menu items after Home
"Project Website": { // Menu item name
"href":"https://myproject.com", //the rest of HTML properties to add to manu item
"target":"_blank",
"class":"menu-item",
"id":"website_link"
},
"Forum": {
"href":"https://myproject.com.forum",
"target":"_blank",
"class":"menu-item",
"id":"forum_link"
}
},
"scopeInOutputPath": [false|true], // Add scope from package file (if present) to the output path, true by default.
"nameInOutputPath": [false|true], // Add name from package file to the output path, true by default.
"versionInOutputPath": [false|true] // Add package version to the output path, true by default.
}
}
```

Place them anywhere inside your `jsdoc.json` file.

## Contributors

Thanks to [lodash](https://lodash.com) and [minami](https://github.com/nijikokun/minami).

## License
Licensed under the Apache License, version 2.0. (see [Apache-2.0](LICENSE.md)).
Loading

0 comments on commit 83f5577

Please sign in to comment.