emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
blob 39439bd4b00f8ff3b60bcde01d66e20207abf89c 1133 bytes (raw)
name: mk/manfull.pl 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
 
#!/usr/bin/perl

$failures = 0;

while ($page = shift) {
system "mv $page $page.orig";
open IN,"<$page.orig" or die "Cannot read from $page.orig\n";
open OUT,">$page" or die "Cannot write to $page\n";

$toc = undef;

while (<IN>) {
  if (/<meta http-equiv="Content-Style-Type" content="text\/css">/) {
    print OUT;
    print OUT '<link rel="stylesheet" href="https://orgmode.org/org-manual.css" type="text/css" />';
  } elsif (/<div class="contents">/) {
    print OUT;
    print OUT '<p>This is the official manual for the latest <a href="https://orgmode.org">Org mode</a> release.</p><div id="table-of-contents">';
  } elsif (/<h2>Table of Contents<\/h2>|<h2 class="contents-heading">/) {
    print OUT;
    print OUT '<a href="https://orgmode.org">https://orgmode.org</a><br/><div id="text-table-of-contents">';
    $toc = 1;
  } elsif (/<\/div>/ and $toc) {
    print OUT "</div></div></div>";
    $toc = 0;
  } else {
    print OUT;
  }
}
system "rm $page.orig";

if (!defined($toc) || $toc != 0) {
  ++$failures;
  print STDERR "Patching of $page failed\n";
}
}

$failures == 0 or die "Patching of $failures files failed\n";

debug log:

solving 39439bd4b ...
found 39439bd4b in https://git.savannah.gnu.org/cgit/emacs/org-mode.git

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).