org-element: Elements can accept multiple secondary strings
[org-mode.git] / mk / guidesplit.pl
blob436519b34f343f0fdcb2eafb90f0a2fce16b2d7b
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 <h2>Table of Contents</h2>
14 <div id="text-table-of-contents">
15 <ul>
16 <li><a name="toc_Top" href="index.html#Top">Org Mode Compact Guide</a>
17 <li><a name="toc_Introduction" href="Introduction.html#Introduction">1 Introduction</a>
18 <li><a name="toc_Document-Structure" href="Document-Structure.html#Document-Structure">2 Document Structure</a>
19 <li><a name="toc_Tables" href="Tables.html#Tables">3 Tables</a>
20 <li><a name="toc_Hyperlinks" href="Hyperlinks.html#Hyperlinks">4 Hyperlinks</a>
21 <li><a name="toc_TODO-Items" href="TODO-Items.html#TODO-Items">5 TODO Items</a>
22 <li><a name="toc_Tags" href="Tags.html#Tags">6 Tags</a>
23 <li><a name="toc_Properties" href="Properties.html#Properties">7 Properties</a>
24 <li><a name="toc_Dates-and-Times" href="Dates-and-Times.html#Dates-and-Times">8 Dates and Times</a>
25 <li><a name="toc_Capture" href="Capture-_002d-Refile-_002d-Archive.html#Capture-_002d-Refile-_002d-Archive">9 Capture-Refile-Archive</a>
26 <li><a name="toc_Agenda-Views" href="Agenda-Views.html#Agenda-Views">10 Agenda Views</a>
27 <li><a name="toc_Markup" href="Markup.html#Markup">11 Markup</a>
28 <li><a name="toc_Exporting" href="Exporting.html#Exporting">12 Exporting</a>
29 <li><a name="toc_Publishing" href="Publishing.html#Publishing">13 Publishing</a>
30 <li><a name="toc_Working-With-Source-Code" href="Working-With-Source-Code.html#Working-With-Source-Code">14 Source code</a>
31 <li><a name="toc_Miscellaneous" href="Miscellaneous.html#Miscellaneous">15 Miscellaneous</a>
32 </li></ul>
33 </div>
34 </div>
35 </div>
36 EOF
38 $script = <<'EOF';
39 </style><link rel="stylesheet" href="http://orgmode.org/org.css" type="text/css" />
40 <script type="text/javascript" src="http://orgmode.org/org-keys.js"></script>
41 <script type="text/javascript">
42 <!--/*--><![CDATA[/*><!--*/
43 OrgKeyReader.registerHref('h', 'index.html');
44 OrgKeyReader.registerHref('t', 'index.html');
45 /*]]>*/-->
46 </script>
47 EOF
49 while ($page = shift) {
50 system "mv $page $page.orig";
51 open IN,"<$page.orig" or die "Cannot read from $page.orig\n";
52 undef $/;
53 $all = <IN>;
54 close IN;
56 $all =~ s/<meta http-equiv="Content-Style-Type" content="text\/css">/$&\n$script/;
57 $all =~ s/^<body>/<body onload="OrgKeyReader.init();">\n$contents/m;
59 open OUT,">$page" or die "Cannot write to $page\n";
60 print OUT $all;
61 close OUT;
62 system "rm $page.orig";