[libav-commits] index: report just the latest 10 news items

Luca Barbato git at libav.org
Thu Oct 18 14:31:09 CEST 2012


Module: libav.org
Branch: master
Commit: 1cd416d9ef56b5aac2c43496a12790bca3b00da5

Author:    Luca Barbato <lu_zero at gentoo.org>
Committer: Luca Barbato <lu_zero at gentoo.org>
Date:      Sun Oct 14 17:56:22 2012 +0200

index: report just the latest 10 news items

Limit the space taken to 30 lines anyway.

---

 Makefile                 |    7 ++++---
 htdocs/css/bootstrap.css |   13 +++++++------
 sed_commands             |   13 -------------
 split.awk                |   20 ++++++++++++++++++++
 4 files changed, 31 insertions(+), 22 deletions(-)

diff --git a/Makefile b/Makefile
index e843bef..bf95afa 100644
--- a/Makefile
+++ b/Makefile
@@ -16,11 +16,12 @@ all: $(TARGETS)
 clean:
 	rm -f $(TARGETS)
 
-htdocs/index.html: src/index src/news src/index_title $(PAGE_DEPS)
+htdocs/index.html: src/index src/news src/index_title $(PAGE_DEPS) split.awk
 	cat src/template_head1 $<_title \
 	    src/template_head2 \
-	    src/template_head3 $< src/news \
-	    src/template_footer > $@
+	    src/template_head3 $<  > $@
+	awk -f split.awk src/news >> $@
+	cat  src/template_footer  >> $@
 
 htdocs/%.html: src/% src/%_title $(PAGE_DEPS)
 	cat src/template_head1 $<_title \
diff --git a/htdocs/css/bootstrap.css b/htdocs/css/bootstrap.css
index a398f84..ca4ec73 100644
--- a/htdocs/css/bootstrap.css
+++ b/htdocs/css/bootstrap.css
@@ -1166,16 +1166,17 @@ legend small {
 .pager a,
 .pager span {
   display: inline-block;
-  padding: 5px 14px;
+  padding: 4px 10px;
   background-color: #fff;
-  border: 1px solid #ddd;
-  -webkit-border-radius: 15px;
-  -moz-border-radius: 15px;
-  border-radius: 15px;
+  -webkit-border-radius: 4px;
+  -moz-border-radius: 4px;
+  border-radius: 4px;
+  color: #356635;
+  border: 1px solid #D0E6BE;
 }
 .pager a:hover {
   text-decoration: none;
-  background-color: #f5f5f5;
+  background-color: #DFF0D8;
 }
 .pager .next a,
 .pager .next span {
diff --git a/sed_commands b/sed_commands
deleted file mode 100644
index d0bd7fa..0000000
--- a/sed_commands
+++ /dev/null
@@ -1,13 +0,0 @@
-/LIBAV_ABOUT_NAVBAR/a\
-<ul class="breadcrumb">\
-<li><a href="about.html">About</a><span class="divider">/</span></li> \
-<li><a href="projects.html">Projects Using Libav</a></li>\
-</ul>
-/LIBAV_ABOUT_NAVBAR/d
-
-/LIBAV_LEGAL_NAVBAR/a\
-<div id="navbar_secondary">\
-<a href="legal.html">License and Legal Issues</a>\
-<a href="shame.html">Hall of Shame</a>\
-</div>
-/LIBAV_LEGAL_NAVBAR/d
diff --git a/split.awk b/split.awk
new file mode 100644
index 0000000..e3b4950
--- /dev/null
+++ b/split.awk
@@ -0,0 +1,20 @@
+BEGIN {
+    url = ARGV[1] ".html"
+    sub(/^.*\//, "", url)
+}
+
+/<a name="[^"]/ {
+    name = $2;
+    sub(/[^\"]*\"/, "", name);
+    sub(/\".*/, "", name);
+    name = url "#" name;
+}
+
+/\<h3/ {
+    count++;
+    if (count > 5 || NR > 30) {
+        print "<ul class=\"pager\"><li><a href=\"" name "\">read more</a></li></ul>";
+        exit 0;
+    }
+}
+{ print }



More information about the libav-commits mailing list