diff --git a/src/qdox/main.py b/src/qdox/main.py index ff84efa..71eac23 100644 --- a/src/qdox/main.py +++ b/src/qdox/main.py @@ -98,10 +98,13 @@ * `protocol://url/`: protocol://url/ formatting with active link -Pro-tip: +Pro-tips: The module you are documenting must be installed in the active Python environment for `qdox` to read information about the module. + + If you want to output a colon at the end of a paragraph rather than a + heading, place a space after the colon and before the end-of-line. """ # @@ -253,13 +256,13 @@ def set_mode(m): if set_mode.pre: write_html("") set_mode.pre = False + if set_mode.li: + write_html("") + set_mode.li = False if m == "li": write_html("
  • ") set_mode.li = True return old - if set_mode.li: - write_html("
  • ") - set_mode.li = False if set_mode.mode and set_mode.mode != m: set_mode.pre = False if set_mode.mode in ["ul","ol"]: @@ -287,7 +290,7 @@ def write_class(name,value): write_html("

    ") elif line.startswith(" "): set_mode("ul") - part = line.strip().split(":",1) + part = line.strip().split(": ",1) if len(part) == 2: write_html(f"

  • {part[0]}: ",md=False,nl=False) write_html(f"{part[1]}
  • ",nl=True) @@ -321,7 +324,7 @@ def write_class(name,value): write_html("

    ") elif line.startswith(" "): set_mode("ul") - part = line.strip().split(":",1) + part = line.strip().split(": ",1) if len(part) == 2: write_html(f"

  • {part[0]}: ",md=False,nl=False) write_html(f"{part[1]}
  • ",nl=True) @@ -402,7 +405,7 @@ def write_function(name,value): write_html("

    ") elif line.startswith(" "): set_mode("ul") - part = line.strip().split(":",1) + part = line.strip().split(": ",1) if len(part) == 2: write_html(f"

  • {part[0]}: ",md=False,nl=False) write_html(f"{part[1]}
  • ",nl=True) @@ -481,8 +484,8 @@ def write_function(name,value): elif line.startswith(" * "): set_mode("ul") line = line.split('*',1)[1][1:] - if ":" in line: - part = line.split(":",1) + if ": " in line: + part = line.split(": ",1) set_mode("li") write_html(f"\n{part[0]}: {part[1]}") elif line.strip(): @@ -521,13 +524,13 @@ def write_function(name,value): continue value = getattr(module,name) set_mode(None) - if type(value) is type: + if isinstance(value,type): write_class(name,value) elif callable(value): write_function(name,value) set_mode(None) - # document metadata + # document constants constant_header = False for name in dir(module): if name.startswith("__"): @@ -537,8 +540,9 @@ def write_function(name,value): if not constant_header: write_html("""

    Python Constants

    """) constant_header = True - write_html(f"

    `{name} = {value}`") + write_html(f"

    `{name} = {repr(value)}`") + # document metadata write_html("""\n

    Package Metadata

    \n""") write_html("""

    \n""") for key,data in package.items():