[MKDoc-commit] [1.6] factor out some duplicate code
bruno at mkdoc.demon.co.uk
bruno at mkdoc.demon.co.uk
Thu Aug 18 17:49:12 BST 2005
Log Message:
-----------
[1.6] factor out some duplicate code
Tags:
----
mkdoc-1-6
Modified Files:
--------------
mkd/flo:
Component.pm
mkd/flo/editor:
Text.pm
Html.pm
-------------- next part --------------
Index: Component.pm
===================================================================
RCS file: /var/spool/cvs/mkd/flo/Component.pm,v
retrieving revision 1.3.2.38
retrieving revision 1.3.2.39
diff -Lflo/Component.pm -Lflo/Component.pm -u -r1.3.2.38 -r1.3.2.39
--- flo/Component.pm
+++ flo/Component.pm
@@ -482,6 +482,27 @@
##
+# $self->links_for_tagger;
+# ------------------------
+# Returns a list of links in a format suitable for tagging
+##
+sub links_for_tagger
+{
+ my $self = shift;
+ my @link = flo::Editor->links();
+ my @newl = ();
+ for (@link) {
+ my $new = { %{$_} };
+ $new->{_expr} = delete $new->{expr};
+ $new->{_tag} = 'a';
+ $new->{title} = delete $new->{desc};
+ push @newl, $new;
+ }
+ return @newl;
+}
+
+
+##
# $self->is_only_child;
# ---------------------
# Returns TRUE if this component has no sibling components,
Index: Text.pm
===================================================================
RCS file: /var/spool/cvs/mkd/flo/editor/Text.pm,v
retrieving revision 1.6.2.25
retrieving revision 1.6.2.26
diff -Lflo/editor/Text.pm -Lflo/editor/Text.pm -u -r1.6.2.25 -r1.6.2.26
--- flo/editor/Text.pm
+++ flo/editor/Text.pm
@@ -74,19 +74,8 @@
$data = MKDoc::Text::Structured::process ($data);
$data = "<div class=\"text\">$data</div>";
- my @link = flo::Editor->links();
- my @newl = ();
- for (@link) {
- my $new = { %{$_} };
- $new->{_expr} = delete $new->{expr};
- $new->{_tag} = 'a';
- $new->{title} = delete $new->{desc};
- push @newl, $new;
- }
-
+ my @newl = $self->links_for_tagger();
my $res = MKDoc::XML::Tagger::Preserve->process_data (['a'], $data, @newl);
- # $res =~ s/^<div>//;
- # $res =~ s/<\/div>$//;
return $res;
}
Index: Html.pm
===================================================================
RCS file: /var/spool/cvs/mkd/flo/editor/Html.pm,v
retrieving revision 1.7.2.27
retrieving revision 1.7.2.28
diff -Lflo/editor/Html.pm -Lflo/editor/Html.pm -u -r1.7.2.27 -r1.7.2.28
--- flo/editor/Html.pm
+++ flo/editor/Html.pm
@@ -116,16 +116,7 @@
my $self = shift;
my $data = $self->{data};
- my @link = flo::Editor->links();
- my @newl = ();
- for (@link) {
- my $new = { %{$_} };
- $new->{_expr} = delete $new->{expr};
- $new->{_tag} = 'a';
- $new->{title} = delete $new->{desc};
- push @newl, $new;
- }
-
+ my @newl = $self->links_for_tagger();
return MKDoc::XML::Tagger::Preserve->process_data (['a'], $data, @newl);
}
More information about the MKDoc-commit
mailing list