Created
August 30, 2023 16:27
-
-
Save The0x539/d8d3193fc3185ce9a9991e10fab6f1e3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static String testableHtml(PageData pageData, boolean includeSuiteSetup) { | |
if (!pageData.hasAttribute("Test")) { | |
return pageData.getHtml(); | |
} | |
WikiPage wikiPage = pageData.getWikiPage(); | |
StringBuffer buffer = new StringBuffer(); | |
if (includeSuiteSetup) { | |
includePage(buffer, wikiPage, SuiteResponder.SUITE_SETUP_NAME, "-setup"); | |
} | |
includePage(buffer, wikiPage, "SetUp", "-setup"); | |
buffer.append(pageData.getContent()); | |
includePage(buffer, wikiPage, "TearDown", "-teardown"); | |
if (includeSuiteSetup) { | |
includePage(buffer, wikiPage, SuiteResponder.SUITE_TEARDOWN_NAME, "-teardown"); | |
} | |
pageData.setContent(buffer.toString()); | |
return pageData.getHtml(); | |
} | |
private static void includePage(StringBuffer buffer, WikiPage wikiPage, String pageName, String argName) { | |
WikiPage page = PageCrawlerImpl.getInheritedPage(pageName, wikiPage); | |
if (page == null) { | |
return; | |
} | |
WikiPagePath path = page.getPageCrawler().getFullPath(page); | |
String pathName = PathParser.render(path); | |
buffer | |
.append("!include ").append(argName) | |
.append(" .").append(pathName) | |
.append("\n"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment