Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
unicado.gitlab.io
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
Service Desk
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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
UNICADO
unicado.gitlab.io
Commits
2dee08bc
Commit
2dee08bc
authored
6 months ago
by
Kristina Mazur
Browse files
Options
Downloads
Patches
Plain Diff
Initial adaptions (but make wrong output)
parent
91a9d945
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitlab-ci.yml
+4
-4
4 additions, 4 deletions
.gitlab-ci.yml
scripts/csmr-2020_startCSD.xml
+757
-0
757 additions, 0 deletions
scripts/csmr-2020_startCSD.xml
scripts/document_aircraft_xml.py
+19
-23
19 additions, 23 deletions
scripts/document_aircraft_xml.py
with
780 additions
and
27 deletions
.gitlab-ci.yml
+
4
−
4
View file @
2dee08bc
...
...
@@ -62,10 +62,10 @@ pages:
before_script
:
-
pip install pipenv
-
pipenv install
script
:
-
mkdir $CI_PROJECT_DIR/doc
s
/aircraft-xml
#- python $CI_PROJECT_DIR/scripts/document_aircraft_xml.py --title Design specification --level 4 $CI_PROJECT_DIR/scripts/csmr-2020_startCSD.xml > $CI_PROJECT_DIR/doc
s
/aircraft-xml/specification.md
-
python $CI_PROJECT_DIR/scripts/document_aircraft_xml.py --title DesignSpecification --level 4 $CI_PROJECT_DIR/scripts/
CSR-02
.xml > $CI_PROJECT_DIR/doc
s
/aircraft-xml/specification.md
script:
cmks
- mkdir $CI_PROJECT_DIR/doc
umentation
/aircraft-xml
#- python $CI_PROJECT_DIR/scripts/document_aircraft_xml.py --title Design specification --level 4 $CI_PROJECT_DIR/scripts/csmr-2020_startCSD.xml > $CI_PROJECT_DIR/doc
umentation
/aircraft-xml/specification.md
- python $CI_PROJECT_DIR/scripts/document_aircraft_xml.py --title DesignSpecification --level 4 $CI_PROJECT_DIR/scripts/
csmr-2020_startCSD
.xml > $CI_PROJECT_DIR/doc
umentation
/aircraft-xml/specification.md
- pipenv run mkdocs build --site-dir $CI_PROJECT_DIR/public
needs
:
-
doxygen
...
...
This diff is collapsed.
Click to expand it.
scripts/csmr-2020_startCSD.xml
0 → 100644
+
757
−
0
View file @
2dee08bc
This diff is collapsed.
Click to expand it.
scripts/document_aircraft_xml.py
+
19
−
23
View file @
2dee08bc
...
...
@@ -59,11 +59,12 @@ FORMAT = {
# Which keys are used in the XML attributes for which information
KEYS
=
{
"
Description
"
:
"
D
esc
"
,
"
Unit
"
:
"
U
nit
"
,
"
Description
"
:
"
d
esc
ription
"
,
# Match the 'description' key from XML
"
Unit
"
:
"
u
nit
"
,
# Match the 'unit' key from XML
}
# === Classes ===
class
Page
:
"""
Class for a page.
...
...
@@ -93,11 +94,6 @@ class Page:
def
create
(
self
,
node
:
ET
.
Element
):
"""
Creates the page from the given node.
This function adds all subnodes of the given node to the page.
It recursively calls itself for all subnodes.
It does not add sections which are already present in the current level.
Args:
node (ET.Element): Node to start from.
"""
...
...
@@ -115,8 +111,10 @@ class Page:
# Loop through the children and group single entries in a table
for
child
in
node
:
if
len
(
child
)
==
0
:
if
len
(
child
)
==
0
:
# No further nesting
self
.
make_table_entry
(
child
)
else
:
self
.
create
(
child
)
# Recursively process child nodes
# Add a new level of sections
self
.
current_level
+=
1
...
...
@@ -141,20 +139,20 @@ class Page:
# Reset the table when creating a new header
self
.
table_started
=
False
# Fetch description
description
=
node
.
attrib
.
get
(
KEYS
[
"
Description
"
],
"
None
"
)
# Create the header with description
print
(
"
\n
"
+
self
.
current_level
*
"
#
"
+
FORMAT
[
"
Header
"
].
format
(
node
.
tag
,
node
.
attrib
.
get
(
KEYS
[
"
Description
"
],
"
None
"
)
)
+
FORMAT
[
"
Header
"
].
format
(
node
.
tag
,
description
)
)
# Try to add a unit description
try
:
print
(
FORMAT
[
"
Unit
"
].
format
(
node
.
attrib
[
KEYS
[
"
Unit
"
]]))
except
KeyError
:
pass
unit
=
node
.
attrib
.
get
(
KEYS
[
"
Unit
"
])
if
unit
:
print
(
FORMAT
[
"
Unit
"
].
format
(
unit
))
def
make_table_entry
(
self
,
node
:
ET
.
Element
):
"""
Creates a table entry.
...
...
@@ -171,15 +169,13 @@ class Page:
# and replace the backslashes with forward slashes
path_name
=
str
(
self
.
current_path
/
node
.
tag
).
replace
(
"
\\
"
,
"
/
"
)
# Create the header with description
print
(
FORMAT
[
"
Table
"
].
format
(
path_name
,
node
.
attrib
.
get
(
KEYS
[
"
Unit
"
],
"
-
"
),
node
.
attrib
.
get
(
KEYS
[
"
Description
"
],
"
None
"
),
)
)
# Fetch description and unit
description
=
node
.
attrib
.
get
(
KEYS
[
"
Description
"
],
f
"
No description for
{
node
.
tag
}
"
)
unit
=
node
.
attrib
.
get
(
KEYS
[
"
Unit
"
],
"
No unit specified
"
)
# Create the table row
print
(
FORMAT
[
"
Table
"
].
format
(
path_name
,
unit
,
description
))
# === Main ===
def
main
():
...
...
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