index.sh
author Oleksandr Gavenko <gavenkoa@gmail.com>
Wed, 05 Aug 2015 23:55:34 +0300
changeset 1729 22ffd80639c0
parent 1336 80c5eff010a1
child 1784 a9e8554a24d3
permissions -rwxr-xr-x
Make centered content design with adoption for mobile devices. Highlight TOC.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
902
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     1
#!/bin/sh
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     2
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     3
echo '<html>'
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     4
echo '<head>'
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     5
echo '  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">'
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     6
echo '  <title>Tips</title>'
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     7
echo '  <style type="text/css">'
1031
1febb0de8647 Fix colors. Add border.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 933
diff changeset
     8
echo '    body { background-color: LightYellow; }'
902
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     9
echo '    a { text-decoration:none; }'
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    10
echo '    a:link { color: brown; }'
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    11
echo '    a:visited { color: IndianRed; }'
1031
1febb0de8647 Fix colors. Add border.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 933
diff changeset
    12
echo '    a:hover { background: bisque; border-radius: 10px; padding: 1px; }'
902
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    13
echo '  </style>'
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    14
echo '</head>'
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    15
echo '<body>'
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    16
echo '<h1>Tips</h1>'
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    17
echo '<ul>'
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    18
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    19
for file in *.rst *.txt; do
1336
80c5eff010a1 Ignore HEADER.rst
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1079
diff changeset
    20
  case $file in
80c5eff010a1 Ignore HEADER.rst
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1079
diff changeset
    21
    HEADER.rst) continue;
80c5eff010a1 Ignore HEADER.rst
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1079
diff changeset
    22
  esac
902
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    23
  ext=${file##*.}
1078
bd64c9d8d019 Simplify code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1031
diff changeset
    24
  [ "$ext" = "rst" ] && ext=html
bd64c9d8d019 Simplify code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1031
diff changeset
    25
  name=${file%.*}
bd64c9d8d019 Simplify code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1031
diff changeset
    26
  case "$1" in
1079
ef0805397b5b Generate index.html without "target=article" so links open in current browser tab.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1078
diff changeset
    27
    html) echo "  <li><a href=\"$name.$ext\">$name</a>" ;;
1078
bd64c9d8d019 Simplify code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1031
diff changeset
    28
    frame) echo "  <li><a href=\"$name.$ext\" target=\"article\">$name</a>" ;;
bd64c9d8d019 Simplify code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1031
diff changeset
    29
    *) exit 1 ;;
902
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    30
  esac
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    31
done
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    32
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    33
echo '<p>'
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    34
echo '<address>'
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    35
echo '    <a href="mailto:gavenkoa@gmail.com">Oleksandr Gavenko</a>'
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    36
echo '</address>'
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    37
echo '</body>'
034aeeb2a16d Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    38
echo '</html>'