#!/usr/bin/perl
use strict;
use warnings;
BEGIN {our @usedModules; unshift @INC, sub {push @usedModules, [@_]; return undef;}}
our @usedModules;
use Tk;
#use Tk::TextUndo; #Removed due to bugs that are too much effort to work around ATM
use Tk::Balloon;
use Tk::Clipboard;
use Storable qw(dclone);
my $VERSION = '001.000203'; # 1.0 Beta 3
use constant DEBUG => 0;
use constant kParaSpace => 6;
=head1 NAME
PMEdit - A wysiwyg PerlMonks.org markup savy editor.
=head1 DESCRIPTION
This script is a PerlMonks.org markup savy editor. It may be useful for most
everything based web sites and can be adapted for use for light weight HTML
generation.
=head1 README
PerlMonks editor is designed to allow wysiwig editing of material to be
posted on everything based web sites such as PerlMonks. Initial versions are
intended to be used to prepare the material offline and then render to the
clipboard for pasting into a node's edit field. It is expected that later
versions will interact more directly with the web site to allow easier
updating of existing nodes and quoting material from nodes that are being
replied to.
The current version is considered to be a beta version. It does some cool
stuff and the main intial features are implemented with a good number of bugs
ironed out. There are still various editing foibles due to the way the Tk Text
widget behaves that may get resolved before the notional final version 1
release, but more likely won't.
The current version provides configuration information for associating
markup with display styles, menu entries, key assignements and (in the
future) toolbar entries. The configuration is included in the script in a
__DATA__ section.
There are two sectons in the configuration data seperated by a line starting
with "#key ". The first section contains information mapping tags to display
formatting and management and output rendering. The lines are of the form:
tag name,HTML tag, UI text, flags, modifiers as key value pairs
For example
code,c,Code block,BFXCU,-spacing1 => 0,-spacing3 => 0,-foreground => #e0e0ff,-font => [-family => courier, -weight => bold]
=over 8
code: the name used internally for tagging text
c: the HTML or link element tag text
Code block: String that may be used in the user interface
BFXCU: flags that control display, placement and rendering
...: display formatting. See the Tk::Text TAGS section
=back
The following flags may be used:
=over 8
B: Block level element (paragraph tag