# HG changeset patch # User Pranshu Sharma # Date 1734364179 -36000 # Node ID ee9b57cbbefc9f3f77e7e71d7ad4c808862975be # Parent f00ed34eca172ec392e87438a37d573cccb10e60 Big diff -r f00ed34eca17 -r ee9b57cbbefc genorg.pl --- a/genorg.pl Mon Dec 16 22:51:52 2024 +1000 +++ b/genorg.pl Tue Dec 17 01:49:39 2024 +1000 @@ -19,6 +19,7 @@ # Print required elisp code it is in $req_config # Add config option for $max_rss and $max_cat # Sort cataogirs by entires +# Document link to file x from file x no work # Variable for map_css # Remove the desc # Domain thing as well @@ -31,14 +32,16 @@ my $dir = "blog"; my $outdir = "out/"; my $emacs = "emacs"; -my $css = "style.css"; -my $map_css ="other.css"; +my $art_css = "astyle.css"; +my $cat_css ="cstyle.css"; my $no_name_dir = "c"; my $cache_file = "genorg-cache/cache.xml"; my $domain = "p.bauherren.ovh"; my $max_rss = 30; # The first page has one less article. Think of it as a feature. my $max_cat = 7; +my $main_title= ""; +my $blog_title = "Pranshu's blog"; my $username = $ENV{LOGNAME} || $ENV{USER} || getpwuid ($<); my $template = <<"END"; @@ -77,6 +80,14 @@ my $custom_code = "(list 1)"; +my $navbar = <<"END" =~ s/\n\s+//gr; + +END + my $elisp_code = <<"END" =~ s/\n\s+//gr; (let ((ls '(LIST))) (require 'org) @@ -100,29 +111,27 @@ TITLE - + + + NAV +

BTIT

SPLIT - -

Pranshu's Blog

-

All articles


+

All articles (rss)


SPLIT
- TITLE DATE -

DESCREPTION

- CATAG + TITLE DATE CATAG
SPLIT TITLE DATE -

DESCREPTION


SPLIT @@ -165,7 +174,7 @@ my %config_vars = ( 'emacs-path' => \$emacs, - css => \$css, + css => \$art_css, indir => \$dir, outdir => \$outdir, no_name_dir => \$no_name_dir @@ -279,23 +288,24 @@ my $cache_dom; sub main { - -d $cdir or help_and_bye; - mkdir $outdir; - chdir $cdir or die "Couldn't access $cdir\n"; - read_config $config_file; - -d $dir or die "$dir doesn't exist \n"; - find (\&wanted, $dir); - for (@files_to_move) { - copy $_, s#$dir/?#$outdir#er; - } - mkdir for @files_to_make; - values %{conv_files()}; - $cache_dom = XML::LibXML->load_xml(location => $cache_file) if $cache && -f $cache_file; - chdir $outdir; - @arts = sort { $b->{date} <=> $a->{date}} map { html_fixup($_) } @org_exps; - finalise_html(); - chdir '..'; - populate_cache(); + $outdir =~ s!/*$!/!; + -d $cdir or help_and_bye; + mkdir $outdir; + chdir $cdir or die "Couldn't access $cdir\n"; + read_config $config_file; + -d $dir or die "$dir doesn't exist \n"; + find (\&wanted, $dir); + for (@files_to_move) { + copy $_, s#$dir/?#$outdir#er; + } + mkdir for @files_to_make; + values %{conv_files()}; + $cache_dom = XML::LibXML->load_xml(location => $cache_file) if $cache && -f $cache_file; + chdir $outdir; + @arts = sort { $b->{date} <=> $a->{date}} map { html_fixup($_) } @org_exps; + finalise_html(); + chdir '..'; + populate_cache(); } sub populate_cache { @@ -304,12 +314,13 @@ my %c_els; for my $art (@arts) { # We need the: related, file, date - my ($art_el, $date, $title, $ca, $related) = - map {$dom->createElement($_)} ("art", "date", "title", "catag", "related"); + my ($art_el, $date, $title, $ca, $related, $utitle) = + map {$dom->createElement($_)} ("art", "date", "title", "catag", "related", "utitle"); $art_el->{path} = $art->{file}; $ca->appendText($art->{catag}); $title->appendText($art->{title}); $date->appendText($art->{date}->text_easy); + $utitle->appendText($art->{utitle}); my @ll = @{$art->{links}}; if (@ll) { my $links = $dom->createElement('links'); @@ -329,7 +340,7 @@ $related->appendText("\"$catag\"" . ($artt && "->\"$artt\" ")); } } - $art_el->appendChild($_) for ($date, $ca, $related, $title); + $art_el->appendChild($_) for ($date, $ca, $related, $title, $utitle); $root->appendChild($art_el); } $root->appendChild($_) for values %c_els; @@ -345,7 +356,7 @@ ? ($h_en_cat =~ s/CATAG/$data->{catag}/er) : $h_en; my $prel_path = "/$no_name_dir/" . (defined $catagory ? "c" : "c/b"); $str =~ s/DATE/$data->{date}->fmt/er - =~ s/TITLE/$data->{title}/er + =~ s/TITLE/$data->{utitle}/er =~ s|LINK|prel_path($prel_path, '/'. $data->{file})|er } @@ -357,8 +368,9 @@ DESC END - $thing =~ s|LINK|"$domain/" . $data->{file}|er - =~ s/TITLE/$data->{title}/er; + $thing + =~ s|LINK|"$domain/" . $data->{file}|er + =~ s/TITLE/$data->{utitle}/er; } sub min ($x, $y) { @@ -370,7 +382,7 @@ my $page = shift; '