1#!/usr/bin/env tclsh
2#
3# Run this TCL script to generate a WIKI page that contains a
4# permuted index of the various documentation files.
5#
6#    tclsh mkindex.tcl
7#
8# 2021-02-26:  The permuted index feature has been removed because
9# moderns don't understand such things, and seeing so many entries
10# confuses them.
11#
12
13set doclist {
14  aboutcgi.wiki {How CGI Works In Fossil}
15  aboutdownload.wiki {How The Download Page Works}
16  adding_code.wiki {Adding New Features To Fossil}
17  adding_code.wiki {Hacking Fossil}
18  alerts.md {Email Alerts And Notifications}
19  antibot.wiki {Defense against Spiders and Bots}
20  backoffice.md {The "Backoffice" mechanism of Fossil}
21  backup.md {Backing Up a Remote Fossil Repository}
22  blame.wiki {The Annotate/Blame Algorithm Of Fossil}
23  blockchain.md {Is Fossil A Blockchain?}
24  branching.wiki {Branching, Forking, Merging, and Tagging}
25  bugtheory.wiki {Bug Tracking In Fossil}
26  build.wiki {Compiling and Installing Fossil}
27  cap-theorem.md {Fossil and the CAP Theorem}
28  caps/ {Administering User Capabilities}
29  caps/admin-v-setup.md {Differences Between Setup and Admin Users}
30  caps/ref.html {User Capability Reference}
31  cgi.wiki {CGI Script Configuration Options}
32  changes.wiki {Fossil Changelog}
33  chat.md {Fossil Chat}
34  checkin_names.wiki {Check-in And Version Names}
35  checkin.wiki {Check-in Checklist}
36  childprojects.wiki {Child Projects}
37  chroot.md {Server Chroot Jail}
38  ckout-workflows.md {Check-Out Workflows}
39  co-vs-up.md {Checkout vs Update}
40  copyright-release.html {Contributor License Agreement}
41  concepts.wiki {Fossil Core Concepts}
42  contact.md {Developer Contact Information}
43  contribute.wiki {Contributing Code or Documentation To The Fossil Project}
44  css-tricks.md {Fossil CSS Tips and Tricks}
45  customgraph.md {Theming: Customizing the Timeline Graph}
46  customskin.md {Theming: Customizing The Appearance of Web Pages}
47  customskin.md {Custom Skins}
48  custom_ticket.wiki {Customizing The Ticket System}
49  defcsp.md {The Default Content Security Policy}
50  delta-manifests.md {Delta Manifests}
51  delta_encoder_algorithm.wiki {Fossil Delta Encoding Algorithm}
52  delta_format.wiki {Fossil Delta Format}
53  embeddeddoc.wiki {Embedded Project Documentation}
54  encryptedrepos.wiki {How To Use Encrypted Repositories}
55  env-opts.md {Environment Variables and Global Options}
56  event.wiki {Events}
57  faq.wiki {Frequently Asked Questions}
58  fileedit-page.md {The fileedit Page}
59  fileformat.wiki {Fossil File Format}
60  fiveminutes.wiki {Up and Running in 5 Minutes as a Single User}
61  forum.wiki {Fossil Forums}
62  foss-cklist.wiki {Checklist For Successful Open-Source Projects}
63  fossil-from-msvc.wiki {Integrating Fossil in the Microsoft Express 2010 IDE}
64  fossil-is-not-relational.md {Introduction to the (Non-relational) Fossil Data Model}
65  fossil_prompt.wiki {Fossilized Bash Prompt}
66  fossil-v-git.wiki {Fossil Versus Git}
67  globs.md {File Name Glob Patterns}
68  gitusers.md {Git to Fossil Translation Guide}
69  grep.md {Fossil grep vs POSIX grep}
70  hacker-howto.wiki {Hacker How-To}
71  hacker-howto.wiki {Fossil Developers Guide}
72  hashes.md {Hashes: Fossil Artifact Identification}
73  hashpolicy.wiki {Hash Policy: Choosing Between SHA1 and SHA3-256}
74  /help {Lists of Commands and Webpages}
75  hints.wiki {Fossil Tips And Usage Hints}
76  history.md {The Purpose And History Of Fossil}
77  index.wiki {Home Page}
78  inout.wiki {Import And Export To And From Git}
79  interwiki.md {Interwiki Links}
80  image-format-vs-repo-size.md {Image Format vs Fossil Repo Size}
81  javascript.md {Use of JavaScript in Fossil}
82  loadmgmt.md {Managing Server Load}
83  makefile.wiki {The Fossil Build Process}
84  mirrorlimitations.md {Limitations On Git Mirrors}
85  mirrortogithub.md {How To Mirror A Fossil Repository On GitHub}
86  /md_rules {Markdown Formatting Rules}
87  newrepo.wiki {How To Create A New Fossil Repository}
88  patchcmd.md {The "fossil patch" Command}
89  password.wiki {Password Management And Authentication}
90  pikchr.md {The Pikchr Diagram Language}
91  pop.wiki {Principles Of Operation}
92  private.wiki {Creating, Syncing, and Deleting Private Branches}
93  qandc.wiki {Questions And Criticisms}
94  quickstart.wiki {Fossil Quick Start Guide}
95  quotes.wiki
96      {Quotes: What People Are Saying About Fossil, Git, and DVCSes in General}
97  ../test/release-checklist.wiki {Pre-Release Testing Checklist}
98  rebaseharm.md {Rebase Considered Harmful}
99  reviews.wiki {Reviews}
100  selfcheck.wiki {Fossil Repository Integrity Self Checks}
101  selfhost.wiki {Fossil Self Hosting Repositories}
102  server/ {How To Configure A Fossil Server}
103  serverext.wiki {CGI Server Extensions}
104  serverext.wiki {Adding Extensions To A Fossil Server Using CGI Scripts}
105  settings.wiki {Fossil Settings}
106  /sitemap {Site Map}
107  shunning.wiki {Shunning: Deleting Content From Fossil}
108  stats.wiki {Performance Statistics}
109  style.wiki {Source Code Style Guidelines}
110  ssl.wiki {Using SSL with Fossil}
111  sync.wiki {The Fossil Sync Protocol}
112  tech_overview.wiki {A Technical Overview Of The Design And Implementation
113                      Of Fossil}
114  tech_overview.wiki {SQLite Databases Used By Fossil}
115  th1.md {The TH1 Scripting Language}
116  theory1.wiki {Thoughts On The Design Of The Fossil DVCS}
117  tickets.wiki {The Fossil Ticket System}
118  unvers.wiki {Unversioned Files}
119  webpage-ex.md {Webpage Examples}
120  webui.wiki {The Fossil Web Interface}
121  whyallinone.md {Why Bundle Forum, Wiki, and other Web Software With Your DVCS?}
122  whyusefossil.wiki {Why You Should Use Fossil}
123  whyusefossil.wiki {Benefits Of Version Control}
124  wikitheory.wiki {Wiki In Fossil}
125  /wiki_rules {Wiki Formatting Rules}
126}
127
128set permindex {}
129set stopwords {
130   a about against and are as by for fossil from in of on or should the to use
131   used with
132}
133foreach {file title} $doclist {
134  set n [llength $title]
135  regsub -all {\s+} $title { } title
136  lappend permindex [list $title $file 1]
137
138# Disable the permutations.
139#  for {set i 0} {$i<$n-1} {incr i} {
140#    set prefix [lrange $title 0 $i]
141#    set suffix [lrange $title [expr {$i+1}] end]
142#    set firstword [string tolower [lindex $suffix 0]]
143#    if {[lsearch $stopwords $firstword]<0} {
144#      lappend permindex [list "$suffix &mdash; $prefix" $file 0]
145#    }
146#  }
147}
148set permindex [lsort -dict -index 0 $permindex]
149set out [open permutedindex.html w]
150fconfigure $out -encoding utf-8 -translation lf
151puts $out \
152"<div class='fossil-doc' data-title='Index Of Fossil Documentation'>"
153puts $out {
154<center>
155<form action='$ROOT/docsrch' method='GET'>
156<input type="text" name="s" size="40" autofocus>
157<input type="submit" value="Search Docs">
158</form>
159</center>
160<h2>Primary Documents:</h2>
161<ul>
162<li> <a href='quickstart.wiki'>Quick-start Guide</a>
163<li> <a href='$ROOT/help'>Built-in help for commands and webpages</a>
164<li> <a href='history.md'>Purpose and History of Fossil</a>
165<li> <a href='build.wiki'>Compiling and installing Fossil</a>
166<li> <a href='../COPYRIGHT-BSD2.txt'>License</a>
167<li> <a href='userlinks.wiki'>Miscellaneous Docs for Fossil Users</a>
168<li> <a href='hacker-howto.wiki'>Fossil Developer's Guide</a>
169<li> <a href='$ROOT/wiki?name=To+Do+List'>To Do List (Wiki)</a>
170<li> <a href='http://fossil-scm.org/fossil-book/home'>Fossil book</a>
171</ul>
172<h2 id="pindex">Other Documents:</h2>
173<ul>}
174foreach entry $permindex {
175  foreach {title file bold} $entry break
176#  if {$bold} {set title <b>$title</b>}
177  if {[string match /* $file]} {set file ../../..$file}
178  puts $out "<li><a href=\"$file\">$title</a></li>"
179}
180puts $out "</ul></div>"
181