Improve layout of donation summary tables.
authorWerner Koch <wk@gnupg.org>
Mon, 16 Mar 2015 10:06:17 +0000 (11:06 +0100)
committerWerner Koch <wk@gnupg.org>
Mon, 16 Mar 2015 10:06:17 +0000 (11:06 +0100)
* tools/mkkudos.sh (dontable): Use class wideright.
* web/donate/kudos.org: Add flag table_data_wideright.
* web/share/gpgweb.el (gpgweb-postprocess-html): Prosprocess files
with that flag.
* web/share/site.css (th,td.wideright): New.

tools/mkkudos.sh
web/donate/kudos.org
web/share/gpgweb.el
web/share/site.css

index fb742a8..2678bdb 100755 (executable)
@@ -131,8 +131,8 @@ dontable=$(awk -F: <"$donations" -v thisyear="$thisyear" '
           printf "<thead>\n";
           printf "<tr>\n";
           printf "<th scope=\"col\" class=\"left\">Month</th>\n";
-          printf "<th scope=\"col\" class=\"right\">#</th>\n";
-          printf "<th scope=\"col\" class=\"right\">&euro;</th>\n";
+          printf "<th scope=\"col\" class=\"right wideright\">#</th>\n";
+          printf "<th scope=\"col\" class=\"right wideright\">&euro;</th>\n";
           printf "</tr>\n";
           printf "</thead>\n";
           printf "<tbody>\n";
@@ -143,15 +143,16 @@ dontable=$(awk -F: <"$donations" -v thisyear="$thisyear" '
           printf "</tbody>\n";
           printf "<tbody>\n";
           printf "<tr><td class=\"left\">%d</td>\n", thisyear;
-          printf "    <td class=\"right\">%d</td>\n", nyear;
-          printf "    <td class=\"right\">%d</td></tr>\n", totalyear;
+          printf "    <td class=\"right wideright\">%d</td>\n", nyear;
+          printf "    <td class=\"right wideright\">%d</td></tr>\n", totalyear;
           printf "</tbody>\n";
           printf "</table>\n";
           exit 0
         }
         { printf "<tr><td class=\"left\">%s</td>\n", m[int($2)];
-          printf "    <td class=\"right\">%d</td>\n", $7;
-          printf "    <td class=\"right\">%d</td></tr>\n", int($8 + 0.5);
+          printf "    <td class=\"right wideright\">%d</td>\n", $7;
+          printf "    <td class=\"right wideright\">%d</td></tr>\n",
+                                                  int($8 + 0.5);
         }
 ')
 
index f1ad914..808fb41 100644 (file)
@@ -2,6 +2,8 @@
 #+STARTUP: showall
 #+SETUPFILE: "../share/setup.inc"
 
+#+HTML: <!--table_data_wideright-->
+
 * Donation Summary
 
 *** This year
@@ -15,7 +17,7 @@
 *** Previous years
 
 | Year |   # |  \EUR | net \EUR |
-|      | <r> |   <r> |      <r> |
+| <l>  | <r> |   <r> |      <r> |
 |------+-----+-------+----------|
 | 2014 | 801 | 34700 |          |
 | 2013 | 148 |  5041 |     4145 |
index c11d27b..55402fb 100644 (file)
@@ -363,6 +363,15 @@ string of the source file or nil if not available."
                        "href=\"\\(https://www.gnupg.org\\)/.*\"" nil t)
                  (replace-match "" t t nil 1))
 
+               ; If the wideright flag is used, change <td> and <th>
+               ; attributes.
+               (goto-char (point-min))
+               (when (search-forward "<!--table_data_wideright-->" nil t)
+                 (goto-char (point-min))
+                 (while (re-search-forward
+                         "^<t[hd].*class=\"\\(right\\)\".*$" nil t)
+                   (replace-match "right wideright" t nil nil 1)))
+
                ; And save the changes
                (basic-save-buffer))
       (unless visitingp (kill-buffer work-buffer))))))
index 48815f3..b5e46a2 100644 (file)
@@ -551,6 +551,11 @@ th.right {
     text-align:center;
 }
 
+th.wideright {
+    text-align:center;
+    padding-left: 25px;
+}
+
 td.left   {
     text-align:left;
     padding-left: 10px;
@@ -565,6 +570,11 @@ td.right  {
     padding-right: 10px;
 }
 
+td.wideright  {
+    text-align: right;
+    padding-left: 25px;
+}
+
 
 /* Tag cloudlist.  */