genorg.pl
changeset 20 ce527668bd78
parent 19 4af32b97ad33
child 21 f61879daacf0
--- a/genorg.pl	Mon Dec 30 00:57:54 2024 +1000
+++ b/genorg.pl	Mon Jan 06 01:17:51 2025 +1000
@@ -79,16 +79,16 @@
 END
 
 my $elisp_code = <<"END" =~ s/\n\s+//gr;
-(let ((ls '(LIST)))
-  (require 'org)
-  (mapc
-   (lambda (b)
-     (with-current-buffer b
-       (when (and (not (string-match "^ " (buffer-name b)))
-		  (eq major-mode 'org-mode))
-	 (org-export-to-file 'html (pop ls)))))
-   (buffer-list))
-   (kill-emacs))
+  (let ((ls '(LIST)))
+    (require 'org)
+    (mapc
+    (lambda (b)
+    (with-current-buffer b
+    (when (and (not (string-match "^ " (buffer-name b)))
+    (eq major-mode 'org-mode))
+    (org-export-to-file 'html (pop ls)))))
+    (buffer-list))
+    (kill-emacs))
 END
 
 
@@ -173,21 +173,21 @@
   
 my %config_vars =
   (
-   'emacs-path' => \$emacs,
-   acss => \$art_css,
-   ccss => \$cat_css,
-   indir => \$dir,
-   outdir => \$outdir,
-   no_name_dir => \$no_name_dir,
-   etc_files => \$etc_files,
-   cache => \$cache_file,
-   home => \$home,
-   about => \$about,
-   domain => \$domain,
-   title => \$blog_title,
-   rdesc => \$rdesc,
-   max_rss => \$max_rss,
-   max_cat => \$max_cat
+  'emacs-path' => \$emacs,
+  acss => \$art_css,
+  ccss => \$cat_css,
+  indir => \$dir,
+  outdir => \$outdir,
+  no_name_dir => \$no_name_dir,
+  etc_files => \$etc_files,
+  cache => \$cache_file,
+  home => \$home,
+  about => \$about,
+  domain => \$domain,
+  title => \$blog_title,
+  rdesc => \$rdesc,
+  max_rss => \$max_rss,
+  max_cat => \$max_cat
   );
 
 
@@ -273,13 +273,20 @@
       $changed_files{$file} = $to;
       push @modified_files, $rel_file;
     }
+    %changed_files // exit;
+    $elisp_code =~ s/LIST/join '', map "\"$_\" ", values %changed_files /e;
+    open my $fh,
+      '-|',
+      ($emacs,
+       '-Q',
+       '--eval',
+       "(progn $custom_code)",
+       keys %changed_files,
+       "--eval",
+       "$elisp_code");
+    close $fh;
+    \%changed_files
   }
-  %changed_files // exit;
-  $elisp_code =~ s/LIST/join '', map "\"$_\" ", values %changed_files /e;
-  open my $fh, '-|', ($emacs, '-Q','--eval', "(progn $custom_code)", keys %changed_files, "--eval" , "$elisp_code");
-  close $fh;
-  \%changed_files
-}
 
 my $cdir;
 
@@ -407,10 +414,10 @@
     $str = "<span class=\"psel\">$str</span>" if $file && ($file == $page);
     defined $file ?
       "<li><a href=\"$file.html\">$str</a>" : $str
-    } ((["←", $page - 1]) x!! ($page - 1),
-       @_,
-       (["→", $page + 1]) x ($page != $_[$#_]->[1]))) . '</ul>'
-     }
+  } ((["←", $page - 1]) x!! ($page - 1),
+     @_,
+     (["→", $page + 1]) x ($page != $_[$#_]->[1]))) . '</ul>'
+}
 
 sub move_on_if_neccasary ($fh, $art_num, $total_articles, $path, $title, $rp) {
   return $fh if $art_num == 0 || $art_num % $max_cat;