77 <li> <a href="LINK">About</a> </li> |
77 <li> <a href="LINK">About</a> </li> |
78 </ul> |
78 </ul> |
79 END |
79 END |
80 |
80 |
81 my $elisp_code = <<"END" =~ s/\n\s+//gr; |
81 my $elisp_code = <<"END" =~ s/\n\s+//gr; |
82 (let ((ls '(LIST))) |
82 (let ((ls '(LIST))) |
83 (require 'org) |
83 (require 'org) |
84 (mapc |
84 (mapc |
85 (lambda (b) |
85 (lambda (b) |
86 (with-current-buffer b |
86 (with-current-buffer b |
87 (when (and (not (string-match "^ " (buffer-name b))) |
87 (when (and (not (string-match "^ " (buffer-name b))) |
88 (eq major-mode 'org-mode)) |
88 (eq major-mode 'org-mode)) |
89 (org-export-to-file 'html (pop ls))))) |
89 (org-export-to-file 'html (pop ls))))) |
90 (buffer-list)) |
90 (buffer-list)) |
91 (kill-emacs)) |
91 (kill-emacs)) |
92 END |
92 END |
93 |
93 |
94 |
94 |
95 my ($h_intro, $h_c_intro, $h_cat_li, $h_chap, $h_en_cat, $h_en, $h_end) |
95 my ($h_intro, $h_c_intro, $h_cat_li, $h_chap, $h_en_cat, $h_en, $h_end) |
96 = split /SPLIT/ ,<<"END" =~ s/\n\s+//gr; |
96 = split /SPLIT/ ,<<"END" =~ s/\n\s+//gr; |
171 <link>BLINK</link> |
171 <link>BLINK</link> |
172 END |
172 END |
173 |
173 |
174 my %config_vars = |
174 my %config_vars = |
175 ( |
175 ( |
176 'emacs-path' => \$emacs, |
176 'emacs-path' => \$emacs, |
177 acss => \$art_css, |
177 acss => \$art_css, |
178 ccss => \$cat_css, |
178 ccss => \$cat_css, |
179 indir => \$dir, |
179 indir => \$dir, |
180 outdir => \$outdir, |
180 outdir => \$outdir, |
181 no_name_dir => \$no_name_dir, |
181 no_name_dir => \$no_name_dir, |
182 etc_files => \$etc_files, |
182 etc_files => \$etc_files, |
183 cache => \$cache_file, |
183 cache => \$cache_file, |
184 home => \$home, |
184 home => \$home, |
185 about => \$about, |
185 about => \$about, |
186 domain => \$domain, |
186 domain => \$domain, |
187 title => \$blog_title, |
187 title => \$blog_title, |
188 rdesc => \$rdesc, |
188 rdesc => \$rdesc, |
189 max_rss => \$max_rss, |
189 max_rss => \$max_rss, |
190 max_cat => \$max_cat |
190 max_cat => \$max_cat |
191 ); |
191 ); |
192 |
192 |
193 |
193 |
194 sub read_config ($path) { |
194 sub read_config ($path) { |
195 open my $fh, '<', $path or die "Couldn't open config file\n"; |
195 open my $fh, '<', $path or die "Couldn't open config file\n"; |
271 s/org$/html/ for ($to, $rel_file); |
271 s/org$/html/ for ($to, $rel_file); |
272 unless ($cache && -f $to && (stat($to))[9] > (stat($file))[9]) { |
272 unless ($cache && -f $to && (stat($to))[9] > (stat($file))[9]) { |
273 $changed_files{$file} = $to; |
273 $changed_files{$file} = $to; |
274 push @modified_files, $rel_file; |
274 push @modified_files, $rel_file; |
275 } |
275 } |
276 } |
276 %changed_files // exit; |
277 %changed_files // exit; |
277 $elisp_code =~ s/LIST/join '', map "\"$_\" ", values %changed_files /e; |
278 $elisp_code =~ s/LIST/join '', map "\"$_\" ", values %changed_files /e; |
278 open my $fh, |
279 open my $fh, '-|', ($emacs, '-Q','--eval', "(progn $custom_code)", keys %changed_files, "--eval" , "$elisp_code"); |
279 '-|', |
280 close $fh; |
280 ($emacs, |
281 \%changed_files |
281 '-Q', |
282 } |
282 '--eval', |
|
283 "(progn $custom_code)", |
|
284 keys %changed_files, |
|
285 "--eval", |
|
286 "$elisp_code"); |
|
287 close $fh; |
|
288 \%changed_files |
|
289 } |
283 |
290 |
284 my $cdir; |
291 my $cdir; |
285 |
292 |
286 $ARGV[0] // die "No arguments provided\n"; |
293 $ARGV[0] // die "No arguments provided\n"; |
287 while ($_ = shift @ARGV) { |
294 while ($_ = shift @ARGV) { |
405 '<ul>' . join ("", map { |
412 '<ul>' . join ("", map { |
406 my ($str, $file) = @{$_}; |
413 my ($str, $file) = @{$_}; |
407 $str = "<span class=\"psel\">$str</span>" if $file && ($file == $page); |
414 $str = "<span class=\"psel\">$str</span>" if $file && ($file == $page); |
408 defined $file ? |
415 defined $file ? |
409 "<li><a href=\"$file.html\">$str</a>" : $str |
416 "<li><a href=\"$file.html\">$str</a>" : $str |
410 } ((["←", $page - 1]) x!! ($page - 1), |
417 } ((["←", $page - 1]) x!! ($page - 1), |
411 @_, |
418 @_, |
412 (["→", $page + 1]) x ($page != $_[$#_]->[1]))) . '</ul>' |
419 (["→", $page + 1]) x ($page != $_[$#_]->[1]))) . '</ul>' |
413 } |
420 } |
414 |
421 |
415 sub move_on_if_neccasary ($fh, $art_num, $total_articles, $path, $title, $rp) { |
422 sub move_on_if_neccasary ($fh, $art_num, $total_articles, $path, $title, $rp) { |
416 return $fh if $art_num == 0 || $art_num % $max_cat; |
423 return $fh if $art_num == 0 || $art_num % $max_cat; |
417 my $cpage = $art_num / $max_cat; |
424 my $cpage = $art_num / $max_cat; |
418 print $fh panigation($cpage, ceil($total_articles / $max_cat), $path); |
425 print $fh panigation($cpage, ceil($total_articles / $max_cat), $path); |