Add pptx2md converter. - 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
       ---
 (DIR) commit e0d87452da86dd8a57838bcaa8b8c817def194b0
 (DIR) parent ad95b9aa5689e07c7febceddbc9db5e8574f2699
 (HTM) Author: Christoph Lohmann <20h@r-36.net>
       Date:   Sun, 13 Jun 2021 14:41:14 +0200
       
       Add pptx2md converter.
       
       Diffstat:
         M Makefile                            |       1 +
         A bin/pptx2md                         |      55 +++++++++++++++++++++++++++++++
         A examples/pptx/example.pptx          |       0 
       
       3 files changed, 56 insertions(+), 0 deletions(-)
       ---
 (DIR) diff --git a/Makefile b/Makefile
       @@ -21,6 +21,7 @@ install:
                install -m 755 bin/dir2point $(DESTDIR)$(PREFIX)/bin/dir2point
                install -m 755 bin/md2point  $(DESTDIR)$(PREFIX)/bin/md2point
                install -m 755 bin/point2pdf $(DESTDIR)$(PREFIX)/bin/point2pdf
       +        install -m 755 bin/pptx2md $(DESTDIR)$(PREFIX)/bin/pptx2md
                mkdir -p $(DESTDIR)$(MANPREFIX)/man1
                install -m 644 md2point.1    $(DESTDIR)$(MANPREFIX)/man1/md2point.1
        
 (DIR) diff --git a/bin/pptx2md b/bin/pptx2md
       @@ -0,0 +1,55 @@
       +#!/bin/sh
       +#
       +# See LICENSE for license details.
       +#
       +# This is based on:
       +#     https://github.com/revan/pptx2md
       +#
       +# The algorithm was simplified to the essence of what the ugly
       +# pptx format is capable of. Microsoft amateurs are unable to use
       +# XML properly.
       +#
       +# Requires: xml2tsv (git://bitreich.org/xml2tsv)
       +#
       +
       +if [ $# -lt 1 ];
       +then
       +        printf "usage: %s file.pptx\n" "$(basename "$0")" >&2
       +        exit 1
       +fi
       +
       +pptxfile="$1"
       +mdfile="$1.md"
       +tmpdir="$(mktemp -u)"
       +
       +unzip -oq -d "${tmpdir}" "${pptxfile}"
       +if [ $? -ne 0 ];
       +then
       +        printf "Failed to extract %s.\n" "${pptxfile}"
       +        exit 1
       +fi
       +
       +for slidefile in ${tmpdir}/ppt/slides/*.xml;
       +do
       +        linenum=0
       +        cat "${slidefile}" \
       +        | xml2tsv 2>/dev/null \
       +        | grep a:r/a:t \
       +        | cut -s -f 2 \
       +        | while read -r line;
       +        do
       +                if [ $linenum -eq 0 ];
       +                then
       +                        printf "## %s\n" "${line}" >> "${mdfile}"
       +                else
       +                        printf "%s\n" "${line}" >> "${mdfile}"
       +                fi
       +                linenum=1
       +        done
       +        printf "\n" >> "${mdfile}"
       +done
       +
       +
       +rm -r "$tmpdir"
       +exit 0
       +
 (DIR) diff --git a/examples/pptx/example.pptx b/examples/pptx/example.pptx
       Binary files differ.