git.iko.soy/typeable/pandoc
on master help sign in
Removed html2x.pl -- it belongs in its own repository.

git-svn-id: https://pandoc.googlecode.com/svn/trunk@1030 788f1e2b-df1e-0410-8736-df70ead52e1b

commit47f847e71f6c025c918843a3d1355f0f6ea6dc4c authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> dateWed 19 Sep 2007, 03:11 (19 years ago) parentd9dedf0
1 file changed−40
web/html2x.pl−40
web/html2x.pldeleted−40
@@ -1,40 +0,0 @@
1−#!/usr/bin/env perl
2−use strict;
3−use CGI qw/:standard/;
4−use CGI::Carp 'fatalsToBrowser';
5−
6−$CGI::POST_MAX=1024 * 100; # max 100K posts
7−$CGI::DISABLE_UPLOADS = 1; # no uploads
8−
9−param('url') && param('format') or die "Missing url and/or format parameters.\n";
10−
11−my $options = '-r html --standalone --reference-links';
12−my $url = param('url');
13−my $format = param('format') || 'markdown';
14−if ($format =~ /^markdown$/) {
15− $options .= ' --strict';
16−}
17−if ($format =~ /^markdown\+$/) {
18− $format = 'markdown';
19−}
20−
21−# Validate URL and format
22−unless ($url =~ /^(https?:\/\/)?[\w#_-]+(\.[\w#_-]+)+(:\d+)?[\w\/#=:?_.-]*$/) {
23− die "Illegal URL: $url\n" ;
24−}
25−unless ($format =~ /^markdown\+?|rst|latex|context|rtf|man|docbook$/) {
26− die "Illegal format: $format\n";
27−}
28−
29−# Note - pass through head to truncate file to 100K if greater.
30−# This should prevent certain kinds of DoS attacks.
31−my $output = `wget -O- $url | head -c100000 | tidy -asxhtml -utf8 | pandoc -w $format $options`;
32−if ($output =~ /^\s*$/) {
33− print start_html,
34− h1("No output"),
35− p("Either $url could not be retrieved, or its HTML was too malformed to parse."),
36− end_html;
37− exit 0;
38−}
39−print header(-charset=>"utf8",-type=>"text/plain"),
40− $output;