Skip to content

Commit

Permalink
Merge pull request #96 from pencil-js/addExcludeInheritedOption
Browse files Browse the repository at this point in the history
Add exclude_inherited option
  • Loading branch information
ankitskvmdam committed Feb 10, 2022
2 parents 7bc0dc3 + b671d89 commit 3fa6e74
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,16 @@ To include js files. Example:
It will include the js files to the output dir and also attach a script tag to the html pointing to the included js file.

### `exclude_inherited: <boolean>`

To exclude inherited symbols. Example:

```json
"exclude_inherited": true
```

This will remove all symbols (members, methods ...) that come from inherited parents.

### Example `theme_opts`

```json
Expand Down Expand Up @@ -454,6 +464,8 @@ It will include the js files to the output dir and also attach a script tag to t
"include_css": ["./static/index.css", "./src/docs/index.css"],
"include_js": ["./static/main.js", "./third-party/test/index.js"],

"exclude_inherited": true,

"overlay_scrollbar": {
"options": {
}
Expand Down Expand Up @@ -494,6 +506,7 @@ It will include the js files to the output dir and also attach a script tag to t
| `static_dir` | `null` | To include static dir | Array of string |
| `include_css` | `null` | To include css files | Array of string |
| `include_js` | `null` | To include js files | `string` |
| `exclude_inherited` | `false` | To exclude inherited symbols | `boolean` |
| `overlay_scrollbar` | `null` | To use overlay scrollbar | Overlay Scrollbar options |
| `sections` | `["Menu", "Modules", "Classes", "Externals", "Events", "Namespaces", "Mixins", "Tutorials", "Interfaces", "Global"]` | To order navbar/sidebar sections or to hide/remove navbar/sidebar sections | `Array<SECTION_TYPE>` |

Expand Down
1 change: 1 addition & 0 deletions publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -1051,6 +1051,7 @@ exports.publish = function(taffyData, opts, tutorials) {
view.search = search();
view.resizeable = resizeable();
view.codepen = codepen();
view.excludeInherited = Boolean(themeOpts.exclude_inherited);
attachModuleSymbols(
find({ longname: { left: 'module:' } }),
members.modules
Expand Down
14 changes: 7 additions & 7 deletions tmpl/container.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
<?js } ?>

<?js
var classes = self.find({kind: 'class', memberof: doc.longname});
var classes = self.find({kind: 'class', memberof: doc.longname, inherited: {'!is': self.excludeInherited}});
if (!isGlobalPage && classes && classes.length) {
?>
<h3 class="subsection-title">Classes</h3>
Expand All @@ -99,7 +99,7 @@
<?js } ?>

<?js
var mixins = self.find({kind: 'mixin', memberof: doc.longname});
var mixins = self.find({kind: 'mixin', memberof: doc.longname, inherited: {'!is': self.excludeInherited}});
if (!isGlobalPage && mixins && mixins.length) {
?>
<h3 class="subsection-title">Mixins</h3>
Expand All @@ -111,7 +111,7 @@
<?js } ?>

<?js
var namespaces = self.find({kind: 'namespace', memberof: doc.longname});
var namespaces = self.find({kind: 'namespace', memberof: doc.longname, inherited: {'!is': self.excludeInherited}});
if (!isGlobalPage && namespaces && namespaces.length) {
?>
<h3 class="subsection-title">Namespaces</h3>
Expand All @@ -123,7 +123,7 @@
<?js } ?>

<?js
var members = self.find({kind: 'member', memberof: isGlobalPage ? {isUndefined: true} : doc.longname});
var members = self.find({kind: 'member', memberof: isGlobalPage ? {isUndefined: true} : doc.longname, inherited: {'!is': self.excludeInherited}});

// symbols that are assigned to module.exports are not globals, even though they're not a memberof anything
if (isGlobalPage && members && members.length && members.forEach) {
Expand All @@ -141,7 +141,7 @@
<?js } ?>

<?js
var methods = self.find({kind: 'function', memberof: isGlobalPage ? {isUndefined: true} : doc.longname});
var methods = self.find({kind: 'function', memberof: isGlobalPage ? {isUndefined: true} : doc.longname, inherited: {'!is': self.excludeInherited}});
if (methods && methods.length && methods.forEach) {
?>
<h3 class="subsection-title">Methods</h3>
Expand All @@ -152,7 +152,7 @@
<?js } ?>

<?js
var typedefs = self.find({kind: 'typedef', memberof: isGlobalPage ? {isUndefined: true} : doc.longname});
var typedefs = self.find({kind: 'typedef', memberof: isGlobalPage ? {isUndefined: true} : doc.longname, inherited: {'!is': self.excludeInherited}});
if (typedefs && typedefs.length && typedefs.forEach) {
?>
<h3 class="subsection-title">Type Definitions</h3>
Expand All @@ -172,7 +172,7 @@
<?js } ?>

<?js
var events = self.find({kind: 'event', memberof: isGlobalPage ? {isUndefined: true} : doc.longname});
var events = self.find({kind: 'event', memberof: isGlobalPage ? {isUndefined: true} : doc.longname, inherited: {'!is': self.excludeInherited}});
if (events && events.length && events.forEach) {
?>
<h3 class="subsection-title">Events</h3>
Expand Down

0 comments on commit 3fa6e74

Please sign in to comment.