test-org-element: Fix test
[org-mode/org-kjn.git] / mk / mansplit.pl
blob01ac851112b02cdb4800ad61ac0642f0d14d2785
1 #!/usr/bin/perl
2 # Work on the files that are created by makeinfo for html output
3 # split into many small files.
5 # This will walk though the files listed on the command line, install
6 # Sebastian Rose's key reader and add a small top-level-only table
7 # of contents that will be placed into a special region and visible
8 # in all subfiles. The small contents is a constant and has to be updated
9 # by hand, currently.
11 $contents = <<EOF;
12 <div id="table-of-contents">
13 <p>This is the official manual for the latest <a href="http://orgmode.org">Org-mode</a> release.</p>
14 <h2>Table of Contents</h2>
15 <div id="text-table-of-contents">
16 <ul>
17 <li><a name="toc_Top" href="index.html#Top">Org Mode Manual</a>
18 <li><a name="toc_Introduction" href="Introduction.html#Introduction">1 Introduction</a>
19 <li><a name="toc_Document-Structure" href="Document-Structure.html#Document-Structure">2 Document Structure</a>
20 <li><a name="toc_Tables" href="Tables.html#Tables">3 Tables</a>
21 <li><a name="toc_Hyperlinks" href="Hyperlinks.html#Hyperlinks">4 Hyperlinks</a>
22 <li><a name="toc_TODO-Items" href="TODO-Items.html#TODO-Items">5 TODO Items</a>
23 <li><a name="toc_Tags" href="Tags.html#Tags">6 Tags</a>
24 <li><a name="toc_Properties-and-Columns" href="Properties-and-Columns.html#Properties-and-Columns">7 Properties and Columns</a>
25 <li><a name="toc_Dates-and-Times" href="Dates-and-Times.html#Dates-and-Times">8 Dates and Times</a>
26 <li><a name="toc_Capture" href="Capture-_002d-Refile-_002d-Archive.html#Capture-_002d-Refile-_002d-Archive">9 Capture-Refile-Archive</a>
27 <li><a name="toc_Agenda-Views" href="Agenda-Views.html#Agenda-Views">10 Agenda Views</a>
28 <li><a name="toc_Markup" href="Markup.html#Markup">11 Markup</a>
29 <li><a name="toc_Exporting" href="Exporting.html#Exporting">12 Exporting</a>
30 <li><a name="toc_Publishing" href="Publishing.html#Publishing">13 Publishing</a>
31 <li><a name="toc_Working-With-Source-Code" href="Working-With-Source-Code.html#Working-With-Source-Code">14 Source Code</a>
32 <li><a name="toc_Miscellaneous" href="Miscellaneous.html#Miscellaneous">15 Miscellaneous</a>
33 <li><a name="toc_Hacking" href="Hacking.html#Hacking">A Hacking</a>
34 <li><a name="toc_MobileOrg" href="MobileOrg.html#MobileOrg">B MobileOrg</a>
35 <li><a name="toc_History-and-Acknowledgments" href="History-and-Acknowledgments.html#History-and-Acknowledgments">C History and Thanks</a>
36 <li><a name="toc_Main-Index" href="Main-Index.html#Main-Index">Main Index</a>
37 <li><a name="toc_Key-Index" href="Key-Index.html#Key-Index">Key Index</a>
38 <li><a name="toc_Variable-Index" href="Variable-Index.html#Variable-Index">Variable Index</a>
39 </li></ul>
40 </div>
41 </div>
42 </div>
43 EOF
46 $script = <<'EOF';
47 <link rel="stylesheet" href="http://orgmode.org/org-manual.css" type="text/css" />
48 <script type="text/javascript" src="http://orgmode.org/org-keys.js"></script>
49 <script type="text/javascript">
50 <!--/*--><![CDATA[/*><!--*/
51 OrgKeyReader.registerHref('h', 'index.html');
52 OrgKeyReader.registerHref('t', 'index.html');
53 /*]]>*/-->
54 </script>
55 EOF
57 while ($page = shift) {
58 system "mv $page $page.orig";
59 open IN,"<$page.orig" or die "Cannot read from $page.orig\n";
60 undef $/;
61 $all = <IN>;
62 close IN;
64 $all =~ s/<meta http-equiv="Content-Style-Type" content="text\/css">/$&\n$script/;
65 $all =~ s/^<body>/<body onload="OrgKeyReader.init();">\n$contents/m;
67 open OUT,">$page" or die "Cannot write to $page\n";
68 print OUT $all;
69 close OUT;
70 system "rm $page.orig";