Artifact Content

Artifact 675d640d6256ade2b008e1ce8cc146b7ba68d05823b271b2632397a015e37d4d:

#!/usr/bin/env tclsh
# Run this TCL script to generate a WIKI page that contains a
# permuted index of the various documentation files.
#    tclsh mkindex.tcl

set doclist { {How CGI Works In Fossil} {How The Download Page Works} {Adding New Features To Fossil} {Hacking Fossil} {Defense against Spiders and Bots} {The Annotate/Blame Algorithm Of Fossil} {Branching, Forking, Merging, and Tagging} {Bug Tracking In Fossil} {Compiling and Installing Fossil} {Fossil Changelog} {Check-in And Version Names} {Check-in Checklist} {Child Projects}
  copyright-release.html {Contributor License Agreement} {Fossil Core Concepts} {Contributing Code or Documentation To The Fossil Project} {Theming: Customizing the Timeline Graph} {Theming: Customizing The Appearance of Web Pages} {Customizing The Ticket System} {Fossil Delta Encoding Algorithm} {Fossil Delta Format} {Embedded Project Documentation} {How To Use Encrypted Repositories} {Environment Variables and Global Options} {Events} {Frequently Asked Questions} {Fossil File Format} {Up and Running in 5 Minutes as a Single User} {Checklist For Successful Open-Source Projects} {Integrating Fossil in the Microsoft Express 2010 IDE} {Fossil Versus Git} {File Name Glob Patterns} {Hacker How-To} {Hash Policy: Choosing Between SHA1 and SHA3-256}
  /help {Lists of Commands and Webpages} {Fossil Tips And Usage Hints} {Home Page} {Import And Export To And From Git} {The Fossil Build Process}
  /md_rules {Markdown Formatting Rules} {How To Create A New Fossil Repository} {Password Management And Authentication} {Principles Of Operation} {Creating, Syncing, and Deleting Private Branches} {Questions And Criticisms} {Fossil Quick Start Guide}
      {Quotes: What People Are Saying About Fossil, Git, and DVCSes in General}
  ../test/ {Pre-Release Testing Checklist} {Reviews} {Fossil Repository Integrity Self Checks} {Fossil Self Hosting Repositories} {How To Configure A Fossil Server} {Fossil Settings}
  /sitemap {Site Map} {Shunning: Deleting Content From Fossil} {Performance Statistics} {Source Code Style Guidelines} {Using SSL with Fossil} {The Fossil Sync Protocol} {A Technical Overview Of The Design And Implementation
                      Of Fossil} {SQLite Databases Used By Fossil} {The TH1 Scripting Language} {The Fossil Ticket System} {Thoughts On The Design Of The Fossil DVCS} {Unversioned Files} {Webpage Examples} {The Fossil Web Interface} {Why You Should Use Fossil} {Benefits Of Version Control} {Wiki In Fossil}
  /wiki_rules {Wiki Formatting Rules}

set permindex {}
set stopwords {
   a about against and are as by for fossil from in of on or should the to use
   used with
foreach {file title} $doclist {
  set n [llength $title]
  regsub -all {\s+} $title { } title
  lappend permindex [list $title $file 1]
  for {set i 0} {$i<$n-1} {incr i} {
    set prefix [lrange $title 0 $i]
    set suffix [lrange $title [expr {$i+1}] end]
    set firstword [string tolower [lindex $suffix 0]]
    if {[lsearch $stopwords $firstword]<0} {
      lappend permindex [list "$suffix &mdash; $prefix" $file 0]
set permindex [lsort -dict -index 0 $permindex]
set out [open permutedindex.html w]
fconfigure $out -encoding utf-8 -translation lf
puts $out \
"<div class='fossil-doc' data-title='Index Of Fossil Documentation'>"
puts $out {
<form action='$ROOT/docsrch' method='GET'>
<input type="text" name="s" size="40" autofocus>
<input type="submit" value="Search Docs">
<h2>Primary Documents:</h2>
<li> <a href=''>Quick-start Guide</a>
<li> <a href=''>FAQ</a>
<li> <a href=''>Compiling and installing Fossil</a>
<li> <a href='../COPYRIGHT-BSD2.txt'>License</a>
<li> <a href=''>Jim Schimpf's
<li> <a href='$ROOT/help'>List of commands, web-pages, and settings</a>
<a name="pindex"></a>
<h2>Permuted Index:</h2>
foreach entry $permindex {
  foreach {title file bold} $entry break
  if {$bold} {set title <b>$title</b>}
  if {[string match /* $file]} {set file ../../..$file}
  puts $out "<li><a href=\"$file\">$title</a></li>"
puts $out "</ul></div>"