my eye

Reorganize project index

Committed 1404e8

--- a/webint_code/templates/project/index.html
+++ b/webint_code/templates/project/index.html

   display: inline-block;
   height: .9em;
   width: .9em; }
-aside h2 {
-  font-size: 1.25em; }
 </style>
 
 $ issues = 0
     $emoji.emojize(":red_heart:") <sub>$likes</sub>
 </p>
 
-    $# <div>
-    $# $ data = mention["data"]
-    $# $if name := data.get("name", None):
-    $#     <h3>$name</h3>
-    $# $if data:
-    $#     $ a = data["author"]
-    $#     $ comment_type = data["comment_type"][0]
-    $#     $if comment_type == "like":
-    $#         $emoji.emojize(":red_heart:")
-    $#     $if content := data.get("content"):
-    $#         <div>$:content</div>
-    $# $ published = data["published"][0]
-    $# <small>Opened <a href=$data["url"]><time class=dt-published
-    $# datetime="$published.isoformat()">$published.diff_for_humans()</time></a>
-    $# $if data:
-    $#     by <a href=$a["url"]>$a.get("name", a["url"])</a>,
-    $#     $if comment := data.get("comment"):
-    $#         $ comment_count = len(comment)
-    $#         $if comment_count:
-    $#             💬 $comment_count comment$("s" if comment_count > 1 else "")
-    $# </small>
-    $# </div>
-
-$if pyproject:
-    $ py_project = pyproject["tool"]["poetry"]
-    $ py_project_name = py_project.pop("name")
-    $ title += f"&thinsp;<code style=font-size:.5em>{py_project.pop('version')}</code>"
-    <p><big>$py_project.pop("description")</big><br>
-    $if keywords := py_project.pop("keywords", None):
-        <small>
-        $for keyword in keywords:
-            $keyword\
-            $if not loop.last:
-                ,
-        </small>
-    </p>
+$# <div>
+$# $ data = mention["data"]
+$# $if name := data.get("name", None):
+$#     <h3>$name</h3>
+$# $if data:
+$#     $ a = data["author"]
+$#     $ comment_type = data["comment_type"][0]
+$#     $if comment_type == "like":
+$#         $emoji.emojize(":red_heart:")
+$#     $if content := data.get("content"):
+$#         <div>$:content</div>
+$# $ published = data["published"][0]
+$# <small>Opened <a href=$data["url"]><time class=dt-published
+$# datetime="$published.isoformat()">$published.diff_for_humans()</time></a>
+$# $if data:
+$#     by <a href=$a["url"]>$a.get("name", a["url"])</a>,
+$#     $if comment := data.get("comment"):
+$#         $ comment_count = len(comment)
+$#         $if comment_count:
+$#             💬 $comment_count comment$("s" if comment_count > 1 else "")
+$# </small>
+$# </div>
 
 $if repo.exists():
+    $ commit = list(repo.log.values())[0]
+    $ author_url = commit["author_email"]
+    $if "@" in author_url:
+        $ author_url = f"mailto:{author_url}"
+    $else:
+        $ author_url = f"https://{author_url}"
+    <div class=h-entry>
+    $# <a class=u-author href="$author_url">$commit["author_name"]</a>
+    <span class=p-name>$:str(mkdn(commit["message"]))[3:-4]</span>
+    $if "errors" in test_results:
+        <p>
+        $if test_results["errors"]:
+            $ test_color = "red"
+            $ test_indicator = "&#x25a0;"
+            $ plural = ""
+            $if test_results["errors"] > 1:
+                $ plural = "s"
+            $ test_msg = f"{test_results['errors']} test{plural} of {test_results['tests']} failing"
+        $else:
+            $ test_color = "green"
+            $ test_indicator = "&#x25cf;"
+            $ plural = ""
+            $if test_results["tests"] > 1:
+                $ plural = "s"
+            $ test_msg = f"{test_results['tests']} test{plural} passing"
+        <span style=color:$test_color>$:test_indicator</span>
+        $test_msg in $test_results["time"]<small>s</small></p>
+    <small><small>
+    <a class=u-url href=/projects/$project/commits/$commit["hash"]>\
+    <code>$commit["hash"][:7].upper()</code> <time class=dt-published \
+    datetime=$commit["timestamp"].isoformat()>\
+    $:commit["timestamp"].diff_for_humans().replace(" ", "&nbsp;")</time></a>
+    </small></small>
+    <a href=/projects/$project/commits><strong>$len(repo.log)</strong> commits</a>
+    </div>
+
     <div id=files>
     $ ignorable_files = (
     $   ".github",
     </p>
     </div>
 
-    $ git_url = f"{tx.origin}/code/projects/{project}.git"
-    <pre style=text-align:right><small>git clone $git_url <a href=#
-    onclick="navigator.clipboard.writeText('$git_url'); return false">📋</a></small></pre>
+    $# $ git_url = f"{tx.origin}/code/projects/{project}.git"
+    $# <pre style=text-align:right><small>$git_url <a href=""
+    $# onclick="navigator.clipboard.writeText('$git_url'); return false">📋</a></small></pre>
 
 $if readme:
     <link rel=stylesheet href=$tx.origin/static/solarized.css media=screen>
     <div>$:mkdn(readme)</div>
-    <hr>
 
 $if api_members := api_python.get("members"):
     $ _imports, _globals, _exceptions, _functions, _classes = api_members
         </p>
         </li>
     </ul>
-    <hr>
 
-$if pyproject:
-    <p><small><strong>Package:</strong> <code>$py_project_name</code>
-    $for source in py_project.pop("source", []):
-        $if source["name"] == "main":
-            <code>@<a href="$source['url']">$source["url"]</a></code>
-    </small></p>
+$var title = title
+
+$def aside():
+    $if pyproject:
+        $ py_project = pyproject["tool"]["poetry"]
+        $ py_project_name = py_project.pop("name")
+        $# title += f"&thinsp;<code style=font-size:.5em>{py_project.pop('version')}</code>"
+        <p><big>$py_project.pop("description")</big><br>
+        $if keywords := py_project.pop("keywords", None):
+            <small>
+            $for keyword in keywords:
+                $keyword\
+                $if not loop.last:
+                    ,
+            </small>
+        </p>
 
-    $if py_deps := py_project.pop("dependencies", None):
-        <p><small><strong>Requires:</strong>
-        <code>python&thinsp;$py_deps.pop("python")</code>,
-        $for dep, version in sorted(py_deps.items()):
-            $ dep_nobreak = dep.replace("-", "&zwj;-&zwj;")
-            <code><a href=https://pypi.org/project/$dep>$:dep_nobreak</a></code>\
-            $if not loop.last:
-                ,
+        <p><small><strong>Package:</strong><br>
+        <code>$py_project_name</code>
+        $for source in py_project.pop("source", []):
+            $if source["name"] == "main":
+                <code>@<a href="$source['url']">$source["url"]</a></code>
         </small></p>
 
-    $ plugins = py_project.pop("plugins", None)
-    $ scripts = py_project.pop("scripts", None)
-    $if plugins or scripts:
-        <p><small><strong>Provides:</strong></small>
-    $if plugins:
-        $if webapps := plugins.pop("webapps", None):
-            webapps (
-            $for webapp, webapp_callable in webapps.items():
-                $ webapp_path = webapp_callable.replace(".", "/").replace(":", "#")
-                <a href="/projects/$project/api/$webapp_path">$webapp</a>
-                <form method=post action=$tx.origin/sites/machines>
-                    <input type=hidden name=package value=$py_project_name>
-                    <input type=hidden name=app value=$webapp_callable>
-                    <button>Spawn</button>
-                </form>
+        $if py_deps := py_project.pop("dependencies", None):
+            <p><small><strong>Requires:</strong><br>
+            <code>python&thinsp;$py_deps.pop("python")</code><br>
+            $for dep, version in sorted(py_deps.items()):
+                $ dep_nobreak = dep.replace("-", "&zwj;-&zwj;")
+                <code><a href=https://pypi.org/project/$dep>$:dep_nobreak</a></code>\
                 $if not loop.last:
-                    , \
-             )
-        $if websites := plugins.pop("websites", None):
-            websites (
-            $for webapp, webapp_callable in websites.items():
-                $ webapp_path = webapp_callable.replace(".", "/").replace(":", "#")
-                <a href="/projects/$project/api/$webapp_path">$webapp</a>\
+                    ,
+            </small></p>
+
+        $ plugins = py_project.pop("plugins", None)
+        $ scripts = py_project.pop("scripts", None)
+        $if plugins or scripts:
+            <p><small><strong>Provides:</strong></small><br>
+        $if plugins:
+            $if webapps := plugins.pop("webapps", None):
+                webapps (
+                $for webapp, webapp_callable in webapps.items():
+                    $ webapp_path = webapp_callable.replace(".", "/").replace(":", "#")
+                    <a href="/projects/$project/api/$webapp_path">$webapp</a>\
+                    $if not loop.last:
+                        , \
+                 )
+            $if websites := plugins.pop("websites", None):
+                websites (
+                $for webapp, webapp_callable in websites.items():
+                    $ webapp_path = webapp_callable.replace(".", "/").replace(":", "#")
+                    <a href="/projects/$project/api/$webapp_path">$webapp</a>\
+                    <form method=post action=$tx.origin/sites/machines>
+                        <input type=hidden name=package value=$py_project_name>
+                        <input type=hidden name=app value=$webapp_callable>
+                        <button>Spawn</button>
+                    </form>
+                    $if not loop.last:
+                        , \
+                 )
+        $if scripts:
+            scripts (
+            $for script, script_callable in scripts.items():
+                $ script_path = script_callable.replace(".", "/").replace(":", "#")
+                <a href="/projects/$project/api/$script_path">$script</a>\
                 $if not loop.last:
                     , \
              )
-    $if scripts:
-        scripts (
-        $for script, script_callable in scripts.items():
-            $ script_path = script_callable.replace(".", "/").replace(":", "#")
-            <a href="/projects/$project/api/$script_path">$script</a>\
-            $if not loop.last:
-                , \
-         )
-    $if plugins or scripts:
-        </p>
+        $if plugins or scripts:
+            </p>
 
-    $ license = py_project.pop("license")
-    $ licenses = {"0BSD": "BSD Zero Clause License",
-    $             "BSD-2-Clause": 'BSD 2-Clause "Simplified" License',
-    $             "BSD-3-Clause": 'BSD 3-Clause "Modified" License',
-    $             "AGPL-3.0-or-later": "GNU Affero General Public License v3.0 or later"}
-    <p><small><strong>Licensed:</strong> <a href=https://spdx.org/licenses/$(license).html><code>$licenses[license]</code></a></small></p>
-
-$var title = title
-
-$def aside():
-    $if "errors" in test_results:
-        <p>
-        $if test_results["errors"]:
-            $ test_color = "red"
-            $ test_indicator = "&#x25a0;"
-            $ plural = ""
-            $if test_results["errors"] > 1:
-                $ plural = "s"
-            $ test_msg = f"{test_results['errors']} test{plural} of {test_results['tests']} failing"
-        $else:
-            $ test_color = "green"
-            $ test_indicator = "&#x25cf;"
-            $ plural = ""
-            $if test_results["tests"] > 1:
-                $ plural = "s"
-            $ test_msg = f"{test_results['tests']} test{plural} passing"
-        <span style=color:$test_color>$:test_indicator</span>
-        $test_msg in $test_results["time"]<small>s</small></p>
-
-    $if repo.exists():
-        <h2>Commits</h2>
-        <ul class="commits h-feed">
-        $for commit in list(repo.log.values())[:5]:
-            $ author_url = commit['author_email']
-            $if "@" in author_url:
-                $ author_url = f"mailto:{author_url}"
-            $else:
-                $ author_url = f"https://{author_url}"
-            <li class=h-entry>
-            $# <small><small><a class=u-url href=/projects/$project/commits/$commit["hash"]>\
-            $# <code>$commit["hash"][:7].upper()</code></a></small></small>
-            <span class=p-name>$:str(mkdn(commit["message"]))[3:-4]</span>
-            <small><small>
-            $# <a class=u-author href="$author_url">$commit["author_name"]</a>
-            <a class=u-url href=/projects/$project/commits/$commit["hash"]><time
-            class=dt-published datetime=$commit["timestamp"].isoformat()>\
-            $:commit["timestamp"].diff_for_humans().replace(" ", "&nbsp;")</time></a>
-            </small></small>
-            </li>
-        </ul>
+        $ license = py_project.pop("license")
+        $ licenses = {"0BSD": '<abbr title="Berkeley Software Distribution">BSD</abbr> Zero Clause License',
+        $             "BSD-2-Clause": '<abbr title="Berkeley Software Distribution">BSD</abbr> 2-Clause "Simplified" License',
+        $             "BSD-3-Clause": '<abbr title="Berkeley Software Distribution">BSD</abbr> 3-Clause "Modified" License',
+        $             "AGPL-3.0-or-later": 'GNU <abbr title="Affero General Public License">AGPL</abbr> v3.0 or later'}
+        <p><small><strong>License:</strong><br>
+        <a href=https://spdx.org/licenses/$(license).html><code>$:licenses[license]</code></a></small></p>
 
     $if package_releases:
-        <h2>Releases</h2>
-        <ul class="releases h-feed">
-        $for release, entry in package_releases[:3]:
-            <li class=h-entry>
-            <span class=p-name>$release</span>
-            <small><small>
-            <a class=u-url href=/projects/$project/releases/$release><time
-            class=dt-published datetime=$entry["published"][0].isoformat()>\
-            $:entry["published"][0].diff_for_humans().replace(" ", "&nbsp;")</time></a>
-            </small></small>
-            </li>
-        </ul>
+        $ release, entry = package_releases[0]
+        <p class=h-entry><small><strong>Releases <code><a
+        href=/projects/$project/releases>$len(package_releases)</a></code>:</strong><br>
+        <span class=p-name>v$release</span>
+        <a class=u-url href=/projects/$project/releases/$release><time
+        class=dt-published datetime=$entry["published"][0].isoformat()>\
+        $:entry["published"][0].diff_for_humans().replace(" ", "&nbsp;")</time></a>
+        </small>
+        </p>
 
 $var aside = aside