disabled
  7   ˆl–ßi~”Ji?u8 ™¸!\hJbÑ¿‘äÇò 8àA$¤�â6?ŸÂƒh¹ÁÀ¿      disabled
     ˆÃ�þB g ßnI\€ÏóÂƒh¹ÁÀ¿      disabled
  /   ˆ{‹„„-i[D<†ªoZƒ›Ù«Ã504_‘I|¥‰ÓMdœv ©ƒ†ü+=ÃÂ ø    ‹      ½”ooÚ0Æß÷Sx~±wÉ¡�Ú:Ù:‚44
ˆfÚ¦išœØ«!Žìc´ûôs¨¬…ýÑP_Å9?¾ç~çäØ‹xÜK>Oúä]r=$“o‡ƒ¡ÀÇ 'q³Ñõ[m€þˆš#V «ÕÊ_¾6sH¦�ã¢è‚E£2ô
�°:�–K.Ü“0TXÈhP
yGôŒ€^¢UBºÌ¥òÛB‹e!-¼AU!¯@Þ¡,­Ò¥—¹m/-tvëzU¨yŽ`MÆ Éè<`cÂR-îkïöQ}\º5 O×võÒDsò�;URÔ�˜ZÌ‰Ó‡T¦KiÁË[®f”ðCúeÐu:À¼>1Nr#g!}ÝG—ãðŠF#¾�ø~Íu£r‹ÄQ¨™’â ø¦ß¨‡Æ�&–63®®Rpˆ»¨™.lÅë©#ÈÍ®ª‘ˆ?uƒg¿4cr5í�’x0mZ"êÕýß­ÑhÂ�,‘ÄÊÈµ¹ß€5./ËÔV—ÛW²)ÛÔGiDˆGö*ÿ�]y»¬É§d/å¶`¯*–sUúhiô4¶[û£b;­Î™×:÷:g¤u~„výÓ÷ÏEµçFÖdûãÇ kûíg£Sõ`YólWG!^ýæ«ûËÿ6ŠÁz2hfðOH÷Íæ       	ˆÆ�þB g ßnI\€ÏóÅƒh¹ÄÃÂ      	disabled
     ˆÆ�þB g ßnI\ ˆÏóÅƒh¹ÄÃÂ      disabled
  L   ˆl–ßi~”Ji?u8 ™¸®4Ú˜´o�þB g$ ä­¿ÏÆƒh¹Åa–ßi~”Ji?u8 ™¸!\i•1hßÄ      disabled
  5   ˆl–ßi~”Je¶¥	AãoÜ*bÑ¿�þD4³e’¼Ì��­ùÈƒy—žÇ¿Å  Ä    #!/usr/bin/perl

package main;
use warnings;
use strict;

use HTML::WikiConverter;

my %o = H::WC::GetOpts->get_opts();
my $wc = new HTML::WikiConverter( %o );

my $html = do { local $/; <> };
print $wc->html2wiki($html), "\n";

#
# Attribute/option handling
#

package H::WC::GetOpts;

use Params::Validate ':types';
use Getopt::Long;
use Pod::Usage;

sub get_opts {
  my %attrs = known_attributes();
  my %o = map { $_ => undef } keys %attrs;

  my @optspec = (
    \%o,
    'list' => sub { warn "Installed dialects:\n"; print map "$_\n", HTML::WikiConverter->available_dialects; exit(1); },
    'help' => sub { pod2usage( -exit => 1, -verbose => 0 ) },
    'options' => sub { warn "Accepted options:\n"; print map "--$_\n", sort keys %attrs; exit(1); },
    attrs2optspecs(\%attrs)
  );

  eval { GetOptions( @optspec ) or pod2usage(2) };
  die "problem parsing command-line options: $@" if $@;

  $o{dialect} ||= $ENV{WCDIALECT};
  pod2usage(2) unless $o{dialect};

  remove_ignored_opts(\%o);
  return %o;
}

sub known_attributes {
  my %attributes = (
    %{ HTML::WikiConverter->__default_attribute_specs },
  );

  my @modules = map { "HTML::WikiConverter::$_" } HTML::WikiConverter->available_dialects;
  foreach my $module ( @modules ) {
    next unless eval "use $module; 1";
    my %attrs = %{ $module->attributes };
    foreach my $attr ( keys %attrs ) {
      $attributes{$attr} = $attrs{$attr};
    }
  }

  delete $attributes{$_} for IGNORED_ATTRS();

  # Normalize attr name with dashes
  foreach my $attr ( keys %attributes ) {
    my $new_attr = $attr;
    if( $new_attr =~ s/_/-/g ) {
      $attributes{$new_attr} = $attributes{$attr};
      delete $attributes{$attr};
    }
  }

  return %attributes;
}

sub attrs2optspecs {
  my $attrs = shift;
  my @specs = ( );

  my %forced_optspecs = FORCED_OPTSPECS();

  while( my( $attr, $spec ) = each %$attrs ) {
    my $type = $spec->{type} ? $spec->{type} : BOOLEAN;
    next if $type == CODEREF;
    next unless $attr;

    if( my $fspec = $forced_optspecs{$attr} ) {
      push @specs, $fspec;
    } else {
      my $reqopt_sym = '';
      my $type_sym = '';
      my $neg_sym = '';

      $reqopt_sym = exists $spec->{optional} && !$spec->{optional} ? '=' : ':';
      $type_sym = 's'  if $type == SCALAR;
      $type_sym = 's@' if $type == ARRAYREF or $type == ( SCALAR | ARRAYREF );
      $neg_sym  = '!'  if $type == BOOLEAN and $spec->{default} and $spec->{default} eq '1';

      # No required/optional symbol without a type to follow it
      $reqopt_sym = '' unless $type_sym;
  
      my $spec = join '', $attr, $reqopt_sym, $type_sym, $neg_sym;
      push @specs, $spec;
    }
  }

  return sort @specs;
}

sub remove_ignored_opts {
  my $o = shift;
  my %ignored_attrs = map { $_ => 1 } IGNORED_ATTRS();
  foreach my $key ( keys %$o ) {
    delete $o->{$key}, next if $ignored_attrs{$key};
    delete $o->{$key}, next if !defined $o->{$key};
    my $new_key = $key;
    if( $new_key =~ s/-/_/g ) {
      $o->{$new_key} = $o->{$key};
      delete $o->{$key};
    }
  }
}

sub IGNORED_ATTRS { qw/ list help option