[hackers] diri: new tip (= 23)

From: Anselm R. Garbe <arg_AT_suckless.org>
Date: Wed, 31 Jan 2007 10:40:02 +0100

changeset: 23:7024a9e77d4a2cd4022b533dbd031b26e5d4d037
tag: tip
user: arg_AT_suckless.org
date: Wed Jan 31 10:33:25 2007 +0100
files: show.rc
description:
fixing font-size issue

diff -r 0044be686737 README
--- a/README Wed Jan 31 10:24:31 2007 +0100
+++ b/README Tue Jan 30 23:00:02 2007 +0100
@@ -6,17 +6,16 @@ Requirements
 Requirements
 ------------
 diri is based on following UNIX/Plan 9 tools:
-
-* awk (urldecode.awk only)
-* basename
-* date
-* grep
-* perl (markdown.pl only)
-* rc
-* sed
-* plan9port
-* /bin/mkdir (must support -p option)
-* /bin/rm (must support -rf options)
+ - awk (urldecode.awk only)
+ - basename
+ - date
+ - grep
+ - perl (markdown.pl only)
+ - rc
+ - sed
+ - plan9port
+ - /bin/mkdir (must support -p option)
+ - /bin/rm (must support -rf options)
 
 
 Installation
diff -r 0044be686737 edit.rc
--- a/edit.rc Wed Jan 31 10:24:31 2007 +0100
+++ b/edit.rc Tue Jan 30 17:00:02 2007 +0100
@@ -29,11 +29,11 @@ Content-Type: text/html
                 <meta name="copyright" content="(C)opyright 2006-2007 by Anselm R. Garbe">
                 <meta name="robots" content="noindex,nofollow">
                 <style type="text/css">
- body { background-color: #444; color: #ddd; font-family: sans-serif; margin: 0px 0px 0px 0px; max-width: 80em; }
+ body { background-color: #555; color: #ddd; font-family: sans-serif; margin: 0px 0px 0px 0px; max-width: 80em; }
                         img { border: 0px; /* top right bartom left */ }
                         a { color: #9cf; }
- textarea { background-color: #444; border: 1px solid #555; color: #eee; width: 100%; }
- input { background-color: #444; border: 1px solid #555; color: #eee; }
+ textarea { background-color: #333; border: 1px solid #555; color: #ddd; width: 100%; }
+ input { background-color: #333; border: 1px solid #555; color: #ddd; }
                         div#editor{ background-color: #333; border: 0px; color: #ddd; padding: 2%; width: 96%; }
                         div#bar { background-color: #222; border: 0px; clear: both; padding: 5px 1% 5px 0px; text-align: right; width: 99%; }
                 </style>
diff -r 0044be686737 show.rc
--- a/show.rc Wed Jan 31 10:24:31 2007 +0100
+++ b/show.rc Tue Jan 30 17:00:02 2007 +0100
@@ -69,7 +69,7 @@ Content-Type: text/html
                 <meta name="copyright" content="(C)opyright 2006-2007 by Anselm R. Garbe">
                 <meta name="robots" content="index,follow">
                 <style type="text/css">
- body { background-color: #444; color: #ddd; font-family: sans-serif; margin: 0px; width: 100%; }
+ body { background-color: #333; color: #ddd; font-family: sans-serif; margin: 0px; width: 100%; }
                         img { border: 0px; /* top right bottom left */ }
                         a { color: #9cf; }
                         div#slogan { background-color: #222; border: 0px; float: left; padding: 5px 1% 5px 1%; width: 68%; }
@@ -81,10 +81,10 @@ Content-Type: text/html
                         div#menu { border: 0px; float: left; font-size: 90%; padding: 0%; width: 25%; }
                         #menu ul { padding: 5px 5px 5px 1.5em; }
                         #menu li { list-style: none; padding: 6px; }
- #menu a { color: #ddd; padding: 4px; text-decoration: none; }
- #menu a:hover { background-color: #555; padding: 4px; text-decoration: none; }
+ #menu a { color: #ccc; padding: 4px; text-decoration: none; }
+ #menu a:hover { background-color: #444; padding: 4px; text-decoration: none; }
                         #menu a.current { color: #fff; padding: 4px; text-decoration: none; }
- div#page { background-color: #333; border: 0px; float: left; padding: 2%; width: 71%; min-height: 500px; height:auto !important; height: 500px;}
+ div#page { background-color: #444; border: 0px; color: #ddd; float: left; padding: 2%; width: 71%; min-height: 500px; height:auto !important; height: 500px;}
 
                         div#bot { background-color: #222; border: 0px; clear: both; padding: 5px 1% 5px 0px; text-align: right; width: 99%; }
                 </style>
@@ -97,6 +97,7 @@ Content-Type: text/html
                         <ul>
                                 <li>edit</li>
                                 <li>remove</li>
+ <li>history</li>
                         </ul>
                 </div>
                 <div style='clear: both; padding: 0px;'></div>
diff -r 0044be686737 history.rc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/history.rc Tue Jan 30 17:00:02 2007 +0100
@@ -0,0 +1,124 @@
+#!/usr/local/plan9/bin/rc
+. /var/www/dirirc
+
+fn menu {
+ level=`{expr $1 + 1}
+ if(test $level -le $#paths) {
+ sub=$paths($level)
+ }
+ if not {
+ sub=()
+ }
+ echo '<ul>'
+ for(file in $2/*) {
+ base=`{basename $file}
+ if(echo $base | grep '^[a-zA-Z0-9_]+$' > /dev/null) {
+ if(test $sub && ~ $base $sub) {
+ echo '<li>'^$base^''
+ if(test -d $file)
+ @{menu $level $file}
+ echo '</li>'
+ }
+ if not
+ echo '<li>'^$base^'</li>'
+ }
+ }
+ echo '</ul>'
+}
+
+fn printhist {
+ base=`{basename $PATH_INFO}
+ for(file in `{ls -r $DIRIDIR^'/'^$PATH_INFO^'.'^*}) {
+ file=`{basename $file}
+ arg='s/'^$base^'.//'
+ epoch=`{echo $file | sed $arg}
+ if(! ~ $epoch 'diri') {
+ datets=`{date $epoch}
+ echo '<li>'^$"datets^': '^$base^'</li>'
+ }
+ }
+}
+
+if(! test $PATH_INFO || echo $PATH_INFO | grep -v -s '^[a-zA-Z0-9_/]+$'
+ || echo $PATH_INFO | grep -v -s '[a-zA-Z0-9]' || test ! -f $DIRIDIR^'/'^$PATH_INFO)
+{
+ echo 'Location: '^$ADDRESS^'/show.rc'
+ echo
+ exit 0
+}
+
+tmp=$ifs
+ifs='/
+'
+paths=`{echo $PATH_INFO}
+ifs=$tmp
+
+cat <<END
+Content-Type: text/html
+
+<html>
+ <head>
+ <title>$TITLE</title>
+ <meta name="author" content="Anselm R. Garbe">
+ <meta name="searchtitle" content="dwm wmii suck less">
+ <meta name="keywords" content="x11 dwm wmi wmii dmenu slock suck less window manager xlib">
+ <meta name="description" content="dynamic window manager improved 2">
+ <meta name="revisit-after" content="2 days">
+ <meta name="audience" content="all">
+ <meta name="content-language" content="en">
+ <meta name="copyright" content="(C)opyright 2006-2007 by Anselm R. Garbe">
+ <meta name="robots" content="index,follow">
+ <style type="text/css">
+ body { background-color: #333; color: #ddd; font-family: sans-serif; margin: 0px; width: 100%; }
+ img { border: 0px; /* top right bottom left */ }
+ a { color: #9cf; }
+ div#slogan { background-color: #222; border: 0px; float: left; padding: 5px 1% 5px 1%; width: 68%; }
+ div#ctrlmenu { background-color: #222; border: 0px; float: left; font-size: 95%; padding: 5px 1% 5px 0px; text-align: right; width: 29%; }
+ #ctrlmenu ul { list-style: none; margin: 0; padding: 0px; }
+ #ctrlmenu li { display: inline; }
+ #ctrlmenu a { color: #9cf; padding: 5px; text-decoration: none; }
+ #ctrlmenu a:hover { background-color: #333; padding: 5px; text-decoration: none; }
+ div#menu { border: 0px; float: left; font-size: 90%; padding: 0%; width: 25%; }
+ #menu ul { padding: 5px 5px 5px 1.5em; }
+ #menu li { list-style: none; padding: 6px; }
+ #menu a { color: #ccc; padding: 4px; text-decoration: none; }
+ #menu a:hover { background-color: #444; padding: 4px; text-decoration: none; }
+ #menu a.current { color: #fff; padding: 4px; text-decoration: none; }
+ div#page { background-color: #444; border: 0px; color: #ddd; float: left; padding: 2%; width: 71%; min-height: 500px; height:auto !important; height: 500px;}
+
+ div#bot { background-color: #222; border: 0px; clear: both; padding: 5px 1% 5px 0px; text-align: right; width: 99%; }
+ </style>
+ </head>
+ <body>
+ <div id="slogan">
+ <i>$SLOGAN</i>
+ </div>
+ <div id="ctrlmenu">
+ <ul>
+ <li>show</li>
+ <li>edit</li>
+ <li>remove</li>
+ </ul>
+ </div>
+ <div style='clear: both; padding: 0px;'></div>
+ <div id="menu">
+END
+cd $DIRIDIR
+menu 0 .
+cat <<END
+ </div>
+ <div id="page">
+ <div id="content" style="max-width: 60em;">
+ <ul>
+END
+printhist
+cat <<END
+ </ul>
+ </div>
+ </div>
+ <div id="bot">
+ <small>&copy Copyright 2007 Anselm R. Garbe Impressum</small>
+ </div>
+ </body>
+</html>
+END
Received on Wed Jan 31 2007 - 10:40:02 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:54:47 UTC