mirror of
https://github.com/chipsec/chipsec
synced 2026-06-08 13:31:00 +00:00
Updated processing of options documentation
With the switch to argparse a number of small issues were seen in the exported PDF. This script cleans up some of the formatting issues by moving the options output to a preformatted/code section. Signed-off-by: Erik Bjorge <erik.c.bjorge@intel.com>
This commit is contained in:
@@ -13,6 +13,8 @@ call python chipsec_main.py -h > %TARGET%\docs\sphinx\options.rst
|
||||
popd
|
||||
|
||||
pushd %TARGET%\docs\sphinx
|
||||
:: Update options.rst to make it a preformatted block
|
||||
call python options.py
|
||||
|
||||
call sphinx-apidoc -e -f -T -o modules %TARGET%
|
||||
call python removeStrRst.py
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
#CHIPSEC: Platform Security Assessment Framework
|
||||
#Copyright (c) 2019, Intel Corporation
|
||||
#
|
||||
#This program is free software; you can redistribute it and/or
|
||||
#modify it under the terms of the GNU General Public License
|
||||
#as published by the Free Software Foundation; Version 2.
|
||||
#
|
||||
#This program is distributed in the hope that it will be useful,
|
||||
#but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
#GNU General Public License for more details.
|
||||
#
|
||||
#You should have received a copy of the GNU General Public License
|
||||
#along with this program; if not, write to the Free Software
|
||||
#Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
#Contact information:
|
||||
#chipsec@intel.com
|
||||
#
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
cwd = os.path.abspath(os.getcwd())
|
||||
options_file = os.path.join(cwd, 'options.rst')
|
||||
|
||||
if not os.path.isfile(options_file):
|
||||
sys.exit(255)
|
||||
|
||||
with open(options_file, 'r') as f:
|
||||
lines = f.readlines()
|
||||
|
||||
new_lines = []
|
||||
new_lines.append('::\n')
|
||||
new_lines.append('\n')
|
||||
for line in lines:
|
||||
if '--' in line and line.lstrip().find('--') != 0:
|
||||
slice_location = line.find('--')
|
||||
new_lines.append(' {}\n'.format(line[:slice_location]))
|
||||
new_lines.append(' {}'.format(line[slice_location:]))
|
||||
else:
|
||||
new_lines.append(' {}'.format(line))
|
||||
new_lines.append('\n')
|
||||
|
||||
with open(options_file, 'w') as f:
|
||||
f.writelines(new_lines)
|
||||
|
||||
sys.exit(0)
|
||||
Reference in New Issue
Block a user