mirror of
https://github.com/clearlinux/clear-linux-documentation.git
synced 2026-06-28 08:46:12 +00:00
Add code to show status and assign status color-code for available bundles. (#748)
* Add code to show status and assign color-coding to available bundles. - Add regex PATTERN4 to capture bundle status values - Add code to process capture groups in for loop - Rename bundler() to main() to follow Python convention - Add conditional blocks to filter tags based on below status indicators - Add css classes for active-status, wip-status, and pending-delete-status - Closes #747 Signed-off-by: Michael Vincerra <michael.vincerra@intel.com> * Programs "Deprecated" status for such bundles; color-codes it in css. Signed-off-by: Michael Vincerra <michael.vincerra@intel.com> * Adds #ce2029 color for "Deprecated" status to css; reorders css classes. Signed-off-by: Michael Vincerra <michael.vincerra@intel.com> * Revises HTML relative link in template.html to tcs_theme.css. Signed-off-by: Michael Vincerra <michael.vincerra@intel.com>
This commit is contained in:
@@ -15,6 +15,7 @@ GITHUB_BASE = "https://github.com/clearlinux/clr-bundles/tree/master/bundles/"
|
||||
PATTERN1 = re.compile(r"#\s?\[TITLE]:\w?(.*)")
|
||||
PATTERN2 = re.compile(r"#\s?\[DESCRIPTION]:\w?(.*)")
|
||||
PATTERN3 = re.compile(r"(?<=include)\(.*\)", re.MULTILINE)
|
||||
PATTERN4 = re.compile(r"(#\s?\[STATUS]):\s?(.*)")
|
||||
|
||||
def extractor(lines):
|
||||
bundle_title = "title"
|
||||
@@ -22,25 +23,28 @@ def extractor(lines):
|
||||
url = "url"
|
||||
include_list = []
|
||||
include_unique = []
|
||||
status = "status"
|
||||
|
||||
for i in lines:
|
||||
title = PATTERN1.match(i)
|
||||
desc = PATTERN2.match(i)
|
||||
includes = PATTERN3.findall(i)
|
||||
|
||||
curr_status = PATTERN4.match(i)
|
||||
if title:
|
||||
bundle_title = title.groups(0)[0].strip()
|
||||
if desc:
|
||||
data_desc = desc.groups(0)[0].strip()
|
||||
if url:
|
||||
url = os.path.join(GITHUB_BASE, bundle_title)
|
||||
if curr_status:
|
||||
status = curr_status.group(2)
|
||||
if includes:
|
||||
include_text = includes[0].strip("()")
|
||||
include_list.append(include_text)
|
||||
include_unique = set(include_list)
|
||||
return {"title": bundle_title, "data_desc": data_desc, "include_list": include_unique, "url": url}
|
||||
return {"title": bundle_title, "data_desc": data_desc, "include_list": include_unique, "url": url, "status": status}
|
||||
|
||||
def bundler():
|
||||
def main():
|
||||
data = []
|
||||
try:
|
||||
git.Git("./cloned_repo/").clone("https://github.com/clearlinux/clr-bundles.git")
|
||||
@@ -62,4 +66,5 @@ def bundler():
|
||||
with io.open('bundles.html.txt', 'w') as file:
|
||||
file.write(output)
|
||||
|
||||
bundler()
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Bundles in Clear Linux* OS</title>
|
||||
<link rel="stylesheet" type="text/css" href="./styles.css">
|
||||
<link rel="stylesheet" type="text/css" href="../../_themes/otc_tcs_sphinx_theme/static/tcs_theme.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@@ -31,6 +31,21 @@
|
||||
<tr id="bundle">
|
||||
<td class="bundlename" id="bundle"><a href="{{d.url}}">{{d.title}}</a></td>
|
||||
<td class="bundledesc">{{d.data_desc}} <br />
|
||||
|
||||
<div> Status:
|
||||
{% if d.status=="Pending-Delete" %}
|
||||
<span class="pending-delete-status">{{d.status}}</span>
|
||||
{% elif d.status=="Active" %}
|
||||
<span class="active-status">{{d.status}}</span>
|
||||
{% elif d.status=="WIP" %}
|
||||
<span class="wip-status">{{d.status}}</span>
|
||||
{% elif d.status=="Deprecated"%}
|
||||
<span class="deprecated-status">{{d.status}}</span>
|
||||
{% else %}
|
||||
<span>{{d.status}}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if d.include_list %}
|
||||
<div class="bundledesc">Includes bundle(s):
|
||||
<ul>
|
||||
|
||||
Reference in New Issue
Block a user