mixinafFancordion::FancordionSkin
afFancordion::FancordionSkin
Implement to create a skin for specification output. Skins are used by Fancordion and its command to generate the HTML result files.
This mixin by default renders bare, but valid, HTML5 markup. Override methods to alter the markup generated.
- a
virtual Str a(Uri href, Str text)
Renders a complete
<a>
tag.- addCss
virtual Void addCss(File cssFile)
Copies the given css file to the output dir and adds the resultant URL to
cssUrls
.- addScript
virtual Void addScript(File scriptFile)
Copies the given script file to the output dir and adds the resultant URL to
scriptUrls
.- blockQuote
virtual Str blockQuote()
Starts a
<blockquote>
tag.- blockQuoteEnd
virtual Str blockQuoteEnd()
Ends a
</blockquote>
tag.- body
virtual Str body()
Starts a
<body>
tag and renders the breadcrumbs.- bodyEnd
virtual Str bodyEnd()
Ends a
</body>
tag.This also calls
footer()
and renders thescriptUrls
as<script>
tags.virtual Uri:Str breadcrumbPaths()
Returns an ordered map of URLs to fixture titles to use for the breadcrumbs.
virtual Str breadcrumbs()
Renders the breadcrumbs. Makes a call to
breadcrumbPaths()
- cmdErr
virtual Str cmdErr(Str cmdUrl, Str cmdText, Err err)
Called to render a command error.
- cmdFailure
virtual Str cmdFailure(Str expected, Obj? actual, Bool escape := true)
Called to render a command failure.
- cmdHook
virtual Str cmdHook(Uri cmdUrl, Str cmdText, Obj?[]? data)
Custom commands may use this method as a generic hook into the skin.
By default this method returns an empty string.
- cmdIgnored
virtual Str cmdIgnored(Str text)
Called to render an ignored command.
- cmdSuccess
virtual Str cmdSuccess(Str text, Bool escape := true)
Called to render a command success.
- code
virtual Str code()
Starts a
<code>
tag.- codeEnd
virtual Str codeEnd()
Ends a
</code>
tag.- copyFile
virtual Uri copyFile(File srcFile, Uri destUrl)
Copies the given file to the destination URL - which is relative to the output folder. Returns a URL to the destination file relative to the current fixture file. Use this URL for embedding href's in the fixture HTML. Example:
copyFile(`fan://afFancordion/res/fancordion.css`.get, `etc/fancordion.css`) --> `../../etc/fancordion.css`
- cssUrls
abstract Uri[] cssUrls
- em
virtual Str em()
Starts an
<em>
tag.- emEnd
virtual Str emEnd()
Ends an
</em>
tag.- example
virtual Str example()
Starts an example section. By default this returns a
div
with the classexample
:<div class="example">
- exampleEnd
virtual Str exampleEnd()
Ends an example section. By default this ends a div:
</div>
- fixtureCtx
virtual FixtureCtx fixtureCtx()
Returns the context associated with the current fixture.
- fixtureMeta
virtual FixtureMeta fixtureMeta()
Returns meta associated with the current fixture.
virtual Str footer()
Renders a footer. This is (usually) called by
bodyEnd()
. By default it just renders a simple link to the Fancordion website.- head
virtual Str head()
Starts a <head> tag - this should also render a <title> tag.
- headEnd
virtual Str headEnd()
- heading
virtual Str heading(Int level, Str title, Str? anchorId)
Starts a heading tag, e.g.
<h1>
- headingEnd
virtual Str headingEnd(Int level)
Ends a heading tag, e.g.
</h1>
- html
virtual Str html()
Starts a
<html>
tag - this should also render the DOCTYPE.Note that XHTML5 documents require the
xmlns
:<html xmlns="http://www.w3.org/1999/xhtml">
- htmlEnd
virtual Str htmlEnd()
Ends a
<html>
tag. This also renders thecssUrls
as link tags into the<head>
.- img
virtual Str img(Uri src, Str alt)
Renders a complete
<img>
tag.Note that in HTML5 the
<img>
tag is a Void element and may be self closing.- li
virtual Str li()
Starts a
<li>
tag.- liEnd
virtual Str liEnd()
Ends a
</li>
tag.- link
Renders a complete
<link>
tag.Note that in HTML5 the
<link>
tag is a Void element and may be self closing.- ol
virtual Str ol(OrderedListStyle style)
Starts an
<ol>
tag. By default the list style is added as a CSS style attribute:<ol style="list-style-type: upper-roman;">
- olEnd
virtual Str olEnd()
Ends an
</ol>
tag.- p
virtual Str p(Str? admonition)
Starts a
<p>
tag. The admonition is added as a class (lowercase):LEAD: Here I am --> <p class="lead">Here I am</p>
- pEnd
virtual Str pEnd()
Ends a
</p>
tag.- pre
virtual Str pre()
Starts a
<pre>
tag.- preEnd
virtual Str preEnd()
Ends a
</pre>
tag.- script
Renders a complete
<script>
tag.Note that in HTML5 the
<script>
tag is NOT a Void element and therefore MUST not be self colsing.- scriptUrls
abstract Uri[] scriptUrls
- setup
virtual Void setup()
Called before every fixture run. This should reset any state held by the skin, e.g. the
cssUrls
andscriptUrls
.- strong
virtual Str strong()
Starts a
<strong>
tag.- strongEnd
virtual Str strongEnd()
Ends a
</strong>
tag.- table
virtual Str table(Str? cssClass := null)
Starts a
<table>
tag.- tableEnd
virtual Str tableEnd()
Ends a
</table>
tag.- td
Returns a
<td>
tag.- tearDown
virtual Void tearDown()
Called after every fixture run. This should reset / cleardown any state held by the skin, e.g. the
cssUrls
andscriptUrls
.- text
Renders the given text. By default the text is XML escaped.
- th
Returns a
<th>
tag.- tr
virtual Str tr()
Starts a
<tr>
tag.- trEnd
virtual Str trEnd()
Ends a
</tr>
tag.- ul
virtual Str ul()
Starts a
<ul>
tag.- ulEnd
virtual Str ulEnd()
Ends a
</ul>
tag.