| 1 | #!/bin/sh
|
|---|
| 2 |
|
|---|
| 3 | # Document and document path variables
|
|---|
| 4 | DIR=$(pwd)
|
|---|
| 5 | DOC=$DIR/$1
|
|---|
| 6 |
|
|---|
| 7 | # Quietly kill any copies of soffice still hanging around
|
|---|
| 8 | killall -q soffice.bin
|
|---|
| 9 |
|
|---|
| 10 | # Run macro
|
|---|
| 11 | soffice -invisible -norecover -headless "macro:///Standard.Module1.SaveAsHTML($DOC)"
|
|---|
| 12 |
|
|---|
| 13 | # Construct name variable matching newly created file
|
|---|
| 14 | TEMPFILE=`echo $DOC | cut -d'.' -f1`.html
|
|---|
| 15 |
|
|---|
| 16 | # Since soffice sometimes exits early, sleep until temp HTML file is created
|
|---|
| 17 | while [ ! -e $TEMPFILE ]; do
|
|---|
| 18 | sleep 1
|
|---|
| 19 | done
|
|---|
| 20 |
|
|---|
| 21 | # Output HTML
|
|---|
| 22 | cat *.html
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|