Python docs: provide mechanism for documenting constants.

Python docstrings don't work for variables, so I hacked
a special comment format for helping pydown generate Markdown
text for the README.md for the exported constant KM_PER_AU,
or any other constants I may want to expose in the future.
This commit is contained in:
Don Cross
2021-04-01 09:39:51 -04:00
parent 786afdd4eb
commit 4cc2a14a38
6 changed files with 51 additions and 10 deletions

View File

@@ -14,6 +14,7 @@ To get started quickly, here are some [examples](../../demo/python/).
## Contents
- [Topic Index](#topics)
- [Constants](#constants)
- [Classes](#classes)
- [Enumerated Types](#enumerations)
- [Error Types](#errors)
@@ -146,6 +147,18 @@ these are used in function and type names.
---
<a name="constants"></a>
## Constants
---
<a name="KM_PER_AU"></a>
### `KM_PER_AU = 1.4959787069098932e+8`
**The number of kilometers per astronomical unit.**
---
<a name="classes"></a>
## Classes
@@ -1482,7 +1495,7 @@ The caller may pass `ofdate` as `True` to return coordinates relative to the Ear
equator at the specified time, or `False` to use the J2000 equator.
The returned vector has components expressed in astronomical units (AU).
To convert to kilometers, multiply the `x`, `y`, and `z` values by
the constant value `KM_PER_AU`.
the constant value [`KM_PER_AU`](#KM_PER_AU).
| Type | Parameter | Description |
| --- | --- | --- |

View File

@@ -36,7 +36,7 @@ import datetime
import enum
import re
KM_PER_AU = 1.4959787069098932e+8
KM_PER_AU = 1.4959787069098932e+8 #<const> The number of kilometers per astronomical unit.
_CalcMoonCount = 0
@@ -3800,7 +3800,7 @@ def ObserverVector(time, observer, ofdate):
The returned vector has components expressed in astronomical units (AU).
To convert to kilometers, multiply the `x`, `y`, and `z` values by
the constant value `KM_PER_AU`.
the constant value #KM_PER_AU.
Parameters
----------