forked from Archive/PX4-Autopilot
px_process_airframes: add image path as optional argument for markdown output
usage: ./px_process_airframes.py -m -i ../image/path
This commit is contained in:
parent
63af349bba
commit
41e53ef949
|
@ -1,8 +1,9 @@
|
|||
from xml.sax.saxutils import escape
|
||||
import codecs
|
||||
import os
|
||||
|
||||
class MarkdownTablesOutput():
|
||||
def __init__(self, groups, board):
|
||||
def __init__(self, groups, board, image_path):
|
||||
result = ("# Airframes Reference\n"
|
||||
"> **Note** **This list is auto-generated from the source code**.\n"
|
||||
"> \n"
|
||||
|
@ -28,7 +29,8 @@ class MarkdownTablesOutput():
|
|||
image_name = group.GetImageName()
|
||||
result += '<div>\n'
|
||||
if image_name != 'AirframeUnknown':
|
||||
result += '<img src="../../assets/airframes/types/%s.svg" width="29%%" style="max-height: 180px;"/>\n' % (image_name)
|
||||
image_name = os.path.join(image_path, image_name)
|
||||
result += '<img src="%s.svg" width="29%%" style="max-height: 180px;"/>\n' % (image_name)
|
||||
|
||||
# check if all outputs are equal for the group: if so, show them
|
||||
# only once
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
############################################################################
|
||||
#
|
||||
# Copyright (C) 2013-2015 PX4 Development Team. All rights reserved.
|
||||
# Copyright (C) 2013-2017 PX4 Development Team. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
|
@ -35,10 +35,11 @@
|
|||
#
|
||||
# PX4 airframe config processor (main executable file)
|
||||
#
|
||||
# This tool scans the PX4 source code for declarations of airframes
|
||||
# This tool scans the PX4 ROMFS code for declarations of airframes
|
||||
#
|
||||
# Currently supported formats are:
|
||||
# * XML for the parametric UI generator
|
||||
# * Markdown for the PX4 dev guide (https://github.com/PX4/Devguide)
|
||||
#
|
||||
#
|
||||
|
||||
|
@ -67,6 +68,12 @@ def main():
|
|||
metavar="FILENAME",
|
||||
help="Create Markdown file"
|
||||
" (default FILENAME: airframes_reference.md)")
|
||||
default_image_path = '../../assets/airframes/types'
|
||||
parser.add_argument("-i", "--image-path",
|
||||
default=default_image_path,
|
||||
metavar="IMAGEPATH",
|
||||
help="HTML image path for Markdown (containing the airframe svg files)"
|
||||
" (default IMAGEPATH: "+default_image_path+")")
|
||||
parser.add_argument("-s", "--start-script",
|
||||
nargs='?',
|
||||
const="rc.autostart",
|
||||
|
@ -108,7 +115,7 @@ def main():
|
|||
# Output to markdown file
|
||||
if args.markdown:
|
||||
if args.verbose: print("Creating markdown file " + args.markdown)
|
||||
out = markdownout.MarkdownTablesOutput(param_groups, args.board)
|
||||
out = markdownout.MarkdownTablesOutput(param_groups, args.board, args.image_path)
|
||||
out.Save(args.markdown)
|
||||
|
||||
if args.start_script:
|
||||
|
|
Loading…
Reference in New Issue