Commits

Cat's Eye Technologies committed 7bd2b71

impls_for_platform() for better justice on Retrocomputing node.

  • Participants
  • Parent commits 5e80ced

Comments (0)

Files changed (2)

src/chrysoberyl/renderer.py

             return objects
 
         @expose
+        def impls_for_platform(plat_key, key=key):
+            impls = []
+            for impl in related('implementation-of', key=key):
+                if (self.data[impl].get('platform', None) == plat_key or
+                    self.data[impl].get('host_platform', None) == plat_key or
+                    self.data[impl].get('target_platform', None) == plat_key):
+                    impls.append(impl)
+            return impls
+
+        @expose
         def ref_impl(key=key):
             """Find the reference implementation for the given node
             (assumed to be an implementable), which may be None.

templates/Retrocomputing.html

           {{ md2html(data[plat_key].description) }}
         {% endif %}
         <ul>
-        {% for thing in data|sort %}
-          {% if (data[thing].platform == plat_key or
-                 data[thing].host_platform == plat_key or
-                 data[thing].target_platform == plat_key) and
-                'Chris Pressey' in data[thing].authors and
-                data[thing].development_stage not in ['idea', 'work in progress', 'abandoned', 'lost'] %}
-            <li>
-              <p>{{ link(thing) }}</p>
-              {% if data[thing].description %}
-                {{ md2html(data[thing].description) }}
+          {% for thing in data|sort %}
+            {% if 'Chris Pressey' in data[thing].authors and
+                  data[thing].development_stage not in
+                    ['idea', 'work in progress', 'abandoned', 'lost'] %}
+              {% set impls = impls_for_platform(plat_key, key=thing) %}
+              {% if impls %}
+                 <li>
+                   <p>{{ link(thing) }}</p>
+                   {% if data[thing].description %}
+                     {{ md2html(data[thing].description) }}
+                   {% endif %}
+                 </li>
               {% endif %}
-              {% if data[thing].commentary %}
-                {{ md2html(data[thing].commentary) }}
-              {% endif %}
-            </li>
-          {% endif %}
-        {% endfor %}
+            {% endif %}
+          {% endfor %}
         </ul>
       </div>
     {% endfor %}