stmcrblog.sh
author Oleksandr Gavenko <gavenkoa@gmail.com>
Sat, 12 Nov 2011 13:18:30 +0200
changeset 821 e385d1d48a8d
parent 817 a4cbbc50ee76
child 822 836107c5c06f
permissions -rwxr-xr-x
Increase the score for followups to a sent article.

#!/bin/bash

# Example of this script using:
#   (defun my-stmcrblog-after-add-entry-hook ()
#     (shell-command (concat "stmcrblog " stmcrblog-file " /srv/www/htdocs/jobdoneblog.html"))
#     )
#   (add-hook 'stmcrblog-after-add-entry-hook 'my-stmcrblog-after-add-entry-hook)
#   (global-set-key (kbd "C-c y") 'stmcrblog-post-current-line)

in=$1
out=$2

if [[ ! -f $in ]]; then
  echo Input file not found.
  exit 1
fi
if [[ -z $out ]]; then
  echo I don\'t know where is output file...
  exit 1
fi

{
  echo '<html>'
  echo '<head>'
  echo '  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">'
  echo '  <title>Job done blog.</title>'
  echo '</head>'
  echo '<body>'
  echo '<h1>Job done blog.</h1>'

  echo '<ul>'

  sed -e 's|^\([[:digit:]-]\+\) \([[:digit:]:]\+\) \(.*\)|  <li><span style="color: green;">\1 \2</span> \3</li>|'

  echo '</ul>'

  echo '<address>'
  echo '  <a href="mailto:gavenko@bifit.com.ua">Oleksandr Gavenko</a>'
  echo '  </address>'
  echo '</body>'
  echo '</html>'

} <$in >$out