Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tosca2doc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
CTI Tools
tosca2doc
Commits
0a2c03ff
Commit
0a2c03ff
authored
3 years ago
by
Miguel Angel Reina Ortega
Browse files
Options
Downloads
Patches
Plain Diff
Bug 262 - Handling of newline character and end of text block
Signed-off-by:
reinaortega
<
miguelangel.reinaortega@etsi.org
>
parent
efd233d6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/example.py
+9
-0
9 additions, 0 deletions
src/example.py
with
9 additions
and
0 deletions
src/example.py
+
9
−
0
View file @
0a2c03ff
...
...
@@ -29,10 +29,17 @@ def is_body_of_example(line: str):
Returns true if the line is part of the body of an example.
'''
return
line
==
""
or
\
line
.
startswith
(
"
\n
"
)
or
\
line
.
startswith
(
"
.
"
)
or
\
line
.
startswith
(
"
#
"
)
or
\
line
.
startswith
(
"
"
)
or
\
bool
(
re
.
match
(
r
'
^[a-zA-Z_]*:
'
,
line
))
def
is_last_line
(
line
:
str
,
txt
):
'''
Returns true if it is the last line of the text.
'''
return
line
==
txt
[
len
(
txt
)
-
1
]
def
get_example_file_name
(
line
:
str
):
'''
...
...
@@ -88,6 +95,8 @@ def parse_all_examples(txt):
new_example
=
"
#
"
+
filename
+
"
\n
"
+
linetext
elif
new_example
!=
""
and
is_body_of_example
(
linetext
):
new_example
=
new_example
+
"
\n
"
+
linetext
if
is_last_line
(
line
,
txt
):
res
.
append
(
Example
(
filename
,
new_example
))
elif
len
(
new_example
)
>
0
:
res
.
append
(
Example
(
filename
,
new_example
))
new_example
=
""
...
...
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