classafFancordion::FancordionSkin

sys::Obj
  afFancordion::FancordionSkin

Implement to create a skin for specification output. Skins are used by Fancordion Commands to generate the HTML result files.

This class renders bare, but valid, HTML5 markup. Override methods to alter the markup generated.

a

Source

virtual This a(Uri href, Str text)

Renders a complete <a> tag.

addCss

Source

virtual Void addCss(File cssFile, Bool overwrite := false)

Copies the given css file to the output dir and adds the resultant URL to cssUrls.

addScript

Source

virtual Void addScript(File scriptFile, Bool overwrite := false)

Copies the given script file to the output dir and adds the resultant URL to scriptUrls.

blockQuote

Source

virtual This blockQuote()

Starts a <blockquote> tag.

blockQuoteEnd

Source

virtual This blockQuoteEnd()

Ends a </blockquote> tag.

body

Source

virtual This body()

Starts a <body> tag and renders the breadcrumbs.

bodyEnd

Source

virtual This bodyEnd()

Ends a </body> tag.

This also calls footer() and renders the scriptUrls as <script> tags.

Source

virtual Uri:Str breadcrumbPaths()

Returns an ordered map of URLs to fixture titles to use for the breadcrumbs.

Source

virtual This breadcrumbs()

Renders the breadcrumbs. Makes a call to breadcrumbPaths()

cmdErr

Source

virtual This cmdErr(Str cmdUrl, Str cmdText, Err err)

Called to render a command error.

cmdFailure

Source

virtual This cmdFailure(Str expected, Obj? actual, Bool escape := true)

Called to render a command failure.

cmdHook

Source

virtual This 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

Source

virtual This cmdIgnored(Str text)

Called to render an ignored command.

cmdSuccess

Source

virtual This cmdSuccess(Str text, Bool escape := true)

Called to render a command success.

code

Source

virtual This code()

Starts a <code> tag.

codeEnd

Source

virtual This codeEnd()

Ends a </code> tag.

copyFile

Source

virtual Uri copyFile(File srcFile, Uri destUrl, Bool overwrite := false)

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`

If destUrl is a dir, then the file is copied into it.

cssUrls

Source

Uri[] cssUrls := Uri[,]

CSS URLs are rendered in the <head> element. CSS URLs may be added at any stage of rendering as they are added during htmlEnd().

em

Source

virtual This em()

Starts an <em> tag.

emEnd

Source

virtual This emEnd()

Ends an </em> tag.

fixtureCtx

Source

virtual FixtureCtx fixtureCtx()

Returns the context associated with the current fixture.

fixtureMeta

Source

virtual FixtureMeta fixtureMeta()

Returns meta associated with the current fixture.

Source

virtual This footer()

Renders a footer. This is (usually) called by bodyEnd(). By default it just renders a simple link to the Fancordion website.

Source

virtual This head()

Starts a <head> tag - this should also render a <title> tag.

headEnd

Source

virtual This headEnd()

heading

Source

virtual This heading(Int level, Str title, Str? anchorId)

Starts a heading tag, e.g. <h1>

headingEnd

Source

virtual This headingEnd(Int level)

Ends a heading tag, e.g. </h1>

html

Source

virtual This 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

Source

virtual This htmlEnd()

Ends a <html> tag. This also renders the cssUrls as link tags into the <head>.

img

Source

virtual This 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

Source

virtual This li()

Starts a <li> tag.

liEnd

Source

virtual This liEnd()

Ends a </li> tag.

Source

virtual This link(Uri href)

Renders a CSS <link> tag.

Note that in HTML5 the <link> tag is a Void element and may be self closing.

ol

Source

virtual This 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

Source

virtual This olEnd()

Ends an </ol> tag.

p

Source

virtual This 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

Source

virtual This pEnd()

Ends a </p> tag.

pre

Source

virtual This pre()

Starts a <pre> tag.

preEnd

Source

virtual This preEnd()

Ends a </pre> tag.

render

Source

Str render(|->Void writeFunc)

Renders the contents of the given func into a Str without appending it to the skin's renderBuf.

activeLink := skin.render |->| {
    write("<div class='active'>")
    a(`http://fantom.org`, "Fantom")
    write("</div>")
}
renderAnchor

Source

Str renderAnchor(Uri href, Str text)

Renders and returns an <a> anchor.

renderBuf

Source

StrBuf renderBuf := StrBuf.<ctor>()

The StrBuf that this Skin renders to.

script

Source

virtual This script(Uri src)

Renders a javascript <script> tag.

Note that in HTML5 the <script> tag is NOT a Void element and therefore MUST not be self colsing.

scriptUrls

Source

Uri[] scriptUrls := Uri[,]

Script URLs are rendered just before the closing </body> element. Script URLs may be added at any stage of rendering as they are added during bodyEnd().

section

Source

virtual This section()

Starts a section. By default this returns a div with the class example:

<div class="example">
sectionEnd

Source

virtual This sectionEnd()

Ends an example section. By default this ends a div:

</div>
setup

Source

virtual Void setup()

Called before every fixture run. This should reset any state held by the skin, e.g. the cssUrls and scriptUrls.

strong

Source

virtual This strong()

Starts a <strong> tag.

strongEnd

Source

virtual This strongEnd()

Ends a </strong> tag.

table

Source

virtual This table(Str? cssClass := null)

Starts a <table> tag.

tableEnd

Source

virtual This tableEnd()

Ends a </table> tag.

td

Source

virtual This td(Str heading)

Returns a <td> tag.

tearDown

Source

virtual Void tearDown()

Called after every fixture run. This should reset / cleardown any state held by the skin, e.g. the cssUrls and scriptUrls.

text

Source

virtual This text(Str text)

Renders the given text. By default the text is XML escaped.

th

Source

virtual This th(Str heading)

Returns a <th> tag.

tr

Source

virtual This tr()

Starts a <tr> tag.

trEnd

Source

virtual This trEnd()

Ends a </tr> tag.

ul

Source

virtual This ul()

Starts a <ul> tag.

ulEnd

Source

virtual This ulEnd()

Ends a </ul> tag.

write

Source

This write(Str str)