Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Y
yang2rdf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Package Registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
huawei
yang2rdf
Commits
1428923c
Verified
Commit
1428923c
authored
1 week ago
by
Thibault Ehrhart
Browse files
Options
Downloads
Patches
Plain Diff
feat(augment_yin): remove leading slash from target-node attribute
parent
d2f3e253
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
yang2rdf/augment_yin.py
+15
-0
15 additions, 0 deletions
yang2rdf/augment_yin.py
with
15 additions
and
0 deletions
yang2rdf/augment_yin.py
+
15
−
0
View file @
1428923c
...
...
@@ -119,6 +119,14 @@ def augment_element(
]:
# Generate ID attribute
name
=
element
.
attrib
.
get
(
"
name
"
)
or
element
.
attrib
.
get
(
"
target-node
"
)
# Remove leading slash from target-node if present (especially for deviations)
if
name
and
name
.
startswith
(
"
/
"
):
name
=
name
.
lstrip
(
"
/
"
)
# Update the actual target-node attribute if it exists
if
"
target-node
"
in
element
.
attrib
:
element
.
attrib
[
"
target-node
"
]
=
name
if
parent_id
==
module_name
:
current_id
=
name
else
:
...
...
@@ -143,6 +151,13 @@ def augment_element(
for
child
in
element
:
child_name
=
child
.
attrib
.
get
(
"
name
"
)
or
child
.
attrib
.
get
(
"
target-node
"
)
if
child_name
:
# Remove leading slash if present
if
child_name
.
startswith
(
"
/
"
):
child_name
=
child_name
.
lstrip
(
"
/
"
)
# Update the actual target-node attribute if it exists
if
"
target-node
"
in
child
.
attrib
:
child
.
attrib
[
"
target-node
"
]
=
child_name
if
child_name
in
child_counts
:
child_counts
[
child_name
]
+=
1
child
.
set
(
...
...
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