-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-svn-id: http://svn.foswiki.org/trunk/SafeWikiPlugin@3736 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
- Loading branch information
CrawfordCurrie
authored and
CrawfordCurrie
committed
Apr 28, 2009
1 parent
b063939
commit 7ad5ca1
Showing
3 changed files
with
90 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# See bottom of file for notices | ||
|
||
=pod | ||
---+ package Foswiki::Plugins::SafeWikiPlugin::Declaration | ||
A declaration node in an HTML parse tree | ||
=cut | ||
|
||
package Foswiki::Plugins::SafeWikiPlugin::Declaration; | ||
|
||
use strict; | ||
use Assert; | ||
|
||
sub new { | ||
my( $class, $text ) = @_; | ||
|
||
my $this = { text => $text }; | ||
$this->{children} = []; | ||
return bless( $this, $class ); | ||
} | ||
|
||
# debug generate the parse tree as HTML | ||
sub stringify { | ||
my( $this ) = @_; | ||
my $r = $this->{text}; | ||
foreach my $kid ( @{$this->{children}} ) { | ||
$r .= $kid->stringify(); | ||
} | ||
return $r; | ||
} | ||
|
||
sub isLeaf { | ||
return 0; | ||
} | ||
|
||
# Called by the parser | ||
sub addChild { | ||
my( $this, $node ) = @_; | ||
push( @{$this->{children}}, $node ); | ||
} | ||
|
||
# generate the parse tree, applying filters | ||
sub generate { | ||
my ($this, $filterURI, $filterHandler) = @_; | ||
my $text = $this->{text}; | ||
foreach my $kid ( @{$this->{children}} ) { | ||
$text .= $kid->generate($filterURI, $filterHandler); | ||
} | ||
return $text; | ||
} | ||
|
||
1; | ||
__DATA__ | ||
Copyright (C) 2007-2008 C-Dot Consultants http://c-dot.co.uk | ||
All rights reserved | ||
Author: Crawford Currie | ||
This program is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU General Public License | ||
as published by the Free Software Foundation; either version 2 | ||
of the License, or (at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details, published at | ||
http://www.gnu.org/copyleft/gpl.html | ||
This notice must be retained in all copies or derivatives of this | ||
code. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters