Skip to content

Commit b56c76a

Browse files
committed
--inherited-members option
1 parent 4efd095 commit b56c76a

5 files changed

Lines changed: 94 additions & 10 deletions

File tree

src/AdvancedFeatures.asciidoc

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,46 @@
11
:doctitle: Advanced Features
2+
:sectnums:
3+
:toc: left
4+
:toclevels: 4
25

3-
Summary of the most important non-obvious PasDoc features:
6+
Some important non-obvious PasDoc features:
7+
8+
== Input
9+
10+
* link:AutoAbstractOption[--auto-abstract] command-line option allows you to automatically treat the 1st sentence of the description as an abstract.
11+
12+
* You can write entire pages using pasdoc syntax, with all supported link:SupportedTags[@tags]. This way you can use pasdoc like a simple document creation tool. See the link:IntroductionAndConclusion[Introduction and conclusion] documentation.
13+
14+
* By default documentation is read from the source code comments. But you can also write it in separate external files: see the link:ReadDescriptionFromFile[--description] command-line option.
15+
16+
* By default we consider only comments in the `interface` section of the unit. But you can enable parsing also the `implementation` sections, and using comments from it, using the link:ImplementationCommentsOption[--implementation-comments] option.
17+
18+
* By default every comment before an identifier is treated as a documentation. But you can limit this with arbitrary link:CommentMarker[comment markers].
19+
20+
* link:AutoLinkOption[--auto-link] command-line option allows you to avoid writing so many `@link` tags. Identifiers will be automatically turned into links.
21+
22+
* link:MarkdownOption[Markdown support for emphasis, lists, code blocks etc.]
23+
24+
== Output
25+
26+
* Our HTML output has a https://github.com/pasdoc/pasdoc/discussions/230[modern, mobile-friendly design based on Bootstrap]. You can customize it using link:CssOption[--css or --css-based-on-bootstrap] command-line options. You can also add your own HTML code to the output using link:HtmlHeadBodyBeginEndOptions[--html-head, --html-body-begin and --html-body-end] command-line options.
27+
28+
* The documentation of each class can also include link:InheritedMembersOption[inherited members].
29+
30+
* The documentation of each class can have toggable (using checkboxes in HTML) visibility e.g. for protected members. See link:VisibleMembers[--visible-members] command-line option.
31+
32+
* The documentation can point to the source code (file, line number) where given item is declared. It can even link to the online repository (e.g. GitHub) which is a great way to link people from your docs to your code. See the link:SourcePosition[--show-source-position, --source-url-pattern, --source-root] command-line options.
433

5-
* The documentation can be written in an external files (see the link:ReadDescriptionFromFile[--description] command-line option), not only in the source code.
6-
* The documentation comments in the source code may be in the `interface` or (if you use link:ImplementationCommentsOption[--implementation-comments] option) `implementation` section of the unit.
7-
* The documentation can be localized to many languages, see the link:OutputLanguage[--language] command-line option.
8-
* Support for arbitrary (even optional) link:CommentMarker[comment markers].
9-
* You can write entire pages using pasdoc syntax (like @-tags, see link:WritingDocumentation[WritingDocumentation]). This way you can use pasdoc like a simple document creation tool. See the link:IntroductionAndConclusion[IntroductionAndConclusion] documentation.
1034
* You can easily add a search box to your documentation, just pass link:UseTipueSearchOption[--use-tipue-search] command-line option.
35+
36+
* The documentation can be localized to many languages, see the link:OutputLanguage[--language] command-line option.
37+
1138
* link:GraphVizSupport[GraphVizSupport] allows PasDoc to easily incorporate classes inheritance and unit dependency graphs in the documentation.
12-
* link:AutoLinkOption[--auto-link] command-line option allows you to avoid writing @link tags, identifiers will be automatically turned into links.
13-
* link:AutoAbstractOption[--auto-abstract] command-line option allows you to automatically treat the 1st sentence of the description as an abstract.
39+
1440
* link:SpellChecking[Spell checking].
41+
42+
== More
43+
1544
* link:CacheOption[Caching for faster generation of documentation].
16-
* link:MarkdownOption[Markdown support for emphasis, lists, code blocks etc.]
1745

18-
If you want to compare link:index[PasDoc] to FpDoc (another open-source Pascal documentation tool), see link:PasDocFpDocComparison[PasDocFpDocComparison] .
46+
* See also link:PasDocFpDocComparison[comparison of PasDoc with FpDoc (another open-source Pascal documentation tool)].

src/CommandLine.asciidoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ Read description from this file
3333
link:IncludeInSearchPath[-I, --include]::
3434
Include search path
3535

36+
link:InheritedMembersOption[--inherited-members]::
37+
Include inherited members in the documentation of a class.
38+
3639
-S, --source::
3740
Read source filenames from file, - (single dash) means standard input.
3841

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
:doctitle: --inherited-members command-line option
2+
:sectnums:
3+
:toc: left
4+
:toclevels: 4
5+
6+
## Introduction
7+
8+
Use the command-line option `--inherited-members` to include inherited members in the documentation of a class. This allows to see, at a glance, all members of a given class -- both defined in the given class and inherited from its ancestors.
9+
10+
This feature is only meaningful for the link:HtmlOutput[HTML output format] right now. The inherited members, if requested, are present in the generated output and user has a checkbox (using JavaScript) to show / hide them.
11+
12+
The _"members"_ means all the things declared in a class:
13+
14+
- fields
15+
- properties
16+
- methods
17+
- constants
18+
- types, including nested classes.
19+
20+
## Example
21+
22+
```pascal
23+
type
24+
TBase = class
25+
procedure BaseMethod;
26+
end;
27+
28+
TDerived = class(TBase)
29+
procedure DerivedMethod;
30+
end;
31+
```
32+
33+
By default, documentation of `TDerived` will include only `DerivedMethod`. Use `--inherited-members=default-show` or `--inherited-members=default-hide` to include `BaseMethod` in the documentation of `TDerived`. This reflects the typical usage: if you have an instance of `TDerived`, you can call both `DerivedMethod` and `BaseMethod` on it, so it's useful to have documentation showing both methods on the same page.
34+
35+
## Possible values of --inherited-members
36+
37+
--inherited-members=never::
38+
Do not include inherited members in the documentation of a class. This is the default behavior.
39+
40+
--inherited-members=default-show::
41+
Include inherited members in the documentation of a class. Inherited members are shown by default. User can hide them using a checkbox.
42+
43+
--inherited-members=default-hide::
44+
Include inherited members in the documentation of a class, however they are hidden by default. User can show them using a checkbox.
45+
46+
## Default value and future plans
47+
48+
The `never` remains the default for now, but it may change in the future. We recommend to test your documentation with `--inherited-members=default-hide` and let us know how do you like it (https://github.com/pasdoc/pasdoc/discussions/[e.g. in this discussion thread]).
49+
50+
In our experience, practically the only drawback of using `--inherited-members=default-hide` (versus leaving the default `never`) is that it makes generating HTML documentation a bit slower (as we necessarily generate more content, duplicating a lot of the descriptions). That said, it's not a big difference. For https://castle-engine.io/apidoc/html/index.html[Castle Game Engine API docs], time of generation grew from 1:30 to 2:40 -- not really noticeable, esp. since documentation is updated by CI, so it doesn't really matter that it now takes almost 3 minutes. Again, let us know https://github.com/pasdoc/pasdoc/discussions/[your experience with this option].

src/_Sidebar.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ link:CommandLine[Command Line]: ::
7070
* link:HtmlHeadBodyBeginEndOptions[--html-head, --html-body-begin, --html-body-end]
7171
* link:IgnoreLeadingOption[--ignore-leading]
7272
* link:IgnoreMarkerOption[--ignore-marker]
73+
* link:InheritedMembersOption[--inherited-members]
7374
* link:IntroductionAndConclusion[--introduction, --conclusion, -A, --additional]
7475
* link:ImplicitVisibilityOption[--implicit-visibility]
7576
* link:TrueFalseNilTag[--lowercase-keywords]

src/_includes/sidebar.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@
125125

126126
* [\--ignore-marker](IgnoreMarkerOption)
127127

128+
* [\--inherited-members](InheritedMembersOption)
129+
128130
* [\--introduction, \--conclusion, -A, \--additional](IntroductionAndConclusion)
129131

130132
* [\--implicit-visibility](ImplicitVisibilityOption)

0 commit comments

Comments
 (0)