Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
otb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main Repositories
otb
Commits
ad2e69b5
Commit
ad2e69b5
authored
6 years ago
by
Victor Poughon
Browse files
Options
Downloads
Patches
Plain Diff
DOC: add automatic internal links in app description
parent
4ea627a8
No related branches found
No related tags found
2 merge requests
!621
Release 7.0 (master)
,
!316
Christmas CookBook
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Documentation/Cookbook/Scripts/otbGenerateWrappersRstDoc.py
+17
-3
17 additions, 3 deletions
Documentation/Cookbook/Scripts/otbGenerateWrappersRstDoc.py
Documentation/Cookbook/rst/templates/application.rst
+2
-0
2 additions, 0 deletions
Documentation/Cookbook/rst/templates/application.rst
with
19 additions
and
3 deletions
Documentation/Cookbook/Scripts/otbGenerateWrappersRstDoc.py
+
17
−
3
View file @
ad2e69b5
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
import
os
import
os
import
sys
import
sys
import
argparse
import
argparse
import
re
import
otbApplication
import
otbApplication
from
otbApplication
import
ParameterType_Bool
,
ParameterType_Int
,
ParameterType_Radius
,
ParameterType_RAM
,
ParameterType_Float
,
ParameterType_String
,
ParameterType_StringList
,
ParameterType_InputFilename
,
ParameterType_OutputFilename
,
ParameterType_InputImage
,
ParameterType_ComplexInputImage
,
ParameterType_OutputImage
,
ParameterType_ComplexOutputImage
,
ParameterType_InputVectorData
,
ParameterType_OutputVectorData
,
ParameterType_Directory
,
ParameterType_Choice
,
ParameterType_InputImageList
,
ParameterType_InputVectorDataList
,
ParameterType_InputFilenameList
,
ParameterType_InputProcessXML
,
ParameterType_OutputProcessXML
,
ParameterType_ListView
,
ParameterType_Group
from
otbApplication
import
ParameterType_Bool
,
ParameterType_Int
,
ParameterType_Radius
,
ParameterType_RAM
,
ParameterType_Float
,
ParameterType_String
,
ParameterType_StringList
,
ParameterType_InputFilename
,
ParameterType_OutputFilename
,
ParameterType_InputImage
,
ParameterType_ComplexInputImage
,
ParameterType_OutputImage
,
ParameterType_ComplexOutputImage
,
ParameterType_InputVectorData
,
ParameterType_OutputVectorData
,
ParameterType_Directory
,
ParameterType_Choice
,
ParameterType_InputImageList
,
ParameterType_InputVectorDataList
,
ParameterType_InputFilenameList
,
ParameterType_InputProcessXML
,
ParameterType_OutputProcessXML
,
ParameterType_ListView
,
ParameterType_Group
...
@@ -355,7 +356,19 @@ def render_see_also(app):
...
@@ -355,7 +356,19 @@ def render_see_also(app):
else
:
else
:
return
rst_section
(
"
See also
"
,
"
-
"
)
+
see_also
return
rst_section
(
"
See also
"
,
"
-
"
)
+
see_also
def
render_application
(
appname
):
def
multireplace
(
string
,
replacements
):
"
multiple string replace (from https://stackoverflow.com/a/6117124/5815110)
"
substrs
=
sorted
(
replacements
,
key
=
len
,
reverse
=
True
)
regexp
=
re
.
compile
(
'
|
'
.
join
(
map
(
re
.
escape
,
substrs
)))
return
regexp
.
sub
(
lambda
match
:
replacements
[
match
.
group
(
0
)],
string
)
def
make_links
(
text
,
allapps
):
"
Replace name of applications by internal rst links
"
rep
=
{
appname
:
"
:ref:`{}`
"
.
format
(
"
app-
"
+
appname
)
for
appname
in
allapps
}
return
multireplace
(
text
,
rep
)
def
render_application
(
appname
,
allapps
):
"
Render app to rst
"
"
Render app to rst
"
app
=
otbApplication
.
Registry
.
CreateApplication
(
appname
)
app
=
otbApplication
.
Registry
.
CreateApplication
(
appname
)
...
@@ -368,9 +381,10 @@ def render_application(appname):
...
@@ -368,9 +381,10 @@ def render_application(appname):
parameters
=
rst_parameters
(
app
)
parameters
=
rst_parameters
(
app
)
output
=
template_application
.
format
(
output
=
template_application
.
format
(
label
=
"
app-
"
+
appname
,
heading
=
rst_section
(
app
.
GetName
(),
'
=
'
),
heading
=
rst_section
(
app
.
GetName
(),
'
=
'
),
description
=
app
.
GetDescription
(),
description
=
app
.
GetDescription
(),
longdescription
=
app
.
GetDocLongDescription
(),
longdescription
=
make_links
(
app
.
GetDocLongDescription
(),
allapps
),
parameters
=
parameters
,
parameters
=
parameters
,
examples_cli
=
render_all_examples_cli
(
app
),
examples_cli
=
render_all_examples_cli
(
app
),
examples_python
=
render_all_examples_python
(
app
),
examples_python
=
render_all_examples_python
(
app
),
...
@@ -434,7 +448,7 @@ def GenerateRstForApplications(rst_dir):
...
@@ -434,7 +448,7 @@ def GenerateRstForApplications(rst_dir):
# Write application rst
# Write application rst
#print("Generating " + appName + ".rst" + " on tag " + tag)
#print("Generating " + appName + ".rst" + " on tag " + tag)
with
open
(
rst_dir
+
'
/Applications/app_
'
+
appName
+
'
.rst
'
,
'
w
'
)
as
appFile
:
with
open
(
rst_dir
+
'
/Applications/app_
'
+
appName
+
'
.rst
'
,
'
w
'
)
as
appFile
:
appFile
.
write
(
render_application
(
appName
))
appFile
.
write
(
render_application
(
appName
,
appNames
))
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
parser
=
argparse
.
ArgumentParser
(
usage
=
"
Export application(s) to rst file
"
)
parser
=
argparse
.
ArgumentParser
(
usage
=
"
Export application(s) to rst file
"
)
...
...
This diff is collapsed.
Click to expand it.
Documentation/Cookbook/rst/templates/application.rst
+
2
−
0
View file @
ad2e69b5
.. _{label}:
{heading}
{heading}
{description}
{description}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment