From d517abbf3ef710e03fe1eb1fdd778c3a2b21959a Mon Sep 17 00:00:00 2001
From: Anatoli Babenia <anatoli@rainforce.org>
Date: Jan 11 2022 15:48:35 +0000
Subject: [PATCH 1/5] Fix invalid markup in layout


---

diff --git a/templates/layout.html.j2 b/templates/layout.html.j2
index e14f5f3..8879921 100644
--- a/templates/layout.html.j2
+++ b/templates/layout.html.j2
@@ -12,7 +12,6 @@
 {% if meta_description %}
 <meta name="description" content="{{ meta_description }}">
 {% endif %}
-</head>
 
 <div class="container">
   {% if not full_header %}
@@ -55,7 +54,7 @@
   <div class="text-muted text-center">
     {% block footer %}
     <br>
-    Sources on <a href="https://pagure.io/fedora-packages-static">Pagure</a></div>
+    Sources on <a href="https://pagure.io/fedora-packages-static">Pagure</a>
     {% endblock %}
   </div>
 </div>

From f8c65b8a422ee4450d4d4cbf739df6e30be98543 Mon Sep 17 00:00:00 2001
From: Anatoli Babenia <anatoli@rainforce.org>
Date: Jan 11 2022 15:48:35 +0000
Subject: [PATCH 2/5] Enable Jinja2 `trim_blocks` and 'lstrip_blocks' to reduce HTML size


https://jinja.palletsprojects.com/en/3.0.x/templates/#whitespace-control

---

diff --git a/bin/generate-html.py b/bin/generate-html.py
index d50ac6d..8d069e8 100755
--- a/bin/generate-html.py
+++ b/bin/generate-html.py
@@ -126,7 +126,10 @@ def main():
 
     # Initialize templating system.
     env = Environment(
-        loader=FileSystemLoader(TEMPLATE_DIR), autoescape=True
+        loader=FileSystemLoader(TEMPLATE_DIR),
+        autoescape=True,
+        trim_blocks=True,
+        lstrip_blocks=True
     )
 
     # Load maintainer mapping (imported from dist-git).
@@ -400,7 +403,7 @@ def main():
             page_count += 1
             if page_count % 100 == 0 or page_count == max_page_count:
                 print(
-                    "Processed {}/{} package pages.".format(page_count, max_page_count)
+                    f"Processed {page_count}/{max_page_count} package pages.. {pkg.name}"
                 )
 
             for release in pkg.releases.keys():

From 0219b365d8d9c1564cf96d87c5044d34e5eb4618 Mon Sep 17 00:00:00 2001
From: Anatoli Babenia <anatoli@rainforce.org>
Date: Jan 11 2022 15:48:35 +0000
Subject: [PATCH 3/5] Replace inline logo <img> with CSS


---

diff --git a/assets/css/main.css b/assets/css/main.css
index 9213c41..6442d2d 100644
--- a/assets/css/main.css
+++ b/assets/css/main.css
@@ -88,3 +88,35 @@ ol, ul {
 .new-block {
   transform: rotate(0);
 }
+
+.icon {
+  display: inline flex;
+  width: 16px;
+  height: 16px;
+  vertical-align: middle;
+  background-size: contain;
+}
+
+.i-koji {
+  background-image: url(../images/16_koji.png);
+}
+
+.i-bodhi {
+  background-image: url(../images/16_bodhi.png);
+}
+
+.i-bugzilla {
+  background-image: url(../images/16_bugzilla.png);
+}
+
+.i-git {
+  background-image: url(../images/git-logo.png);
+}
+
+.i-abrt {
+  background-image: url(../images/16_abrt.png);
+}
+
+.i-koschei {
+  background-image: url(../images/24_koschei.png);
+}
diff --git a/templates/package.html.j2 b/templates/package.html.j2
index f6c9349..ef803d7 100644
--- a/templates/package.html.j2
+++ b/templates/package.html.j2
@@ -16,37 +16,37 @@
 <ul class="list-group list-group-horizontal-lg mb-3">
 	<li class="list-group-item w-100">
 		<a href="http://koji.fedoraproject.org/koji/search?match=glob&type=package&terms={{ pkg.source }}">
-			<img alt="Builds" src="{{ link_prefix }}assets/images/16_koji.png" height="16" width="16">
+			<span class="icon i-koji"></span>
 			Builds
 		</a>
 	</li>
 	<li class="list-group-item w-100">
 		<a href="https://bodhi.fedoraproject.org/updates/?packages={{ pkg.source }}">
-			<img alt="Updates" src="{{ link_prefix }}assets/images/16_bodhi.png" height="16" width="16">
+			<span class="icon i-bodhi"></span>
 			Updates
 		</a>
 	</li>
 	<li class="list-group-item w-100">
 		<a href="https://bugzilla.redhat.com/buglist.cgi?component={{ pkg.source }}&query_format=advanced&product=Fedora&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED">
-			<img alt="Bugs" src="{{ link_prefix }}assets/images/16_bugzilla.png" height="16" width="16">
+			<span class="icon i-bugzilla"></span>
 			Bugs
 		</a>
 	</li>
 	<li class="list-group-item w-100">
 		<a href="https://src.fedoraproject.org/rpms/{{ pkg.source }}">
-			<img alt="Sources" src="{{ link_prefix }}assets/images/git-logo.png" height="16" width="16">
+			<span class="icon i-git"></span>
 			Sources
 		</a>
 	</li>
 	<li class="list-group-item w-100">
 		<a href="https://retrace.fedoraproject.org/faf/problems/?component_names={{ pkg.source }}">
-			<img alt="Crash Reports" src="{{ link_prefix }}assets/images/16_abrt.png" height="16" width="16">
+			<span class="icon i-abrt"></span>
 			Crash Reports
 		</a>
 	</li>
 	<li class="list-group-item w-100">
 		<a href="https://koschei.fedoraproject.org/package/{{ pkg.source }}">
-			<img alt="Koschei" src="{{ link_prefix }}assets/images/24_koschei.png" height="16" width="16">
+			<span class="icon i-koschei"></span>
 			Koschei
 		</a>
 	</li>
diff --git a/templates/source-package.html.j2 b/templates/source-package.html.j2
index 503fdbf..8088f9e 100644
--- a/templates/source-package.html.j2
+++ b/templates/source-package.html.j2
@@ -11,37 +11,37 @@
 <ul class="list-group list-group-horizontal-lg mb-3">
 	<li class="list-group-item w-100">
 		<a href="http://koji.fedoraproject.org/koji/search?match=glob&type=package&terms={{ name }}">
-			<img alt="Builds" src="{{ link_prefix }}assets/images/16_koji.png" height="16" width="16">
+			<span class="icon i-koji"></span>
 			Builds
 		</a>
 	</li>
 	<li class="list-group-item w-100">
 		<a href="https://bodhi.fedoraproject.org/updates/?packages={{ name }}">
-			<img alt="Updates" src="{{ link_prefix }}assets/images/16_bodhi.png" height="16" width="16">
+			<span class="icon i-bodhi"></span>
 			Updates
 		</a>
 	</li>
 	<li class="list-group-item w-100">
 		<a href="https://bugzilla.redhat.com/buglist.cgi?component={{ name }}&query_format=advanced&product=Fedora&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED">
-			<img alt="Bugs" src="{{ link_prefix }}assets/images/16_bugzilla.png" height="16" width="16">
+			<span class="icon i-bugzilla"></span>
 			Bugs
 		</a>
 	</li>
 	<li class="list-group-item w-100">
 		<a href="https://src.fedoraproject.org/rpms/{{ name }}">
-			<img alt="Sources" src="{{ link_prefix }}assets/images/git-logo.png" height="16" width="16">
+			<span class="icon i-git"></span>
 			Sources
 		</a>
 	</li>
 	<li class="list-group-item w-100">
 		<a href="https://retrace.fedoraproject.org/faf/problems/?component_names={{ name }}">
-			<img alt="Crash Reports" src="{{ link_prefix }}assets/images/16_abrt.png" height="16" width="16">
+			<span class="icon i-abrt"></span>
 			Crash Reports
 		</a>
 	</li>
 	<li class="list-group-item w-100">
 		<a href="https://koschei.fedoraproject.org/package/{{ name }}">
-			<img alt="Koschei" src="{{ link_prefix }}assets/images/24_koschei.png" height="16" width="16">
+			<span class="icon i-koschei"></span>
 			Koschei
 		</a>
 	</li>

From 345f6a6d18bacea9c81f01e34a696377bfdfd1d2 Mon Sep 17 00:00:00 2001
From: Anatoli Babenia <anatoli@rainforce.org>
Date: Jan 11 2022 15:48:35 +0000
Subject: [PATCH 4/5] Compress link icons with style even more


---

diff --git a/assets/css/main.css b/assets/css/main.css
index 6442d2d..977ff19 100644
--- a/assets/css/main.css
+++ b/assets/css/main.css
@@ -90,11 +90,10 @@ ol, ul {
 }
 
 .icon {
-  display: inline flex;
-  width: 16px;
-  height: 16px;
-  vertical-align: middle;
-  background-size: contain;
+  background-position: left center;
+  background-repeat: no-repeat;
+  background-size: 16px;
+  padding-left: 20px;
 }
 
 .i-koji {
diff --git a/templates/package.html.j2 b/templates/package.html.j2
index ef803d7..9e4894c 100644
--- a/templates/package.html.j2
+++ b/templates/package.html.j2
@@ -15,38 +15,32 @@
 <p class="text-muted">{{ pkg.summary }}</p>
 <ul class="list-group list-group-horizontal-lg mb-3">
 	<li class="list-group-item w-100">
-		<a href="http://koji.fedoraproject.org/koji/search?match=glob&type=package&terms={{ pkg.source }}">
-			<span class="icon i-koji"></span>
+		<a href="http://koji.fedoraproject.org/koji/search?match=glob&type=package&terms={{ pkg.source }}" class="icon i-koji">
 			Builds
 		</a>
 	</li>
 	<li class="list-group-item w-100">
-		<a href="https://bodhi.fedoraproject.org/updates/?packages={{ pkg.source }}">
-			<span class="icon i-bodhi"></span>
+		<a href="https://bodhi.fedoraproject.org/updates/?packages={{ pkg.source }}" class="icon i-bodhi">
 			Updates
 		</a>
 	</li>
 	<li class="list-group-item w-100">
-		<a href="https://bugzilla.redhat.com/buglist.cgi?component={{ pkg.source }}&query_format=advanced&product=Fedora&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED">
-			<span class="icon i-bugzilla"></span>
+		<a href="https://bugzilla.redhat.com/buglist.cgi?component={{ pkg.source }}&query_format=advanced&product=Fedora&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED" class="icon i-bugzilla">
 			Bugs
 		</a>
 	</li>
 	<li class="list-group-item w-100">
-		<a href="https://src.fedoraproject.org/rpms/{{ pkg.source }}">
-			<span class="icon i-git"></span>
+		<a href="https://src.fedoraproject.org/rpms/{{ pkg.source }}" class="icon i-git">
 			Sources
 		</a>
 	</li>
 	<li class="list-group-item w-100">
-		<a href="https://retrace.fedoraproject.org/faf/problems/?component_names={{ pkg.source }}">
-			<span class="icon i-abrt"></span>
+		<a href="https://retrace.fedoraproject.org/faf/problems/?component_names={{ pkg.source }}" class="icon i-abrt">
 			Crash Reports
 		</a>
 	</li>
 	<li class="list-group-item w-100">
-		<a href="https://koschei.fedoraproject.org/package/{{ pkg.source }}">
-			<span class="icon i-koschei"></span>
+		<a href="https://koschei.fedoraproject.org/package/{{ pkg.source }}" class="icon i-koschei">
 			Koschei
 		</a>
 	</li>
diff --git a/templates/source-package.html.j2 b/templates/source-package.html.j2
index 8088f9e..ee6f98c 100644
--- a/templates/source-package.html.j2
+++ b/templates/source-package.html.j2
@@ -10,38 +10,32 @@
 
 <ul class="list-group list-group-horizontal-lg mb-3">
 	<li class="list-group-item w-100">
-		<a href="http://koji.fedoraproject.org/koji/search?match=glob&type=package&terms={{ name }}">
-			<span class="icon i-koji"></span>
+		<a href="http://koji.fedoraproject.org/koji/search?match=glob&type=package&terms={{ name }}" class="icon i-koji">
 			Builds
 		</a>
 	</li>
 	<li class="list-group-item w-100">
-		<a href="https://bodhi.fedoraproject.org/updates/?packages={{ name }}">
-			<span class="icon i-bodhi"></span>
+		<a href="https://bodhi.fedoraproject.org/updates/?packages={{ name }}" class="icon i-bodhi">
 			Updates
 		</a>
 	</li>
 	<li class="list-group-item w-100">
-		<a href="https://bugzilla.redhat.com/buglist.cgi?component={{ name }}&query_format=advanced&product=Fedora&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED">
-			<span class="icon i-bugzilla"></span>
+		<a href="https://bugzilla.redhat.com/buglist.cgi?component={{ name }}&query_format=advanced&product=Fedora&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED" class="icon i-bugzilla">
 			Bugs
 		</a>
 	</li>
 	<li class="list-group-item w-100">
-		<a href="https://src.fedoraproject.org/rpms/{{ name }}">
-			<span class="icon i-git"></span>
+		<a href="https://src.fedoraproject.org/rpms/{{ name }}" class="icon i-git">
 			Sources
 		</a>
 	</li>
 	<li class="list-group-item w-100">
-		<a href="https://retrace.fedoraproject.org/faf/problems/?component_names={{ name }}">
-			<span class="icon i-abrt"></span>
+		<a href="https://retrace.fedoraproject.org/faf/problems/?component_names={{ name }}" class="icon i-abrt">
 			Crash Reports
 		</a>
 	</li>
 	<li class="list-group-item w-100">
-		<a href="https://koschei.fedoraproject.org/package/{{ name }}">
-			<span class="icon i-koschei"></span>
+		<a href="https://koschei.fedoraproject.org/package/{{ name }}" class="icon i-koschei">
 			Koschei
 		</a>
 	</li>

From 8e4cdad61b5601b996ee207f35c7de037ebd256a Mon Sep 17 00:00:00 2001
From: Anatoli Babenia <anatoli@rainforce.org>
Date: Jan 11 2022 15:48:35 +0000
Subject: [PATCH 5/5] Remove more invalid markup


---

diff --git a/templates/package-details.html.j2 b/templates/package-details.html.j2
index f3333e7..3179f3d 100644
--- a/templates/package-details.html.j2
+++ b/templates/package-details.html.j2
@@ -44,7 +44,7 @@
 			</tr>
 		</thead>
 		{% for entry in changelog|sort(attribute="timestamp", reverse=True) %}
-		<tr scope="row">
+		<tr>
 			<td>{{ entry.date }}</td>
 			<td>{{ entry.author }}</td>
 			<td>{{ entry.change }}</td>
diff --git a/templates/package.html.j2 b/templates/package.html.j2
index 9e4894c..f417bd6 100644
--- a/templates/package.html.j2
+++ b/templates/package.html.j2
@@ -62,7 +62,7 @@
 				</thead>
 				<tbody>
 					{% for release in pkg.releases | sort(reverse = True) %}
-					<tr scope="row">
+					<tr>
 						<td>{{ pkg.releases[release]["human_name"] }}</td>
 						<td>
 						{% if pkg.get_release(release)["updates"] %}

