1 package com.opensymphony.module.sitemesh.parser.rules; 2 3 import com.opensymphony.module.sitemesh.HTMLPage; 4 import com.opensymphony.module.sitemesh.html.BlockExtractingRule; 5 import com.opensymphony.module.sitemesh.html.Tag; 6 7 public class TitleExtractingRule extends BlockExtractingRule { 8 9 private final HTMLPage page; 10 11 private boolean seenTitle; 12 13 public TitleExtractingRule(HTMLPage page) { 14 super(false, "title"); 15 this.page = page; 16 } 17 18 protected void end(Tag tag) { 19 if (!seenTitle) { 20 page.addProperty("title", context.currentBuffer().toString()); 21 seenTitle = true; 22 } 23 } 24 } 25 | Popular Tags |