emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
blob 49ea8483596303b74d5338fbff7c03fc81c48046 3070 bytes (raw)
name: UTILITIES/mansplit.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
 
#!/usr/bin/perl
# Work on the files that are created by makeinfo for html output
# split into many small files.

# This will walk though the files listed on the command line, install
# Sebastian Rose's key reader and add a small top-level-only table
# of contents that will be placed into a special region and visible
# in all subfiles.  The small contents is a constant and has to be updated
# by hand, currently.

$contents = <<EOF;
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a name="toc_Top" href="index.html#Top">Org Mode Manual</a>
<li><a name="toc_Introduction" href="Introduction.html#Introduction">1 Introduction</a>
<li><a name="toc_Document-Structure" href="Document-Structure.html#Document-Structure">2 Document Structure</a>
<li><a name="toc_Tables" href="Tables.html#Tables">3 Tables</a>
<li><a name="toc_Hyperlinks" href="Hyperlinks.html#Hyperlinks">4 Hyperlinks</a>
<li><a name="toc_TODO-Items" href="TODO-Items.html#TODO-Items">5 TODO Items</a>
<li><a name="toc_Tags" href="Tags.html#Tags">6 Tags</a>
<li><a name="toc_Properties-and-Columns" href="Properties-and-Columns.html#Properties-and-Columns">7 Properties and Columns</a>
<li><a name="toc_Dates-and-Times" href="Dates-and-Times.html#Dates-and-Times">8 Dates and Times</a>
<li><a name="toc_Capture" href="Capture.html#Capture">9 Capture</a>
<li><a name="toc_Agenda-Views" href="Agenda-Views.html#Agenda-Views">10 Agenda Views</a>
<li><a name="toc_Embedded-LaTeX" href="Embedded-LaTeX.html#Embedded-LaTeX">11 Embedded LaTeX</a>
<li><a name="toc_Exporting" href="Exporting.html#Exporting">12 Exporting</a>
<li><a name="toc_Publishing" href="Publishing.html#Publishing">13 Publishing</a>
<li><a name="toc_Miscellaneous" href="Miscellaneous.html#Miscellaneous">14 Miscellaneous</a>
<li><a name="toc_Extensions" href="Extensions.html#Extensions">A Extensions</a>
<li><a name="toc_Hacking" href="Hacking.html#Hacking">B Hacking</a>
<li><a name="toc_History-and-Acknowledgments" href="History-and-Acknowledgments.html#History-and-Acknowledgments">C History and Acknowledgments</a>
<li><a name="toc_Main-Index" href="Main-Index.html#Main-Index">Main Index</a>
<li><a name="toc_Key-Index" href="Key-Index.html#Key-Index">Key Index</a>
</li></ul>
</div>
</div>
</div>
EOF


$script = <<'EOF';
</style><link rel="stylesheet" href="http://orgmode.org/org.css" type="text/css" />
<script type="text/javascript" src="http://orgmode.org/org-keys.js"></script>
<script type="text/javascript">
  <!--/*--><![CDATA[/*><!--*/
   OrgKeyReader.registerHref('h', 'index.html');
   OrgKeyReader.registerHref('t', 'index.html');
  /*]]>*/-->
</script>
EOF

while ($page = shift) {
system "mv $page $page.orig";
open IN,"<$page.orig" or die "Cannot read from $page.orig\n";
undef $/;
$all = <IN>;
close IN;

$all =~ s/<meta http-equiv="Content-Style-Type" content="text\/css">/$&\n$script/;
$all =~ s/^<body>/<body onload="OrgKeyReader.init();">\n$contents/m;

open OUT,">$page" or die "Cannot write to $page\n";
print OUT $all;
close OUT;
system "rm $page.orig";
}

debug log:

solving 49ea848 ...
found 49ea848 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).