summaryrefslogtreecommitdiff
path: root/render.awk
diff options
context:
space:
mode:
Diffstat (limited to 'render.awk')
-rw-r--r--render.awk40
1 files changed, 28 insertions, 12 deletions
diff --git a/render.awk b/render.awk
index db97f47..c528188 100644
--- a/render.awk
+++ b/render.awk
@@ -9,7 +9,10 @@ function show_link(l, i, dst){
print "Uncategorised link:", l[i,"Selector"] > /dev/stderr;
else{
printf("[1|%s|%s|%s|%s]\r\n", l[i,"LinkName"], l[i,"Selector"], l[i,"Host"], l[i,"Port"] ) > dst;
- info_line(l[i,"Description"],"Err", HOST, PORT, dst);
+ split(l[i,"Description"], descr, "\n");
+ for (d in descr){
+ info_line(descr[d],"Err", HOST, PORT, dst);
+ }
info_line("", "Err", HOST, PORT, dst);
}
@@ -38,9 +41,14 @@ function category_in_parents(category, i){
for (p in pars){
#printf("pars[%d]: %s\n", p, pars[p]);
if (pars[p]!="none"){### this is the root page
- f = pars[p];
+ dst=cfiles[pars[p]];
+ if (has_categories[pars[p]] == ""){
+ info_line("", "Err", HOST, PORT, dst);
+ info_line("Sub-categories:", "Err", HOST, PORT, dst) ;
+ }
+ has_categories[pars[p]]=1;
##print "cfiles[pars[p]]:", cfiles[f];
- show_category_link(category, i, cfiles[f]);
+ show_category_link(category, i, dst);
}
}
}
@@ -48,7 +56,10 @@ function category_in_parents(category, i){
function category_header(category, i, dst){
info_line(category[i,"Title"], "Err", HOST, PORT, dst);
info_line("", "Err", HOST, PORT, dst);
- info_line("Categories:", "Err", HOST, PORT, dst);
+ split(category[i,"Description"], descr, "\n");
+ for (d in descr){
+ info_line(descr[d], "Err", HOST, PORT, dst);
+ }
}
function get_link_categories(a){
@@ -72,6 +83,10 @@ function render_categories(category, cnum, link, lnum){
cname=category[i,"Name"];
#print "'" cname "'";
cfiles[cname]=BASEDIR category[i,"Selector"];
+ "dirname " cfiles[cname] | getline bdir;
+ if (system("ls -d " bdir " >/dev/null") >0){
+ system("mkdir " bdir);
+ }
#print cname ":" cfiles[cname];
cmd=sprintf("rm -f %s", cfiles[cname]);
system(cmd);
@@ -82,10 +97,6 @@ function render_categories(category, cnum, link, lnum){
function render_post_categories(category, cnum){
- for(i=1;i<=cnum; i++){
- info_line("_______________", "Err", HOST, PORT, cfiles[category[i,"Name"]]);
- info_line("Links:", "Err", HOST, PORT, cfiles[category[i,"Name"]]);
- }
}
@@ -96,7 +107,15 @@ function render_links(category, cnum, link, lnum){
get_link_categories(link[i,"Category"]);
for (c in cats){
if (cfiles[cats[c]]!=""){
- show_link(link, i, cfiles[cats[c]]);
+ dst=cfiles[cats[c]];
+ if (has_links[cats[c]] == ""){
+ info_line("_______________", "Err", \
+ HOST, PORT, dst);
+ info_line("Links:", "Err", HOST, PORT,\
+ dst);
+ }
+ has_links[cats[c]]=1;
+ show_link(link, i, dst);
}
}
}
@@ -108,8 +127,5 @@ function render_finalise(category, cnum, link, lnum){
for(i=1;i<=cnum; i++){
info_line("_______________", "Err", HOST, PORT, cfiles[category[i,"Name"]]);
printf("[1|%s|%s|%s|%s]\r\n", "Back to the lawn", ROOTSEL, HOST, PORT ) > cfiles[category[i,"Name"]];
- info_line("Links:", "Err", HOST, PORT, cfiles[category[i,"Name"]]);
}
-
-
}