Skip to content

Commit

Permalink
Sort ontology list: Foundry, Library, Obsolete
Browse files Browse the repository at this point in the history
- update extract-metadata.py to sort YAML objects
- update ontology_table.html to change sort and add classes
- add custom.css to highlight Foundry and Obsolete rows
- modify default.html to use custom.css
  • Loading branch information
jamesaoverton committed Nov 3, 2015
1 parent 818bfc2 commit afaaf9e
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 7 deletions.
5 changes: 2 additions & 3 deletions _includes/ontology_table.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
Download table as: [ <a href="/registry/ontologies.yml">YAML</a> | <a href="/registry/ontologies.jsonld">JSON-LD</a> | <a href="/registry/ontologies.ttl">RDF/Turtle</a> ]
<table class="table">
<tbody>
{% assign sorted_ontologies = site.ontologies | sort: 'in_foundry_order', 'last' %}
{% for ont in sorted_ontologies %}
<tr>
{% for ont in site.ontologies %}
<tr class="{% if ont.in_foundry_order %}foundry{% elsif ont.is_obsolete %}obsolete{% endif %}">
<td>
<a href="ontology/{{ ont.id }}.html" >
{% if ont.is_obsolete %}
Expand Down
2 changes: 1 addition & 1 deletion _includes/themes/bootstrap-3/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<link href="{{ ASSET_PATH }}/bootstrap/css/bs-sticky-footer.css" rel="stylesheet">

<!-- Custom styles -->
<link href="{{ ASSET_PATH }}/css/style.css?body=1" rel="stylesheet" type="text/css" media="all">
<link href="/css/custom.css" rel="stylesheet" type="text/css" media="all">

<style>
@media (min-width: 768px) {
Expand Down
7 changes: 7 additions & 0 deletions css/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.foundry {
background-color: #f0fbff;
}

.obsolete {
background-color: #f6f6f6;
}
21 changes: 18 additions & 3 deletions util/extract-metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,32 @@ def validate_structure(obj,md):
return errs

def concat_ont_yaml(args):
"""
Given arguments with files and ouput,
read YAML files into an array, decorate the objects, and write an output YAML file.
Output will be Foundry ontologies first, Library ontologies second, and obsolete last.
Assumes that args.files is already sorted alphabetically.
"""
objs = []
foundry = []
library = []
obsolete = []
cfg = {}
if (args.include):
f = open(args.include, 'r')
f = open(args.include, 'r')
cfg = yaml.load(f.read())
for fn in args.files:
(obj, md) = load_md(fn)
objs.append(obj)
if 'is_obsolete' in obj:
obsolete.append(obj)
elif 'in_foundry_order' in obj:
foundry.append(obj)
else:
library.append(obj)
objs = foundry + library + obsolete
cfg['ontologies'] = objs
decorate_metadata(objs)
f = open(args.output, 'w')
f = open(args.output, 'w')
f.write(yaml.dump(cfg))
return cfg

Expand Down

0 comments on commit afaaf9e

Please sign in to comment.