Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CTI Tools
tosca2doc
Commits
6069e204
Commit
6069e204
authored
Nov 30, 2020
by
carignani
Browse files
remove 'generated' prefix, fix test, fix regex to parse example body
parent
00ac479b
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/doc2tosca.py
View file @
6069e204
...
...
@@ -14,7 +14,7 @@ from docx.text.paragraph import Paragraph
from
example
import
generate_examples_between
BASE_FILENAME
=
"
generated_
etsi_nfv_sol001_{}_{}_types.yaml"
BASE_FILENAME
=
"etsi_nfv_sol001_{}_{}_types.yaml"
TOSCA_VERSION
=
"tosca_simple_yaml_1_2"
DEFAULT_TOSCA_VERSION
=
"tosca_simple_yaml_1_2"
SPEC_VERSION
=
"v2.6.1"
...
...
src/example.py
View file @
6069e204
...
...
@@ -27,17 +27,15 @@ def is_body_of_example(line: str):
'''
Returns true if the line is part of the body of an example.
'''
return
line
.
startswith
(
"imports:"
)
or
\
line
.
startswith
(
"node_types:"
)
or
\
line
.
startswith
(
"topology_template:"
)
or
\
line
.
startswith
(
"description:"
)
or
\
line
.
startswith
(
"data_types:"
)
or
\
line
.
startswith
(
" "
)
or
\
line
.
startswith
(
" "
)
or
\
line
==
""
return
line
==
""
or
\
line
.
startswith
(
"."
)
or
\
line
.
startswith
(
"#"
)
or
\
line
.
startswith
(
" "
)
or
\
bool
(
re
.
match
(
r
'^[a-zA-Z_]*:'
,
line
))
def
get_example_file_name
(
line
:
str
):
'''
Looks for the YAML filename in the line of text
'''
matches
=
re
.
search
(
r
'[a-zA-Z0-9_.]*.yaml'
,
line
)
if
matches
is
not
None
:
...
...
src/test_doc2tosca.py
View file @
6069e204
...
...
@@ -397,7 +397,7 @@ MyExampleNS_2.yaml:"""
line3
=
"""Virtual IP address connection points (VipCps) are used to allocate one or multiple IP addresses that are shared by other CP instances, which may be instances of the same or of different VduCp or VnfExtCp nodes."""
assert
d2t
.
get_example_file_name
(
line1
)
==
"MyExampleNS_2.yaml"
assert
d2t
.
get_example_file_name
(
line2
)
==
"MyExampleNs_Type.yaml"
assert
d2t
.
get_example_file_name
(
line3
)
==
""
assert
exp
.
get_example_file_name
(
line1
)
==
"MyExampleNS_2.yaml"
assert
exp
.
get_example_file_name
(
line2
)
==
"MyExampleNs_Type.yaml"
assert
exp
.
get_example_file_name
(
line3
)
==
""
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment