kopia lustrzana https://github.com/OpenDroneMap/docs
consolidate to single arguments file
rodzic
da96707553
commit
fa5e3e1efa
|
@ -1,10 +1,5 @@
|
||||||
..
|
|
||||||
AUTO-GENERATED by extract_odm_strings.py! DO NOT EDIT!
|
|
||||||
If you want to add more details to a command, create a
|
|
||||||
.rst file in arguments_edit/<argument>.rst
|
|
||||||
|
|
||||||
.. _$opt:
|
|
||||||
|
|
||||||
|
$ticks
|
||||||
$opt
|
$opt
|
||||||
$ticks
|
$ticks
|
||||||
|
|
||||||
|
@ -12,6 +7,12 @@ $parameter
|
||||||
|
|
||||||
$descr
|
$descr
|
||||||
|
|
||||||
$include
|
$edit
|
||||||
|
|
||||||
`Learn to edit <https://github.com/opendronemap/docs#how-to-make-your-first-contribution>`_ and help improve `this page <https://github.com/OpenDroneMap/docs/blob/publish/source/$editfile>`_!
|
|
||||||
|
.. raw:: html
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<hr style="border-top: 6px double #8c8b8b">
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
|
|
@ -1,13 +1,18 @@
|
||||||
|
..
|
||||||
|
AUTO-GENERATED by extract_odm_strings.py! DO NOT EDIT!
|
||||||
|
If you want to add more details to a command, edit a
|
||||||
|
.rst file in arguments_edit/<argument>.rst
|
||||||
|
|
||||||
|
|
||||||
|
#################
|
||||||
Options and Flags
|
Options and Flags
|
||||||
-----------------
|
#################
|
||||||
|
|
||||||
$arguments
|
If you want to add more details to a command, `learn to edit <https://github.com/opendronemap/docs#how-to-make-your-first-contribution>`_ and help improve the matching file in the ``arguments_edit`` `project folder <https://github.com/OpenDroneMap/docs/tree/publish/source/arguments_edit>`_!
|
||||||
|
|
||||||
|
.. raw:: html
|
||||||
|
|
||||||
`Learn to edit <https://github.com/opendronemap/docs#how-to-make-your-first-contribution>`_ and help improve `this page <https://github.com/OpenDroneMap/docs/blob/publish/source/arguments.rst>`_!
|
<br>
|
||||||
|
<hr style="border-top: 6px double #8c8b8b">
|
||||||
.. toctree::
|
<br>
|
||||||
:maxdepth: 1
|
<br>
|
||||||
:glob:
|
|
||||||
|
|
||||||
arguments/*
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
import argparse, os, urllib.request, ast, sys
|
import argparse, os, urllib.request, ast, sys
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
from string import Template
|
from string import Template
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description='Extract ODM strings.')
|
parser = argparse.ArgumentParser(description='Extract ODM strings.')
|
||||||
parser.add_argument('input', type=str,
|
parser.add_argument('input', type=str,
|
||||||
|
@ -106,7 +107,7 @@ if len(options) > 0:
|
||||||
def get_opt_choices(opt):
|
def get_opt_choices(opt):
|
||||||
return options[opt].get('choices', options[opt].get('metavar', '')).replace('[', '').replace(']', '').replace(',', ' | ').replace('\'', '')
|
return options[opt].get('choices', options[opt].get('metavar', '')).replace('[', '').replace(']', '').replace(',', ' | ').replace('\'', '')
|
||||||
|
|
||||||
for opt in keys:
|
for idx,opt in enumerate(keys):
|
||||||
opt_name = get_opt_name(opt)
|
opt_name = get_opt_name(opt)
|
||||||
|
|
||||||
include_file = os.path.join(argsoutdir + "_edit", "%s.rst" % opt_name)
|
include_file = os.path.join(argsoutdir + "_edit", "%s.rst" % opt_name)
|
||||||
|
@ -115,37 +116,27 @@ if len(options) > 0:
|
||||||
f.write("\n")
|
f.write("\n")
|
||||||
print("Wrote %s" % include_file)
|
print("Wrote %s" % include_file)
|
||||||
|
|
||||||
|
argument_edit = Path(include_file).read_text()
|
||||||
|
|
||||||
kwargs = {
|
kwargs = {
|
||||||
'opt': opt_name,
|
'opt': opt_name,
|
||||||
'ticks': '`' * len(opt_name),
|
'ticks': '*' * len(opt_name),
|
||||||
'descr': get_opt_descr(opt),
|
'descr': get_opt_descr(opt),
|
||||||
'parameter': "**Options:** *%s*" % get_opt_choices(opt) if get_opt_choices(opt) else "",
|
'parameter': "**Options:** *%s*" % get_opt_choices(opt) if get_opt_choices(opt) else "",
|
||||||
'include': ".. include:: ../arguments_edit/%s" % os.path.basename(include_file),
|
# 'include': ".. include:: ../arguments_edit/%s" % os.path.basename(include_file),
|
||||||
'editfile': os.path.join("arguments_edit", os.path.basename(include_file)),
|
'editfile': os.path.join("arguments_edit", os.path.basename(include_file)),
|
||||||
|
'edit': argument_edit,
|
||||||
}
|
}
|
||||||
|
|
||||||
argsoutfile = os.path.join(argsoutdir, opt_name + ".rst")
|
arg = argstmpl.substitute(**kwargs)
|
||||||
with open(argsoutfile, "w") as f:
|
|
||||||
f.write(argstmpl.substitute(**kwargs))
|
|
||||||
print("Wrote %s" % argsoutfile)
|
|
||||||
|
|
||||||
for opt in keys:
|
|
||||||
subst += ":ref:`%s<%s>` %s\n %s\n\n" % (
|
|
||||||
get_opt_name(opt),
|
|
||||||
get_opt_name(opt),
|
|
||||||
get_opt_choices(opt),
|
|
||||||
get_opt_descr(opt)
|
|
||||||
)
|
|
||||||
|
|
||||||
with open(tmplfile) as f:
|
|
||||||
tmpl = Template(f.read())
|
|
||||||
|
|
||||||
|
|
||||||
|
if idx == 0:
|
||||||
|
header = Path(tmplfile).read_text()
|
||||||
with open(outfile, "w") as f:
|
with open(outfile, "w") as f:
|
||||||
f.write(tmpl.substitute(arguments=subst))
|
f.write(header)
|
||||||
|
|
||||||
print("Wrote %s" % outfile)
|
|
||||||
|
|
||||||
|
with open(outfile, "a") as f:
|
||||||
|
f.write(arg)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print("No strings found")
|
print("No strings found")
|
1906
source/arguments.rst
1906
source/arguments.rst
Plik diff jest za duży
Load Diff
|
@ -62,7 +62,7 @@ language = 'en'
|
||||||
# List of patterns, relative to source directory, that match files and
|
# List of patterns, relative to source directory, that match files and
|
||||||
# directories to ignore when looking for source files.
|
# directories to ignore when looking for source files.
|
||||||
# This pattern also affects html_static_path and html_extra_path .
|
# This pattern also affects html_static_path and html_extra_path .
|
||||||
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
|
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'arguments_edit']
|
||||||
|
|
||||||
# The name of the Pygments (syntax highlighting) style to use.
|
# The name of the Pygments (syntax highlighting) style to use.
|
||||||
pygments_style = 'sphinx'
|
pygments_style = 'sphinx'
|
||||||
|
|
Ładowanie…
Reference in New Issue