incubator-ooo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Fisher <dave2w...@comcast.net>
Subject Re: svn commit: r1226899 - /incubator/ooo/ooo-site/trunk/lib/view.pm
Date Tue, 03 Jan 2012 18:32:53 GMT
Hi Joe,

Thanks. I'm glad to see sed go away. I was going to ask you about a better way to this.

-    $args{header} = `sed -n '/<head>/,/<\\/head>/p' ${file} | sed -e '1s/.*<head>//'
-e 's/<\\/head>.*//'`;
-    $args{content} = `sed -n '/<body.*>/,/<\\/body>/p' ${file} | sed -e '1s/.*<body.*>//'
-e "s/<\\/body>.*//"`;
+    if ($args{content} =~ m!<head>(.*?)</head>.*?<body.*?>(.*?)</body>!si)
{
+        @args{qw/header content/} = ($1, $2);
+    }

It may be helpful to also extract any parameters in the body tag itself. If I understand your
changes properly.

  if ($args{content} =~ m!<head>(.*?)</head>.*?<body(.*?)>(.*?)</body>!si)
{
        @args{qw/header bodytag content/} = ($1, $2, $3);
   }

This would help with encoding, writing direction and other Native Language issues.

I've got my paid job to do the next few days and need to step back from my AOO obsession.

Regards,
Dave

On Jan 3, 2012, at 10:03 AM, joes@apache.org wrote:

> Author: joes
> Date: Tue Jan  3 18:03:04 2012
> New Revision: 1226899
> 
> URL: http://svn.apache.org/viewvc?rev=1226899&view=rev
> Log:
> regexp bugs
> 
> Modified:
>    incubator/ooo/ooo-site/trunk/lib/view.pm
> 
> Modified: incubator/ooo/ooo-site/trunk/lib/view.pm
> URL: http://svn.apache.org/viewvc/incubator/ooo/ooo-site/trunk/lib/view.pm?rev=1226899&r1=1226898&r2=1226899&view=diff
> ==============================================================================
> --- incubator/ooo/ooo-site/trunk/lib/view.pm (original)
> +++ incubator/ooo/ooo-site/trunk/lib/view.pm Tue Jan  3 18:03:04 2012
> @@ -117,7 +117,7 @@ sub html_page {
> 	}
>     }
> 
> -    if ($args{content} =~ m!<head>([.\n]*)</head>[.\n]*<body.*>([.\n]*)</body>!i)
{
> +    if ($args{content} =~ m!<head>(.*?)</head>.*?<body.*?>(.*?)</body>!si)
{
>         @args{qw/header content/} = ($1, $2);
>     }
> 
> 
> 


Mime
View raw message