1. Shlomi Fish
  2. shlomi-fish-homepage

Commits

shl...@cec68495-dca5-4e2b-845c-11fdaaa4f967  committed 5a48613

Changed the navigation menu to the new Shlomif::NavMenu one.

  • Participants
  • Parent commits 6de45e8
  • Branches default

Comments (0)

Files changed (3)

File Makefile

View file
-WML_FLAGS += --passoption=2,-X3074 -DROOT~.
+WML_FLAGS += --passoption=2,-X3074 --passoption=3,-I../lib/ -DROOT~.
 
 # t2 macros
 
 	rm -fr $(T2_DEST)/*
 	rm -fr $(VIPE_DEST)/*
 
+DOCS_COMMON_DEPS = template.wml lib/MyNavData.pm
 # t2 targets
-$(T2_DOCS_DEST) :: $(T2_DEST)/% : t2/%.wml template.wml t2/.wmlrc
+$(T2_DOCS_DEST) :: $(T2_DEST)/% : t2/%.wml t2/.wmlrc $(DOCS_COMMON_DEPS) 
 	( cd t2 && wml $(T2_WML_FLAGS) -DFILENAME=$(patsubst $(T2_DEST)/%,%,$(patsubst %.wml,%,$@)) $(patsubst t2/%,%,$<) ) > $@
 
 $(T2_DIRS_DEST) :: $(T2_DEST)/% : unchanged
 
 # vipe targets
 
-$(VIPE_DOCS_DEST) :: $(VIPE_DEST)/% : vipe/%.wml template.wml vipe/.wmlrc
+$(VIPE_DOCS_DEST) :: $(VIPE_DEST)/% : vipe/%.wml vipe/.wmlrc $(DOCS_COMMON_DEPS)
 	( cd vipe && wml $(VIPE_WML_FLAGS) -DFILENAME=$(patsubst $(VIPE_DEST)/%,%,$(patsubst %.wml,%,$@)) $(patsubst vipe/%,%,$<) ) > $@
 
 $(VIPE_DIRS_DEST) :: $(VIPE_DEST)/% : unchanged

File lib/MyNavData.pm

View file
+package MyNavData;
+
+my $hosts =
+{
+    't2' => 
+    {
+        'base_url' => "http://shlomif.il.eu.org/",
+    },
+    'vipe' =>
+    {
+        'base_url' => "http://vipe.technion.ac.il/~shlomif/",
+    },
+};
+
+my $tree_contents =
+{
+    'host' => "t2",
+    'value' => "Shlomi Fish",
+    'title' => "Shlomi Fish' Homepage",
+    'expand_re' => "",
+    'subs' =>
+    [
+        {
+            'value' => "About Myself",
+            'url' => "me/",
+            'subs' => 
+            [
+                {
+                    'value' => "Bio",
+                    'url' => "personal.html",
+                    'title' => "A Short Biography of Myself",
+                },
+                {
+                    'value' => "Contact",
+                    'url' => "me/contact-me/",
+                    'title'=> "How to Contact me in Every Conceivable Way",
+                },
+                {
+                    'value' => "My Resum&eacute;s",
+                    'url' => "me/resumes/",
+                },
+            ],               
+        },
+        {
+            'value' => "Humour", 
+            'url' => "humour/",
+            'title' => "My Humorous Creations",
+            'subs' => 
+            [
+                {
+                    'value' => "The Enemy", 
+                    'url' => "humour/TheEnemy/",
+                    'title' => "The Enemy and How I Helped to Fight It",
+                },
+                {
+                    'value' => "TOWTF",
+                    'url' => "humour/TOWTF/",
+                    'title' => "The One with the Fountainhead",
+                },
+                {
+                    'value' => "The Pope",
+                    'url' => "humour/Pope/",
+                    'title' => "The Pope Died on Sunday",
+                },
+                {
+                    'value' => "Humour Archive",
+                    'title' => "Archive of Humorous Bits I came up with",
+                    'url' => "humour.html",
+                    'hide' => 1,
+                },
+                {
+                    'value' => "Fortune Cookies Collection",
+                    'title' => "Collection of Files for Input to the UNIX 'fortune' Program",
+                    'url' => "humour/fortunes",
+                    'host' => "vipe",
+                    'hide' => 1,
+                },
+            ],
+        },
+        {
+            'value' => "Math-Ventures",
+            'url' => "MathVentures/",
+            'title' => "Mathematical Riddles and their Solutions",
+        },
+        {
+            'value' => "Computer Art",
+            'url' => "art/",
+            'title' => "Computer art I created while explaining how.",
+        },
+        {
+            'value' => "Software",
+            'url' => "open-source/",
+            'title' => "Pages related to Software (mostly Open-Source)",
+            'subs' => 
+            [
+                {
+                    'value' => "Freecell Solver",
+                    'url' => "freecell-solver/",
+                },
+                {
+                    'value' => "MikMod for Java",
+                    'title' => "A Player for MOD Files (a type of Music Files) for the Java Environment",
+                    'url' => "jmikmod/",
+                },
+                {
+                    'value' => "FCFS RWLock",
+                    'title' => "A First-Come First-Served Readers/Writers Lock",
+                    'url' => "rwlock/",
+                },
+                {
+                    'value' => "Quad-Pres",
+                    'title' => "A Tool for Creating HTML Presentations",
+                    'url' => "quadpres/",
+                },
+                {
+                    'value' => "Favourite OSS",
+                    'title' => "Favourite Open-Source Software",
+                    'url' => "open-source/favourite/",
+                },
+                {
+                    'value' => "Interviews",
+                    'title' => "Interviews with Open-Source People",
+                    'url' => "open-source/interviews/",
+                },
+                {
+                    'value' => "Portability Libraries",
+                    'title' => "Cross-Platform Abstraction Libraries",
+                    'url' => "abstraction/",
+                    'host' => "vipe",
+                    'hide' => 1,
+                },
+                {
+                    'value' => "Software Tools",
+                    'title' => "Software Constructions and Management Tools",
+                    'url' => "software-tools/",
+                    'host' => "vipe",
+                    'hide' => 1,
+                },
+            ],
+        },
+        {
+            'value' => "Lectures", 
+            'url' => "lecture/",
+            'expand_re' => "^lecture/",
+            'title' => "Presentations I Wrote (Mostly Technical)",
+            'host' => "vipe",
+            'subs' => 
+            [
+                {
+                    'value' => "Perl for Newbies",
+                    'url' => "lecture/Perl/Newbies/",
+                },
+                {
+                    'value' => "Freecell Solver",
+                    'url' => "lecture/Freecell-Solver/",
+                },
+                {
+                    'value' => "Lambda Calculus",
+                    'title' => "A presentation about a Turing-complete programming environment with only two primitives",
+                    'url' => "lecture/Lambda-Calculus/",
+                },
+                {
+                    'value' => "The Gimp",
+                    'title' => "A Presentation about the GNU Image Manipulation Program",
+                    'url' => "lecture/Gimp/",
+                },
+                {
+                    'value' => "GNU Autotools",
+                    'url' => "lecture/Autotools/",
+                },
+                {
+                    'value' => "Web Meta Lecture",
+                    'title' => "A Presentation about the Web Meta Language",
+                    'url' => "lecture/WebMetaLecture/",
+                },
+                {
+                    'value' => "Haskell",
+                    'title' => "Haskell for Perl Programmers",
+                    'url' => "lecture/Perl/Haskell/",
+                    'hide' => 1,
+                },
+            ],
+        },
+        {
+            'value' => "Essays",
+            'url' => "philosophy/",
+            'title' => "Various Essays and Articles about Technology and Philosophy in General",
+            'subs' =>
+            [
+                {
+                    'value' => "What is Open Source?",
+                    'url' => "philosophy/foss-other-beasts/",
+                    'title' => "Free Software, Open Source and Other Beasts",
+                },
+                {
+                    'value' => "Perl &amp; Newcomers",
+                    'url' => "philosophy/perl-newcomers/",
+                    'title' => "&quot;Usability&quot; of the Perl Online World for Newcomers",
+                },
+                {
+                    'value' => "Objectivism and Open Source",
+                    'url' => "philosophy/obj-oss/",
+                    'title' => "Objectivism and Open Source",
+                },
+                {
+                    'value' => "The Eternal Jew",
+                    'url' => "philosophy/the-eternal-jew/",
+                    'title' => "The Eternal Jew - An Essay about Philosophy",
+                },
+            ],
+        },
+        {
+            'value' => "Opinion on DeCSS",
+            'url' => "DeCSS/",
+            'title' => "My Opinion on the DeCSS (= DVDs' de-scrambling code) fiasco",
+        },
+        {
+            'separator' => 1,
+            'skip' => 1,
+        },
+        {
+            'value' => "Cool Links",
+            'url' => "links.html",
+            'title' => "An incomplete list of links I find cool and/or useful.",
+        },
+        {
+            'separator' => 1,
+            'skip' => 1,
+        },
+        {
+            'url' => "site-source/",
+            'value' => "Site's Source",
+            'title' => "The source code used to generate this site",
+        },
+    ],
+};
+
+sub get_params
+{
+    return 
+        (
+            'hosts' => $hosts,
+            'tree_contents' => $tree_contents,
+        );
+}
+
+1;

File template.wml

View file
 # #use wml::des::navbar
 #include '../std/logo.wml'
 
+<:{
+use MyNavData;
+use Shlomif::NavMenu;
+
+my $filename = "$(FILENAME)";
+$filename =~ s!index\.html$!!;
+$filename = "/$filename";
+
+my $nav_bar = Shlomif::NavMenu->new(
+    'path_info' => $filename,
+    'current_host' => "$(SERVER)",
+    MyNavData::get_params(),
+    );
+
+my $rendered_results = 
+        $nav_bar->render(
+            no_ie => 'true',
+            styles => 
+            {
+                'bar' => 'nav',
+                'level0' => 'navbarmain',
+                'level1' => 'navbarnested',
+                'level2' => "navbarnested",
+                'level3' => "navbarnested",
+                'level4' => "navbarnested",
+                'list' => "navbarmain",
+            },
+            );
+
+use vars qw($nav_links);
+
+$nav_links = $rendered_results->{nav_links};
+
+use vars qw($nav_html);
+
+$nav_html = $rendered_results->{html};
+
+}:>
+
+
 # Utility Functions.
 
 <define-tag software_patents>1</define-tag>
 <head>
 <title>{#SUBJECT_LOC#}</title>
 <link rel="StyleSheet" href="$(ROOT)/style.css" type="text/css" />
+<:{
+use CGI qw();
+
+while (my ($key, $url) = each(%$nav_links))
+{
+    print "<link rel=\"$key\" href=\"" . CGI::escapeHTML($url) . "\" />\n"
+}
+}:>
 <if "$(PRINTABLE)" "<printable_style />" "" />
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 </head>
 <restore host />
 <restore url /></define-tag>
 
-<define-tag navbarlink>
-<preserve host />
-<preserve title />
-<set-var %attributes />
-<set-var l="<rellink url="%0" host=<get-var host /> />" />
-<set-var t="<if "<get-var title />" <attributes-quote title=<get-var title /> /> "" />" />
-<if
-    ;;; Determine if %0 matches this document
-    <ifeq "$(FILENAME)" "%0"
-        "1"
-        <ifeq "$(FILENAME)" "%0index.html"
-            "1"
-            ""
-        />
-
-    />
-    ;;; If so - bolds the text
-    "<b>%1</b>"
-    ;;; If not - makes a hyperlink
-    
-    "<a href="<get-var l />" <get-var t /> >%1</a>"
-/>
-<restore title />
-<restore host />
-</define-tag>
-
-<define-tag humour:navbar>
-<ul class="navbarnested">
-<li><navbarlink "humour/TheEnemy/" "The Enemy and how I Helped to Fight it" /></li>
-<li><navbarlink "humour/TOWTF/" "The One with the Fountainhead" /></li>
-<li><navbarlink "humour/Pope/" "The Pope Died on Sunday" /></li>
-</ul>
-</define-tag>
-
 <define-tag vipe:url>http://vipe.technion.ac.il/~shlomif/%0</define-tag>
-<define-tag lect:link><navbarlink "lecture/%0" "%1" host="vipe" /></define-tag>
-
-<define-tag oss:navbar>
-<ul class="navbarnested">
-<li><navbarlink "freecell-solver/" "Freecell Solver" host="vipe" /></li>
-<li><navbarlink "jmikmod/" "MikMod for Java" /></li>
-<li><navbarlink "rwlock/" "FCFS RWLock" host="vipe" /></li>
-<li><navbarlink "lm-solve/" "LM-Solve" host="vipe" /></li>
-<li><navbarlink "quadpres/" "Quad-Pres" host="vipe" /></li>
-</ul>
-</define-tag>
-
-<define-tag is:oss><match "%0" "^(open-source|jmikmod|gradient-fu|quadpres|rwlock|lm-solve)/" action="report" /></define-tag>
-
-<define-tag lectures:navbar>
-<ul class="navbarnested">
-<li><lect:link "Perl/Newbies/" "Perl for Newbies" /></li>
-<li><lect:link "Freecell-Solver/" "Freecell Solver" /></li>
-<li><lect:link "Lambda-Calculus/" "Lambda Calculus" /></li>
-<li><lect:link "Gimp/" "The Gimp" /></li>
-<li><lect:link "Autotools/" "GNU Autotools" /></li>
-<li><lect:link "WebMetaLecture/" "Web Meta Lecture" /></li>
-</ul>
-</define-tag>
-
-<define-tag is:aboutme><match "%0" "^((SFresume(_detailed)?\.html)|(me/.*)|(personal\.html))$" action="report" /></define-tag>
-
-<define-tag aboutme:navbar>
-<ul class="navbarnested">
-<li><navbarlink "personal.html" "Bio" /></li>
-<li><navbarlink "me/contact-me/" "Contact" title="How to Contact Me" /></li>
-<li><navbarlink "me/resumes/" "My Resum&eacute;s" /></li>
-</ul>
-</define-tag>
 
 <define-tag validhtml>
 <br /><br /><br /><br />
      style="border:0" /></a></div>"
     ""
     />
-
-<ul class="navbarmain">
-<li><navbarlink "" "Home" /></li>
-<li><navbarlink "me/" "About Myself" />
-<if <is:aboutme "$(FILENAME)" />
-    <aboutme:navbar />
-    ""
-    />    
-</li>
-<li><navbarlink "humour/" "Humour" />
-<if <match "$(FILENAME)" "humour/*" action="report" /> 
-    <humour:navbar /> 
-    "" 
-    />
-</li>
-<li><navbarlink "MathVentures/" "Math-Ventures" /></li>
-<li><navbarlink "art/" "Computer Art" /></li>
-<li><navbarlink "open-source/" "Software" />
-<if <is:oss "$(FILENAME)" />
-    <oss:navbar />
-    ""
-    />
-</li>
-<li><navbarlink "lecture/" "Lectures" host="vipe" />
-<if <match "$(FILENAME)" "^lecture/" action="report" /> 
-    <lectures:navbar /> 
-    "" 
-    />
-</li>
-<li><navbarlink "philosophy/" "Philosophy" /></li>
-<li><navbarlink "DeCSS/" "Opinion on DeCSS" /></li>
-<li><br /></li>
-<li><navbarlink "links.html" "Cool Links" /></li>
-<li><br /></li>
-<li><navbarlink "site-source/" "Site's Source Code" /></li>
-</ul>
+    
+<:{ print join("\n", @$nav_html); }:>
 
 <validhtml />