Create a printable and portable Connections Product Documentation

· by Christoph Stoettner · Read in about 3 min · (605 words)

The IBM Connections Product Documentation is only available as a set of Wiki Documents and in a accessible version (5 single html documents).

I don’t like both versions. Searching is hard and printing only single documents (to paper or pdf) is a torture. The format is only for a complete display, no mobile version and using only half of a display do not wrap the text.

So i want to have a converted document which is searchable, has numbered headlines and can be converted to mobi or kindle format.

2013 07 15 21 36 58

You want this too? How?


I created a linux shell script which downloads the accessible version of the product documentation and removes / adds some lines. I added a alternative stylesheet (numbering headlines) and a javascript file (toc on top of the document). Copy both files to the directory of the html documentation.

Here the script and some explanations on it:

wget -mk
wget -mk
wget -mk
wget -mk
wget -mk

Download the html files inclusivly with images, scripts and stylesheets.

After downloading the files, change to the folder of acc_p1.html:

Run tidy on the html files to seperate the html tags and indent the code:

for i in $(seq 1 5); do
    tidy -wrap 0 -c -i acc_p${i}.html > acc_p${i}_a.html

No remove the html header and toc of the files:

# remove head and foot (incl toc)
for i in $(seq 1 5); do
   sed '1,/<div class="nested0" role="main"/d;/<\/body>/,$d' acc_p${i}_a.html > acc_p${i}_b.html

Create a file with header informations (title, stylesheets):

sed '/< \/head>/,$d' acc_p1.html > head.html
sed -i 's/<link rel="stylesheet"[^/>]*>//g' head.html
sed -i '/<title>/d' head.html
echo '<link rel="stylesheet" type="text/css" href="custom.css" />' >> head.html
echo '</title><title>IBM Connections 4.5 CR1</title>' >> head.html
echo '<script type="text/javascript" src="toc.js"></script>' >> head.html
echo '<body>' >> head.html

Create a file with footer informations:

sed '/< \/body>/,$d' acc_p1.html > foot.html

Create a singe html file of the Connections documentation and add head and foot:

cat head.html > cnx45documentation.html
for i in $(seq 1 5) ; do
    cat acc_p${i}_b.html >> cnx45documentation.html
cat foot.html >> cnx45documentation.html

Rewrite all links and anchors to the new filename:

sed -i -e 's/href="acc_p[1-5].html#/href="cnx45documentation.html#/g' cnx45documentation.html

So you’re nearly done! Copy the custom.css and toc.js in the directory and you can open the documentation. You can use half display, print to pdf, convert it to kindle (e.g. calibre) and other ebook formats.

The script does not delete temporary files. I copy only cnxdocumentation.html, toc.js and custom.css to a seperate folder and delete the downloaded files. If you want the images (there are only few), you need to copy these too.

Configuration of toc.js

Here is my setting i used for the toc.

container : "false",
headline : 1,
minNavPoints : 2,
insertAfter : "body",
headlineText : "Table of Contents",
listType : "OL",


h1{counter-reset: h2counter}
h2{counter-reset: h3counter}
h3{counter-reset: h4counter}
h4{counter-reset: h5counter}
h5{counter-reset: h6counter}

  counter-increment: h1counter;
  content: counter(h1counter) " ";
  counter-increment: h2counter;
  content: counter(h1counter) "." counter(h2counter) " ";
  counter-increment: h3counter;
  content: counter(h1counter) "." counter(h2counter) "." counter(h3counter) " ";
  counter-increment: h4counter;
  content: counter(h1counter) "." counter(h2counter) "." counter(h3counter) "." counter(h4counter) " ";
  counter-increment: h5counter;
  content: counter(h1counter) "." counter(h2counter) "." counter(h3counter) "." counter(h4counter) "." counter(h5counter) " ";

  counter-increment: h6counter;
  content: counter(h1counter) "." counter(h2counter) "." counter(h3counter) "." counter(h4counter) "." counter(h5counter) "." counter(h6counter) " ";
p {

code,kbd {

You can download the script and css file on github: