schema_salad.makedoc

Module Contents

Classes

MyRenderer

Custom renderer with different representations of selected HTML tags.

ToC

RenderType

Functions

escape_html(s)

Escape HTML but otherwise preserve single quotes.

vocab_type_name(url)

Remove the avro namespace, if any.

has_types(items)

linkto(item)

patch_fenced_code(original_markdown_text, ...)

Reverts fenced code fragments found in the modified contents back to their original definition.

to_id(text)

number_headings(toc, maindoc)

fix_doc(doc)

avrold_doc(j, outdoc, renderlist, redirects, brand, ...)

arg_parser()

Build the argument parser.

main()

Shortcut entrypoint.

makedoc(stdout, schema[, redirects, only, brand, ...])

Emit HTML representation of a given schema.

Attributes

PluginName

basicTypes

schema_salad.makedoc.PluginName
schema_salad.makedoc.escape_html(s)

Escape HTML but otherwise preserve single quotes.

Parameters:

s (str) –

Return type:

str

schema_salad.makedoc.vocab_type_name(url)

Remove the avro namespace, if any.

Parameters:

url (str) –

Return type:

str

schema_salad.makedoc.has_types(items)
Parameters:

items (Any) –

Return type:

List[str]

schema_salad.makedoc.linkto(item)
Parameters:

item (str) –

Return type:

str

class schema_salad.makedoc.MyRenderer(escape=True, allow_harmful_protocols=None)

Bases: mistune.renderers.html.HTMLRenderer

digraph inheritanced9b3aab934 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "BaseRenderer" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled"]; "HTMLRenderer" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="A renderer for converting Markdown to HTML."]; "BaseRenderer" -> "HTMLRenderer" [arrowsize=0.5,style="setlinewidth(0.5)"]; "MyRenderer" [URL="#schema_salad.makedoc.MyRenderer",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Custom renderer with different representations of selected HTML tags."]; "HTMLRenderer" -> "MyRenderer" [arrowsize=0.5,style="setlinewidth(0.5)"]; }

Custom renderer with different representations of selected HTML tags.

heading(text, level, **attrs)

Override HTML heading creation with text IDs.

Parameters:
  • text (str) –

  • level (int) –

  • attrs (Any) –

Return type:

str

text(text)

Don’t escape quotation marks.

Parameters:

text (str) –

Return type:

str

inline_html(html)

Don’t escape characters in predefined HTML within paragraph tags.

Parameters:

html (str) –

Return type:

str

block_html(html)

Don’t escape characters nor wrap predefined HTML within paragraph tags.

Parameters:

html (str) –

Return type:

str

block_code(code, info=None)

Don’t escape quotation marks.

Parameters:
  • code (str) –

  • info (Optional[str]) –

Return type:

str

schema_salad.makedoc.patch_fenced_code(original_markdown_text, modified_markdown_text)

Reverts fenced code fragments found in the modified contents back to their original definition.

Parameters:
  • original_markdown_text (str) –

  • modified_markdown_text (str) –

Return type:

str

schema_salad.makedoc.to_id(text)
Parameters:

text (str) –

Return type:

str

class schema_salad.makedoc.ToC
add_entry(thisdepth, title)

Add an entry to the table of contents.

Parameters:
  • thisdepth (int) –

  • title (str) –

Return type:

str

contents(idn)
Parameters:

idn (str) –

Return type:

str

schema_salad.makedoc.basicTypes = ('https://w3id.org/cwl/salad#null', 'http://www.w3.org/2001/XMLSchema#boolean',...
schema_salad.makedoc.number_headings(toc, maindoc)
Parameters:
  • toc (ToC) –

  • maindoc (str) –

Return type:

str

schema_salad.makedoc.fix_doc(doc)
Parameters:

doc (Union[List[str], str]) –

Return type:

str

class schema_salad.makedoc.RenderType(toc, j, renderlist, redirects, primitiveType)
Parameters:
  • toc (ToC) –

  • j (List[Dict[str, Any]]) –

  • renderlist (List[str]) –

  • redirects (Dict[str, str]) –

  • primitiveType (str) –

typefmt(tp, redirects, nbsp=False, jsonldPredicate=None)
Parameters:
  • tp (Any) –

  • redirects (Dict[str, str]) –

  • nbsp (bool) –

  • jsonldPredicate (Optional[Union[Dict[str, str], str]]) –

Return type:

str

render_type(f, depth)
Parameters:
  • f (Dict[str, Any]) –

  • depth (int) –

Return type:

None

schema_salad.makedoc.avrold_doc(j, outdoc, renderlist, redirects, brand, brandlink, primtype, brandstyle=None, brandinverse=False)
Parameters:
  • j (List[Dict[str, Any]]) –

  • outdoc (IO[Any]) –

  • renderlist (List[str]) –

  • redirects (Dict[str, str]) –

  • brand (str) –

  • brandlink (str) –

  • primtype (str) –

  • brandstyle (Optional[str]) –

  • brandinverse (Optional[bool]) –

Return type:

None

schema_salad.makedoc.arg_parser()

Build the argument parser.

Return type:

argparse.ArgumentParser

schema_salad.makedoc.main()

Shortcut entrypoint.

Return type:

None

schema_salad.makedoc.makedoc(stdout, schema, redirects=None, only=None, brand=None, brandlink=None, primtype=None, brandstyle=None, brandinverse=False)

Emit HTML representation of a given schema.

Parameters:
  • stdout (IO[Any]) –

  • schema (str) –

  • redirects (Optional[List[str]]) –

  • only (Optional[List[str]]) –

  • brand (Optional[str]) –

  • brandlink (Optional[str]) –

  • primtype (Optional[str]) –

  • brandstyle (Optional[str]) –

  • brandinverse (Optional[bool]) –

Return type:

None