pptx2md - pointtools - Simple point utilities to hold text presentations.
 (HTM) git clone git://bitreich.org/pointtools/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/pointtools/
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) Tags
 (DIR) README
 (DIR) LICENSE
       ---
       pptx2md (947B)
       ---
            1 #!/bin/sh
            2 #
            3 # See LICENSE for license details.
            4 #
            5 # This is based on:
            6 #     https://github.com/revan/pptx2md
            7 #
            8 # The algorithm was simplified to the essence of what the ugly
            9 # pptx format is capable of. Microsoft amateurs are unable to use
           10 # XML properly.
           11 #
           12 # Requires: xml2tsv (git://bitreich.org/xml2tsv)
           13 #
           14 
           15 if [ $# -lt 1 ];
           16 then
           17         printf "usage: %s file.pptx\n" "$(basename "$0")" >&2
           18         exit 1
           19 fi
           20 
           21 pptxfile="$1"
           22 mdfile="$1.md"
           23 tmpdir="$(mktemp -u)"
           24 
           25 unzip -oq -d "${tmpdir}" "${pptxfile}"
           26 if [ $? -ne 0 ];
           27 then
           28         printf "Failed to extract %s.\n" "${pptxfile}"
           29         exit 1
           30 fi
           31 
           32 for slidefile in ${tmpdir}/ppt/slides/*.xml;
           33 do
           34         linenum=0
           35         cat "${slidefile}" \
           36         | xml2tsv 2>/dev/null \
           37         | grep a:r/a:t \
           38         | cut -s -f 2 \
           39         | while read -r line;
           40         do
           41                 if [ $linenum -eq 0 ];
           42                 then
           43                         printf "## %s\n" "${line}" >> "${mdfile}"
           44                 else
           45                         printf "%s\n" "${line}" >> "${mdfile}"
           46                 fi
           47                 linenum=1
           48         done
           49         printf "\n" >> "${mdfile}"
           50 done
           51 
           52 
           53 rm -r "$tmpdir"
           54 exit 0
           55