[interchange-cvs] [SCM] Interchange branch, master, updated. 092bd56ab8e25c4b436dc4c08db0f4e11c8dbb0a

Jon Jensen interchange-cvs at icdevgroup.org
Mon Aug 24 00:10:11 UTC 2009

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Interchange".

The branch, master has been updated
       via  092bd56ab8e25c4b436dc4c08db0f4e11c8dbb0a (commit)
      from  0501ff1b4cdee9dfa661b8ff0e7099f41f8836b3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 092bd56ab8e25c4b436dc4c08db0f4e11c8dbb0a
Author: Jon Jensen <jon at endpoint.com>
Date:   Sun Aug 23 17:27:22 2009 -0600

    Add strip_html filter, which removes HTML tags
    Having a tag such as this has been discussed a few times on interchange-users
    over the years. This fits the basic requirements of those discussions, and
    starts with the basics. We can add options as needed later.


Summary of changes and diff:
 code/Filter/strip_html.filter |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)
 create mode 100644 code/Filter/strip_html.filter

diff --git a/code/Filter/strip_html.filter b/code/Filter/strip_html.filter
new file mode 100644
index 0000000..7e14e88
--- /dev/null
+++ b/code/Filter/strip_html.filter
@@ -0,0 +1,31 @@
+# Copyright 2009 Interchange Development Group and others
+# 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. See the LICENSE file for details.
+CodeDef strip_html Filter
+CodeDef strip_html Description Strip HTML
+CodeDef strip_html Routine <<EOR
+sub {
+    my $val = shift;
+    # replace these container tags with a space
+    $val =~ s{</?(?:p|ol|ul|li|div|h[123456]|pre|dl|dd|dt|form|option|textarea|blockquote)(?:\s[^>]*)?>}{ }ig;
+    # replace these self-closing tags with a space
+    $val =~ s{<[bh]r(?:\s*/|\s[^>]*)?>}{ }ig;
+    # remove all remaining tags and leave no space
+    $val =~ s{</?\w[^>]*>}{}g;
+    # collapse all whitespace, as HTML does when rendering anyway,
+    # to facilitate truncating at a certain number of characters
+    $val =~ s{\A\s+}{};
+    $val =~ s{\s+\z}{};
+    $val =~ s{\s+}{ }g;
+    return $val;


More information about the interchange-cvs mailing list