You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by jo...@apache.org on 2012/01/03 19:03:04 UTC

svn commit: r1226899 - /incubator/ooo/ooo-site/trunk/lib/view.pm

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);
     }
 



Re: svn commit: r1226899 - /incubator/ooo/ooo-site/trunk/lib/view.pm

Posted by Dave Fisher <da...@comcast.net>.
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);
>     }
> 
> 
>