Functions | |
def | fix_content_in_tags (input_html) |
BS puts each tag/content in its own line. More... | |
def | fix_include_file_extension (input_html) |
def | fix_replace_space_marker (input_html) |
def | inject_top_level_docs (input_html, filename) |
def | strip_text_before_string (original_text, strip_text) |
Variables | |
dialect_files = set() | |
dom = ET.fromstring(xml_file) | |
string | index_file_name = "README.md" |
string | index_text |
string | markdown_text = '' |
newdom = transform(dom) | |
string | output_dir = "./messages/" |
string | output_dir_html = output_dir+"_html/" |
string | output_file_name_html = file.rsplit('.',1)[0]+".html" |
output_file_name_html_withdir = output_dir_html+output_file_name_html | |
string | output_file_name_md_withdir = output_dir+output_file_name_prefix+'.md' |
output_file_name_prefix = file.rsplit('.',1)[0] | |
prettyHTML = soup.prettify() | |
soup = bs(str(newdom), "lxml") | |
transform = ET.XSLT(xslt) | |
xml_file = content_file.read() | |
xml_file_name = xml_message_definitions_dir_name+file | |
string | xml_message_definitions_dir_name = "../message_definitions/v1.0/" |
xsl_file = content_file.read() | |
string | xsl_file_name = "mavlink_to_html_table_gitbook.xsl" |
xslt = ET.fromstring(xsl_file) | |
This script generates markdown files for all the MAVLink message definition XML at: https://github.com/mavlink/mavlink/tree/master/message_definitions/v1.0 The files can be imported into a gitbook to display the messages as HTML The script runs on both Python2 and Python 3. The following libraries must be imported: lxml, requests, bs4. The file is run in mavlink/doc/ with no arguments. It writes the files to /messages/
def mavlink_gitbook.fix_content_in_tags | ( | input_html | ) |
BS puts each tag/content in its own line.
Gitbook generates anchors using the spaces/newlines. This puts displayed text content immediately within tags so that anchors/links generate properly
Definition at line 59 of file mavlink_gitbook.py.
def mavlink_gitbook.fix_include_file_extension | ( | input_html | ) |
Definition at line 68 of file mavlink_gitbook.py.
def mavlink_gitbook.fix_replace_space_marker | ( | input_html | ) |
Definition at line 73 of file mavlink_gitbook.py.
def mavlink_gitbook.inject_top_level_docs | ( | input_html, | |
filename | |||
) |
Definition at line 87 of file mavlink_gitbook.py.
def mavlink_gitbook.strip_text_before_string | ( | original_text, | |
strip_text | |||
) |
Definition at line 79 of file mavlink_gitbook.py.
mavlink_gitbook.dialect_files = set() |
Definition at line 137 of file mavlink_gitbook.py.
mavlink_gitbook.dom = ET.fromstring(xml_file) |
Definition at line 147 of file mavlink_gitbook.py.
mavlink_gitbook.index_file_name = "README.md" |
Definition at line 31 of file mavlink_gitbook.py.
string mavlink_gitbook.index_text |
Definition at line 40 of file mavlink_gitbook.py.
mavlink_gitbook.markdown_text = '' |
Definition at line 178 of file mavlink_gitbook.py.
Definition at line 149 of file mavlink_gitbook.py.
string mavlink_gitbook.output_dir = "./messages/" |
Definition at line 24 of file mavlink_gitbook.py.
string mavlink_gitbook.output_dir_html = output_dir+"_html/" |
Definition at line 25 of file mavlink_gitbook.py.
string mavlink_gitbook.output_file_name_html = file.rsplit('.',1)[0]+".html" |
Definition at line 166 of file mavlink_gitbook.py.
mavlink_gitbook.output_file_name_html_withdir = output_dir_html+output_file_name_html |
Definition at line 168 of file mavlink_gitbook.py.
string mavlink_gitbook.output_file_name_md_withdir = output_dir+output_file_name_prefix+'.md' |
Definition at line 182 of file mavlink_gitbook.py.
mavlink_gitbook.output_file_name_prefix = file.rsplit('.',1)[0] |
Definition at line 176 of file mavlink_gitbook.py.
mavlink_gitbook.prettyHTML = soup.prettify() |
Definition at line 153 of file mavlink_gitbook.py.
mavlink_gitbook.soup = bs(str(newdom), "lxml") |
Definition at line 152 of file mavlink_gitbook.py.
mavlink_gitbook.transform = ET.XSLT(xslt) |
Definition at line 148 of file mavlink_gitbook.py.
mavlink_gitbook.xml_file = content_file.read() |
Definition at line 146 of file mavlink_gitbook.py.
mavlink_gitbook.xml_file_name = xml_message_definitions_dir_name+file |
Definition at line 144 of file mavlink_gitbook.py.
string mavlink_gitbook.xml_message_definitions_dir_name = "../message_definitions/v1.0/" |
Definition at line 22 of file mavlink_gitbook.py.
mavlink_gitbook.xsl_file = content_file.read() |
Definition at line 36 of file mavlink_gitbook.py.
string mavlink_gitbook.xsl_file_name = "mavlink_to_html_table_gitbook.xsl" |
Definition at line 21 of file mavlink_gitbook.py.
mavlink_gitbook.xslt = ET.fromstring(xsl_file) |
Definition at line 37 of file mavlink_gitbook.py.