author | Oleksandr Gavenko <gavenkoa@gmail.com> |
Wed, 16 Nov 2011 17:08:05 +0200 | |
changeset 829 | 093b6699e903 |
parent 822 | 836107c5c06f |
permissions | -rwxr-xr-x |
816
ad19fb10943e
Add example of 'stmcrblog-file' processing.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
1 |
#!/bin/bash |
ad19fb10943e
Add example of 'stmcrblog-file' processing.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
2 |
|
817
a4cbbc50ee76
Add example of stmcrblog.sh script using.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
816
diff
changeset
|
3 |
# Example of this script using: |
a4cbbc50ee76
Add example of stmcrblog.sh script using.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
816
diff
changeset
|
4 |
# (defun my-stmcrblog-after-add-entry-hook () |
a4cbbc50ee76
Add example of stmcrblog.sh script using.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
816
diff
changeset
|
5 |
# (shell-command (concat "stmcrblog " stmcrblog-file " /srv/www/htdocs/jobdoneblog.html")) |
a4cbbc50ee76
Add example of stmcrblog.sh script using.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
816
diff
changeset
|
6 |
# ) |
a4cbbc50ee76
Add example of stmcrblog.sh script using.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
816
diff
changeset
|
7 |
# (add-hook 'stmcrblog-after-add-entry-hook 'my-stmcrblog-after-add-entry-hook) |
a4cbbc50ee76
Add example of stmcrblog.sh script using.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
816
diff
changeset
|
8 |
# (global-set-key (kbd "C-c y") 'stmcrblog-post-current-line) |
a4cbbc50ee76
Add example of stmcrblog.sh script using.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
816
diff
changeset
|
9 |
|
816
ad19fb10943e
Add example of 'stmcrblog-file' processing.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
10 |
in=$1 |
ad19fb10943e
Add example of 'stmcrblog-file' processing.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
11 |
out=$2 |
ad19fb10943e
Add example of 'stmcrblog-file' processing.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
12 |
|
ad19fb10943e
Add example of 'stmcrblog-file' processing.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
13 |
if [[ ! -f $in ]]; then |
ad19fb10943e
Add example of 'stmcrblog-file' processing.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
14 |
echo Input file not found. |
ad19fb10943e
Add example of 'stmcrblog-file' processing.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
15 |
exit 1 |
ad19fb10943e
Add example of 'stmcrblog-file' processing.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
16 |
fi |
ad19fb10943e
Add example of 'stmcrblog-file' processing.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
17 |
if [[ -z $out ]]; then |
ad19fb10943e
Add example of 'stmcrblog-file' processing.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
18 |
echo I don\'t know where is output file... |
ad19fb10943e
Add example of 'stmcrblog-file' processing.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
19 |
exit 1 |
ad19fb10943e
Add example of 'stmcrblog-file' processing.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
20 |
fi |
ad19fb10943e
Add example of 'stmcrblog-file' processing.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
21 |
|
ad19fb10943e
Add example of 'stmcrblog-file' processing.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
22 |
{ |
ad19fb10943e
Add example of 'stmcrblog-file' processing.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
23 |
echo '<html>' |
ad19fb10943e
Add example of 'stmcrblog-file' processing.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
24 |
echo '<head>' |
ad19fb10943e
Add example of 'stmcrblog-file' processing.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
25 |
echo ' <meta http-equiv="Content-Type" content="text/html; charset=utf-8">' |
ad19fb10943e
Add example of 'stmcrblog-file' processing.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
26 |
echo ' <title>Job done blog.</title>' |
ad19fb10943e
Add example of 'stmcrblog-file' processing.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
27 |
echo '</head>' |
ad19fb10943e
Add example of 'stmcrblog-file' processing.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
28 |
echo '<body>' |
ad19fb10943e
Add example of 'stmcrblog-file' processing.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
29 |
echo '<h1>Job done blog.</h1>' |
ad19fb10943e
Add example of 'stmcrblog-file' processing.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
30 |
|
ad19fb10943e
Add example of 'stmcrblog-file' processing.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
31 |
echo '<ul>' |
ad19fb10943e
Add example of 'stmcrblog-file' processing.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
32 |
|
822
836107c5c06f
Add coloring by day by 'sed'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
817
diff
changeset
|
33 |
sed \ |
836107c5c06f
Add coloring by day by 'sed'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
817
diff
changeset
|
34 |
-e 's|^\([[:digit:]-]\+[02468]\) \([[:digit:]:]\+\) \(.*\)| <li><span style="color: green;">\1 \2</span> \3</li>|' \ |
836107c5c06f
Add coloring by day by 'sed'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
817
diff
changeset
|
35 |
-e 's|^\([[:digit:]-]\+[13579]\) \([[:digit:]:]\+\) \(.*\)| <li><span style="color: blue;">\1 \2</span> \3</li>|' |
816
ad19fb10943e
Add example of 'stmcrblog-file' processing.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
36 |
|
ad19fb10943e
Add example of 'stmcrblog-file' processing.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
37 |
echo '</ul>' |
ad19fb10943e
Add example of 'stmcrblog-file' processing.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
38 |
|
ad19fb10943e
Add example of 'stmcrblog-file' processing.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
39 |
echo '<address>' |
ad19fb10943e
Add example of 'stmcrblog-file' processing.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
40 |
echo ' <a href="mailto:gavenko@bifit.com.ua">Oleksandr Gavenko</a>' |
ad19fb10943e
Add example of 'stmcrblog-file' processing.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
41 |
echo ' </address>' |
ad19fb10943e
Add example of 'stmcrblog-file' processing.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
42 |
echo '</body>' |
ad19fb10943e
Add example of 'stmcrblog-file' processing.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
43 |
echo '</html>' |
ad19fb10943e
Add example of 'stmcrblog-file' processing.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
44 |
|
ad19fb10943e
Add example of 'stmcrblog-file' processing.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
45 |
} <$in >$out |
ad19fb10943e
Add example of 'stmcrblog-file' processing.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
46 |