Functions | Variables
mavlink_gitbook Namespace Reference

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"
 
string 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()
 
string 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)
 

Detailed Description

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/

Function Documentation

◆ fix_content_in_tags()

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.

◆ fix_include_file_extension()

def mavlink_gitbook.fix_include_file_extension (   input_html)

Definition at line 68 of file mavlink_gitbook.py.

◆ fix_replace_space_marker()

def mavlink_gitbook.fix_replace_space_marker (   input_html)

Definition at line 73 of file mavlink_gitbook.py.

◆ inject_top_level_docs()

def mavlink_gitbook.inject_top_level_docs (   input_html,
  filename 
)

Definition at line 87 of file mavlink_gitbook.py.

◆ strip_text_before_string()

def mavlink_gitbook.strip_text_before_string (   original_text,
  strip_text 
)

Definition at line 79 of file mavlink_gitbook.py.

Variable Documentation

◆ dialect_files

mavlink_gitbook.dialect_files = set()

Definition at line 137 of file mavlink_gitbook.py.

◆ dom

mavlink_gitbook.dom = ET.fromstring(xml_file)

Definition at line 147 of file mavlink_gitbook.py.

◆ index_file_name

string mavlink_gitbook.index_file_name = "README.md"

Definition at line 31 of file mavlink_gitbook.py.

◆ index_text

string mavlink_gitbook.index_text
Initial value:
1 = """<!-- THIS FILE IS AUTO-GENERATED (DO NOT UPDATE GITBOOK): https://github.com/mavlink/mavlink/blob/master/doc/mavlink_gitbook.py -->
2 # Dialects {#dialects}
3 
4 MAVLink *dialects* are XML files that define *protocol-* and *vendor-specific* messages, enums and commands.
5 
6 Dialects may *include* other MAVLink XML files.
7 A typical pattern is for a dialect to include [common.xml](../messages/common.md) (containing the *MAVLink standard definitions*), extending it with vendor or protocol specific messages.
8 While a dialect can include any other message definition, only only a single level of nesting is supported ([at time of writing](https://github.com/ArduPilot/pymavlink/pull/248)).
9 
10 > **Note** Vendor forks of MAVLink may contain dialect messages that are not yet merged, and hence will not appear in this documentation.
11 
12 The dialect files are stored alongside in separate XML files in [mavlink/message definitions](https://github.com/mavlink/mavlink/blob/master/message_definitions/).
13 
14 The human-readable forms of the XML dialect files are linked below:
15 """

Definition at line 40 of file mavlink_gitbook.py.

◆ markdown_text

def mavlink_gitbook.markdown_text = ''

Definition at line 178 of file mavlink_gitbook.py.

◆ newdom

mavlink_gitbook.newdom = transform(dom)

Definition at line 149 of file mavlink_gitbook.py.

◆ output_dir

string mavlink_gitbook.output_dir = "./messages/"

Definition at line 24 of file mavlink_gitbook.py.

◆ output_dir_html

string mavlink_gitbook.output_dir_html = output_dir+"_html/"

Definition at line 25 of file mavlink_gitbook.py.

◆ output_file_name_html

string mavlink_gitbook.output_file_name_html = file.rsplit('.',1)[0]+".html"

Definition at line 166 of file mavlink_gitbook.py.

◆ output_file_name_html_withdir

string mavlink_gitbook.output_file_name_html_withdir = output_dir_html+output_file_name_html

Definition at line 168 of file mavlink_gitbook.py.

◆ output_file_name_md_withdir

string mavlink_gitbook.output_file_name_md_withdir = output_dir+output_file_name_prefix+'.md'

Definition at line 182 of file mavlink_gitbook.py.

◆ output_file_name_prefix

mavlink_gitbook.output_file_name_prefix = file.rsplit('.',1)[0]

Definition at line 176 of file mavlink_gitbook.py.

◆ prettyHTML

def mavlink_gitbook.prettyHTML = soup.prettify()

Definition at line 153 of file mavlink_gitbook.py.

◆ soup

mavlink_gitbook.soup = bs(str(newdom), "lxml")

Definition at line 152 of file mavlink_gitbook.py.

◆ transform

mavlink_gitbook.transform = ET.XSLT(xslt)

Definition at line 148 of file mavlink_gitbook.py.

◆ xml_file

mavlink_gitbook.xml_file = content_file.read()

Definition at line 146 of file mavlink_gitbook.py.

◆ xml_file_name

string mavlink_gitbook.xml_file_name = xml_message_definitions_dir_name+file

Definition at line 144 of file mavlink_gitbook.py.

◆ xml_message_definitions_dir_name

string mavlink_gitbook.xml_message_definitions_dir_name = "../message_definitions/v1.0/"

Definition at line 22 of file mavlink_gitbook.py.

◆ xsl_file

mavlink_gitbook.xsl_file = content_file.read()

Definition at line 36 of file mavlink_gitbook.py.

◆ xsl_file_name

string mavlink_gitbook.xsl_file_name = "mavlink_to_html_table_gitbook.xsl"

Definition at line 21 of file mavlink_gitbook.py.

◆ xslt

mavlink_gitbook.xslt = ET.fromstring(xsl_file)

Definition at line 37 of file mavlink_gitbook.py.



mavlink
Author(s): Lorenz Meier
autogenerated on Fri Aug 2 2019 03:39:47