summaryrefslogtreecommitdiff
path: root/html2markdown
diff options
context:
space:
mode:
authorroktas <roktas@788f1e2b-df1e-0410-8736-df70ead52e1b>2006-12-12 07:04:09 +0000
committerroktas <roktas@788f1e2b-df1e-0410-8736-df70ead52e1b>2006-12-12 07:04:09 +0000
commit426cbadfef6c26323faedcab2cd5ea7efa64d1bb (patch)
treee16afb28eec790226a7b0524b8fb325594232e5c /html2markdown
parent6411ea7466f67f94816c541a22abb7249d36c377 (diff)
Merge changes in branches/wrappers into trunk.
[in trunk] svn merge -r105:HEAD \ https://pandoc.googlecode.com/svn/branches/wrappers git-svn-id: https://pandoc.googlecode.com/svn/trunk@177 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'html2markdown')
-rw-r--r--html2markdown69
1 files changed, 0 insertions, 69 deletions
diff --git a/html2markdown b/html2markdown
deleted file mode 100644
index 53ea05c08..000000000
--- a/html2markdown
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/bin/sh -e
-# converts html to markdown
-# uses an available program to fetch URL and tidy to normalize it first
-
-pathfind () { # portable which(1), code taken from Debian Developer's Reference
- OLDIFS="$IFS"
- IFS=:
- for _p in $PATH; do
- if [ -x "$_p/$*" ]; then
- IFS="$OLDIFS"
- return 0
- fi
- done
- IFS="$OLDIFS"
- return 1
-}
-
-for p in pandoc tidy; do
- pathfind $p || {
- echo >&2 "You need '$p' to use this program!"
- exit 1
- }
-done
-
-ALL="$*"
-ARGS=${ALL%% -- *} # only the part before ' -- ' delimiters is relevant
-set -- $ARGS
-
-REST=${ALL#$ARGS}; REST=${REST# -- }
-PANDOC_OPTS=${REST:-$PANDOC_OPTS}
-
-infile=$1
-
-if [ $# -gt 1 ]; then
- shift
- echo >&2 "Warning: extra arguments '$@' will be ignored!"
-fi
-
-if [ -z "$infile" ] || [ -f $infile ]; then
- tidy -utf8 $infile 2>/dev/null | \
- pandoc $PANDOC_OPTS -r html -w markdown -s | \
- iconv -f utf-8
-else
- # Treat given argument as an URL. Locate a
- # sensible text based browser (note the order).
- for p in wget lynx w3m curl links w3c; do
- if pathfind $p; then
- DUMPER=$p
- break
- fi
- done
- # Setup proper options.
- case "$DUMPER" in
- wget) OPT="-O-" ;;
- lynx) OPT="-source" ;;
- w3m) OPT="-dump_source" ;;
- curl) OPT="" ;;
- links) OPT="-source" ;;
- w3c) OPT="-n -get" ;;
- "") printf "Needs a program to fetch the URL " >&2
- printf "(e.g. wget, w3m, lynx, w3c, or curl)." >&2
- exit 1 ;;
- esac
- # Fetch and feed to pandoc.
- $DUMPER $OPT $infile 2>/dev/null | \
- tidy -utf8 2>/dev/null | \
- pandoc $PANDOC_OPTS -r html -w markdown -s | \
- iconv -f utf-8
-fi