You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by wa...@apache.org on 2020/10/27 20:21:56 UTC

[openoffice-org] branch main updated: HTML template with extraction of head, body tag, and body

This is an automated email from the ASF dual-hosted git repository.

wave pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/openoffice-org.git


The following commit(s) were added to refs/heads/main by this push:
     new 120657d  HTML template with extraction of head, body tag, and body
120657d is described below

commit 120657d17efe49ed6fa2b9d00462e4534cbce3f6
Author: Dave Fisher <da...@davefisher.tech>
AuthorDate: Tue Oct 27 13:21:43 2020 -0700

    HTML template with extraction of head, body tag, and body
---
 content/about.html      |  3 +++
 templates/html_page.gsp | 26 ++++++++++++++++++++++++++
 templates/skeleton.gsp  |  2 +-
 3 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/content/about.html b/content/about.html
index ee93336..ae5306c 100644
--- a/content/about.html
+++ b/content/about.html
@@ -1,3 +1,6 @@
+type=html_page
+status=published
+~~~~~~
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
diff --git a/templates/html_page.gsp b/templates/html_page.gsp
new file mode 100644
index 0000000..e4d9e00
--- /dev/null
+++ b/templates/html_page.gsp
@@ -0,0 +1,26 @@
+<%
+def matcher0 = content.body =~ "<body(.*?)>";
+assert matcher0 instanceof java.util.regex.Matcher;
+if (!matcher0) {
+   throw new RuntimeException("bodytag does not match");
+}
+//assert matcher0.matches();
+content.bodytag = matcher0.group(1);
+
+def matcher1 = content.body =~ "<head.*?>([\\S\\s]*?)</head>";
+assert matcher1 instanceof java.util.regex.Matcher;
+if (!matcher1) {
+   throw new RuntimeException("bodytag='${content.bodytag}' -- head does not match");
+}
+//assert matcher1.matches();
+content.header = matcher1.group(1);
+
+def matcher2 = content.body =~ "<body.*?>([\\S\\s]*?)</body>";
+assert matcher2 instanceof java.util.regex.Matcher;
+if (!matcher2) {
+   throw new RuntimeException("head='${content.header}' -- body does not match");
+}
+//assert matcher2.matches();
+content.extracted_body= matcher2.group(1);
+
+include "skeleton.gsp" %>
diff --git a/templates/skeleton.gsp b/templates/skeleton.gsp
index b811f0d..21ac145 100644
--- a/templates/skeleton.gsp
+++ b/templates/skeleton.gsp
@@ -19,7 +19,7 @@
     <% } %>
     <link href="/css/ooo.css" rel="stylesheet" type="text/css">
   </head>
-  <body<% if (content.bodytag) { %> ${content_bodytag} <% } %>>
+  <body<% if (content.bodytag) { %>${content.bodytag}<% } %>>
     <!--#include virtual="${content.brand}" -->
     <div id="topbara">
       <% if (content.topnav) { %><!--#include virtual="${content.topnav}" --><% } %>


Re: [openoffice-org] branch main updated: HTML template with extraction of head, body tag, and body

Posted by Dave Fisher <wa...@apache.org>.
Hi Carl,

The matching thing in groovy was a bit of a pain, but it works now. Let me know if you have any suggestions.

Next steps are in skeleton.gsp
(1) Breadcrumbs.
(2) Branding, and navigator overrides.

Plus some settings work.

Regards,
Dave

> On Oct 27, 2020, at 1:21 PM, wave@apache.org wrote:
> 
> This is an automated email from the ASF dual-hosted git repository.
> 
> wave pushed a commit to branch main
> in repository https://gitbox.apache.org/repos/asf/openoffice-org.git
> 
> 
> The following commit(s) were added to refs/heads/main by this push:
>     new 120657d  HTML template with extraction of head, body tag, and body
> 120657d is described below
> 
> commit 120657d17efe49ed6fa2b9d00462e4534cbce3f6
> Author: Dave Fisher <da...@davefisher.tech>
> AuthorDate: Tue Oct 27 13:21:43 2020 -0700
> 
>    HTML template with extraction of head, body tag, and body
> ---
> content/about.html      |  3 +++
> templates/html_page.gsp | 26 ++++++++++++++++++++++++++
> templates/skeleton.gsp  |  2 +-
> 3 files changed, 30 insertions(+), 1 deletion(-)
> 
> diff --git a/content/about.html b/content/about.html
> index ee93336..ae5306c 100644
> --- a/content/about.html
> +++ b/content/about.html
> @@ -1,3 +1,6 @@
> +type=html_page
> +status=published
> +~~~~~~
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head>
> diff --git a/templates/html_page.gsp b/templates/html_page.gsp
> new file mode 100644
> index 0000000..e4d9e00
> --- /dev/null
> +++ b/templates/html_page.gsp
> @@ -0,0 +1,26 @@
> +<%
> +def matcher0 = content.body =~ "<body(.*?)>";
> +assert matcher0 instanceof java.util.regex.Matcher;
> +if (!matcher0) {
> +   throw new RuntimeException("bodytag does not match");
> +}
> +//assert matcher0.matches();
> +content.bodytag = matcher0.group(1);
> +
> +def matcher1 = content.body =~ "<head.*?>([\\S\\s]*?)</head>";
> +assert matcher1 instanceof java.util.regex.Matcher;
> +if (!matcher1) {
> +   throw new RuntimeException("bodytag='${content.bodytag}' -- head does not match");
> +}
> +//assert matcher1.matches();
> +content.header = matcher1.group(1);
> +
> +def matcher2 = content.body =~ "<body.*?>([\\S\\s]*?)</body>";
> +assert matcher2 instanceof java.util.regex.Matcher;
> +if (!matcher2) {
> +   throw new RuntimeException("head='${content.header}' -- body does not match");
> +}
> +//assert matcher2.matches();
> +content.extracted_body= matcher2.group(1);
> +
> +include "skeleton.gsp" %>
> diff --git a/templates/skeleton.gsp b/templates/skeleton.gsp
> index b811f0d..21ac145 100644
> --- a/templates/skeleton.gsp
> +++ b/templates/skeleton.gsp
> @@ -19,7 +19,7 @@
>     <% } %>
>     <link href="/css/ooo.css" rel="stylesheet" type="text/css">
>   </head>
> -  <body<% if (content.bodytag) { %> ${content_bodytag} <% } %>>
> +  <body<% if (content.bodytag) { %>${content.bodytag}<% } %>>
>     <!--#include virtual="${content.brand}" -->
>     <div id="topbara">
>       <% if (content.topnav) { %><!--#include virtual="${content.topnav}" --><% } %>
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@openoffice.apache.org
For additional commands, e-mail: dev-help@openoffice.apache.org