
com.opensymphony.module.sitemesh.html.rules.TitleExtractingRule Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sitemesh Show documentation
Show all versions of sitemesh Show documentation
Sitemesh web-page layout system.
The newest version!
/*
* sitemesh2 (https://github.com/hazendaz/sitemesh2)
*
* Copyright 2011-2023 Hazendaz.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of The Apache Software License,
* Version 2.0 which accompanies this distribution, and is available at
* https://www.apache.org/licenses/LICENSE-2.0.txt
*
* Contributors:
* Hazendaz (Jeremy Landis).
*/
package com.opensymphony.module.sitemesh.html.rules;
import com.opensymphony.module.sitemesh.html.BlockExtractingRule;
import com.opensymphony.module.sitemesh.html.Tag;
/**
* The Class TitleExtractingRule.
*/
public class TitleExtractingRule extends BlockExtractingRule {
/** The page. */
private final PageBuilder page;
/** The seen title. */
private boolean seenTitle;
/**
* Instantiates a new title extracting rule.
*
* @param page
* the page
*/
public TitleExtractingRule(PageBuilder page) {
super(false, "title");
this.page = page;
}
@Override
protected void end(Tag tag) {
if (!seenTitle) {
page.addProperty("title", getCurrentBufferContent());
seenTitle = true;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy