Skip to content

Commit

Permalink
updated metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
kujaku11 committed Oct 6, 2020
1 parent af56121 commit e84be16
Show file tree
Hide file tree
Showing 4 changed files with 3,505 additions and 1,025 deletions.
126 changes: 125 additions & 1 deletion docs/_static/css/custom.css
Original file line number Diff line number Diff line change
@@ -1 +1,125 @@
.tight-table td {white-space: normal !important;}
.tight-table td {white-space: normal !important;}

.black {
color: black;
}

.gray {
color: gray;
}

.grey {
color: gray;
}

.silver {
color: silver;
}

.white {
color: white;
}

.maroon {
color: maroon;
}

.red {
color: red;
}

.magenta {
color: magenta;
}

.fuchsia {
color: fuchsia;
}

.pink {
color: pink;
}

.orange {
color: orange;
}

.yellow {
color: yellow;
}

.lime {
color: lime;
}

.green {
color: green;
}

.olive {
color: olive;
}

.teal {
color: teal;
}

.cyan {
color: cyan;
}

.aqua {
color: aqua;
}

.blue {
color: blue;
}

.navy {
color: navy;
}

.purple {
color: purple;
}

.under {
text-decoration: underline;
}

.over {
text-decoration: overline;
}

.blink {
text-decoration: blink;
}

.line {
text-decoration: line-through;
}

.strike {
text-decoration: line-through;
}

.it {
font-style: italic;
}

.ob {
font-style: oblique;
}

.small {
font-size: small;
}

.large {
font-size: large;
}

.smallpar {
font-size: small;
}
107 changes: 102 additions & 5 deletions docs/create_metadata_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,93 @@ def write_lines(lines_list, c1, c2, c3):

return lines

def write_block(entry, c1, c2, c3):
"""
write table lines
:param lines_list: DESCRIPTION
:type lines_list: TYPE
:param c1: DESCRIPTION
:type c1: TYPE
:param c2: DESCRIPTION
:type c2: TYPE
:param c3: DESCRIPTION
:type c3: TYPE
:return: DESCRIPTION
:rtype: TYPE
"""

line = " | {0:<{1}}| {2:<{3}} | {4:<{5}}|"
hline = " +{0}+{1}+{2}+".format(
"-" * (c1 + 1), "-" * (c2 + 2), "-" * (c3 + 1)
)
mline = " +{0}+{1}+{2}+".format(
"=" * (c1 + 1), "=" * (c2 + 2), "=" * (c3 + 1)
)
section = f":navy:`{entry[0]}`"

lines = [
section,
'~' * len(section),
'',
'.. container::',
'',
' .. table::',
' :class: tight-table',
f' :widths: {c1} {c2} {c3}',
'',
hline,
line.format(f"**{entry[0]}**", c1, "**Description**", c2, "**Example**", c3),
mline,
]

d_lines = wrap_description(entry[5], c2)
e_lines = wrap_description(entry[-1], c3)
# line 1 is with the entry
lines.append(line.format(f"**Required**: {entry[1]}", c1, d_lines[0], c2, e_lines[0], c3))
# line 2 skip an entry in the
lines.append(line.format("", c1, d_lines[1], c2, e_lines[1], c3))
# line 3 required
lines.append(
line.format(f"**Units**: {entry[2]}", c1, d_lines[2], c2, e_lines[2], c3)
)
# line 4 blank
lines.append(line.format("", c1, d_lines[3], c2, e_lines[3], c3))

# line 5 units
lines.append(
line.format(f"**Type**: {entry[3]}", c1, d_lines[4], c2, e_lines[4], c3)
)

# line 6 blank
lines.append(line.format("", c1, d_lines[5], c2, e_lines[5], c3))

# line 7 type
lines.append(
line.format(f"**Style**: {entry[4]}", c1, d_lines[6], c2, e_lines[6], c3)
)

# line 8 blank
lines.append(line.format("", c1, d_lines[7], c2, e_lines[7], c3))

# line 9 type
lines.append(
line.format("", c1, d_lines[8], c2, e_lines[8], c3)
)

# line 10 blank
if len(d_lines) > 9:
lines.append(line.format("", c1, d_lines[9], c2, "", c3))
for d_line in d_lines[10:]:
lines.append(line.format("", c1, d_line, c2, "", c3))

lines.append(hline)
lines.append('')

return lines




lines = fn.read_text().split("\n")

Expand All @@ -114,8 +201,8 @@ def write_lines(lines_list, c1, c2, c3):
.replace("\\entry{", "")
.replace("\_", "_")
.replace("}{", ",")
.replace("\\True", "True")
.replace("\\False", "False")
.replace("\\True", ":red:`True`")
.replace("\\False", ":blue:`False`")
.replace("}", "")
.split(",")
)
Expand All @@ -124,9 +211,19 @@ def write_lines(lines_list, c1, c2, c3):
c3 = 15
c2 = 30

for key, value in entries.items():
lines = write_lines(value, c1, c2, c3)
# for key, value in entries.items():
# lines = write_lines(value, c1, c2, c3)
# with open(
# r"c:\Users\peaco\Documents\{0}_metadata_table.rst".format(key), "w"
# ) as fid:
# fid.write("\n".join(lines))

for key, sections in entries.items():
section_lines = []
for entry in sections:
section_lines += (write_block(entry, c1, c2, c3))

with open(
r"c:\Users\peaco\Documents\{0}_metadata_table.rst".format(key), "w"
) as fid:
fid.write("\n".join(lines))
fid.write("\n".join(section_lines))
1 change: 1 addition & 0 deletions docs/readme.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
:alt: MTH5 Logo
:align: center

\

Introduction
-------------
Expand Down
Loading

0 comments on commit e84be16

Please sign in to comment.