Skip to content

Commit

Permalink
Item11378: add fallback mechanism for using plugins with FW that don'…
Browse files Browse the repository at this point in the history
…t support : indent

git-svn-id: http://svn.foswiki.org/trunk@14256 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
CrawfordCurrie authored and CrawfordCurrie committed Mar 8, 2012
1 parent 086f2fc commit 1b4c4a9
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion TinyMCEPlugin/data/System/TinyMCEPlugin.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ Below is the default configuration. If it is to be modified, it should be copied
"theme_advanced_buttons1" : "%IF{
"defined 'TINYMCEPLUGIN_BUTTONS1'"
then="%TINYMCEPLUGIN_BUTTONS1%"
else="%STARTSECTION{"BUTTONS1"}%foswikiformat, separator, bold, italic, tt, colour, removeformat, separator, bullist, numlist, fwexdent, fwindent, blockquote, separator, link, unlink, anchor, separator, undo, redo, separator, search, replace%ENDSECTION{"BUTTONS1"}%"
else="%STARTSECTION{"BUTTONS1"}%foswikiformat, separator, bold, italic, tt, colour, removeformat, separator, bullist, numlist, %IF{"context SUPPORTS_PARA_INDENT" then="fwexdent, fwindent" else="outdent, indent"}%, blockquote, separator, link, unlink, anchor, separator, undo, redo, separator, search, replace%ENDSECTION{"BUTTONS1"}%"
}%%IF{
"defined 'TINYMCEPLUGIN_ADDITIONAL_BUTTONS1'"
then=", %TINYMCEPLUGIN_ADDITIONAL_BUTTONS1%"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,8 @@ sub _convertIndent {
my $indent = $WC::TAB;

my ( $f, $t ) = $this->_handleP($options);
return $t unless Foswiki::Func::getContext->{SUPPORTS_PARA_INDENT};

if ( $t =~ /^$WC::WS_NOTAB*($WC::TAB+):(.*)$/ ) {
return "$WC::CHECKn$1:$2";
}
Expand Down Expand Up @@ -810,6 +812,8 @@ sub _convertList {
sub _isConvertableIndent {
my ( $this, $options ) = @_;

return 0 unless Foswiki::Func::getContext->{SUPPORTS_PARA_INDENT};

return 0 if ( $this->_isProtectedByAttrs() );

return $this->{tag} eq 'div' && $this->hasClass('foswikiIndent');
Expand Down
4 changes: 3 additions & 1 deletion WysiwygPlugin/lib/Foswiki/Plugins/WysiwygPlugin/TML2HTML.pm
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,7 @@ s/((^|(?<=[-*\s(]))$Foswiki::regex{linkProtocolPattern}:[^\s<>"]+[^\s*.,!?;:)<])
my $inParagraph = 0; # True when within a P
my $inDiv = 0; # True when within a foswikiTableAndMacros div
my @result = ();
my $spi = Foswiki::Func::getContext->{SUPPORTS_PARA_INDENT};

foreach my $line ( split( /\n/, $text ) ) {
my $tableEnded = 0;
Expand Down Expand Up @@ -613,7 +614,8 @@ s/((^|(?<=[-*\s(]))$Foswiki::regex{linkProtocolPattern}:[^\s<>"]+[^\s*.,!?;:)<])
$line =~ s/^(<li>)\s*$/$1&nbsp;/;

}
elsif ( $line =~ s/^((\t| )+): /<div class='foswikiIndent'> /o ) {
elsif ( $spi &&
$line =~ s/^((\t| )+): /<div class='foswikiIndent'> /o ) {

# Indent pseudo-list
$this->_addListItem( \@result, '', 'div', 'class="foswikiIndent"',
Expand Down
4 changes: 3 additions & 1 deletion core/lib/Assert.pm
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ sub import {
$soft = 1 if $ENV{FOSWIKI_ASSERTS} and $ENV{FOSWIKI_ASSERTS} eq 'soft';
*DEBUG = *ASSERTS_ON;
Assert->export_to_level( 1, @_ );
}

$SIG{'__WARN__'} = sub { die @_ };
}
else {
my $caller = caller;
*{ $caller . '::ASSERT' } = \&dummyASSERT;
Expand Down
3 changes: 3 additions & 0 deletions core/lib/Foswiki.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1658,6 +1658,9 @@ sub new {
# Set command_line context if there is no query
$initialContext ||= defined($query) ? {} : { command_line => 1 };

# This foswiki supports : paragraph indent
$initialContext->{SUPPORTS_PARA_INDENT} = 1;

$query ||= new Foswiki::Request();
my $this = bless( { sandbox => 'Foswiki::Sandbox' }, $class );

Expand Down

0 comments on commit 1b4c4a9

Please sign in to comment.