Skip to content

Word to ASCIIDoc converter #57

Word to ASCIIDoc converter

Word to ASCIIDoc converter #57

Workflow file for this run

name: Word to ASCIIDoc converter
on: workflow_dispatch
# manual triggering only
jobs:
convert_via_pandoc:
runs-on: ubuntu-22.04
steps:
- uses: actions/[email protected]
with:
ref: pandoc
# use pandoc branch for storing the input Word file and to collect all output files
- name: List ESPD Word files to convert
id: files_list
run: |
mkdir output # create output dir
# get the latest ESPD*.docx file as input argumet for conversion
ls -l ESPD*.docx
last_file=$(printf '%s' ESPD*.docx)
echo "files=$last_file" >> $GITHUB_OUTPUT
echo "fn=${last_file%%.*}" >> $GITHUB_OUTPUT
- uses: docker://pandoc/latex:latest
with:
args: --standalone --wrap=none --markdown-headings=atx --extract-media=output/extracted-media --from=docx --to=asciidoc --output=output/${{steps.files_list.outputs.fn}}.adoc ${{ steps.files_list.outputs.files }}
- name: fix format
id: sed_script
run: |
sed -i '0,/\[width/s/^\[width.*\]$/[cols=","]/' output/${{steps.files_list.outputs.fn}}.adoc
# fix first table
sed -i '0,/\[width/s/^\[width.*\]$/[cols=",",options="header"]/' output/${{steps.files_list.outputs.fn}}.adoc
# fix second table
sed -i 's/== Summary/:sectnums:\n:sectnumlevels: 4\n\n== Summary/' output/${{steps.files_list.outputs.fn}}.adoc
# add numbering before == Summary ... section
#- uses: docker://pandoc/latex:latest
# with:
# args: --standalone --from=docx --variable=papersize:a4 --to=pdf --output=output/${{steps.files_list.outputs.fn}}.pdf ${{ steps.files_list.outputs.files }}
- uses: docker://asciidoctor/docker-asciidoctor:latest
with:
args: asciidoctor-pdf output/${{steps.files_list.outputs.fn}}.adoc
- uses: actions/[email protected]
with:
name: asciidoc
path: output