01: package com.opensymphony.module.sitemesh.html.rules;
02:
03: import com.opensymphony.module.sitemesh.html.BlockExtractingRule;
04: import com.opensymphony.module.sitemesh.html.Tag;
05:
06: public class TitleExtractingRule extends BlockExtractingRule {
07:
08: private final PageBuilder page;
09:
10: private boolean seenTitle;
11:
12: public TitleExtractingRule(PageBuilder page) {
13: super (false, "title");
14: this .page = page;
15: }
16:
17: protected void end(Tag tag) {
18: if (!seenTitle) {
19: page.addProperty("title", currentBuffer().toString());
20: seenTitle = true;
21: }
22: }
23: }
|