dox Executable Documentation

Map urls

The URLs used by the HTTP mode of boxes are all but beautiful. And existing URLs would break by introducing boxes. So URLs can be mapped to make them more human and search engine friendly.

Map url to box target

Given the box container 'o' responding 'a:$a'
Given the box container 'b' responding 'B'
Given 'o' contains 'a'
Given 'o' maps targets to 'a'
Given the request target 'b' is
When I get the response from 'o'
Then the response should be 'a:B'

Empty target

Given the box container 'o' responding 'a:$a'
Given the box container 'a' responding 'A'
Given 'o' contains 'a'
Given 'o' maps targets to 'a'
When I get the response from 'o'
Then the response should be 'a:A'

Map arguments

Given the box container 'o' responding 'a:$a'
Given the box container 'a' responding '$foo $me'
Given 'o' contains 'a'
Given 'o' maps targets to 'a'
Given the request argument 'foo' is 'bar'
Given the request argument '_a/me' is 'baz'
When I get the response from 'o'
Then the response should be 'a:bar baz'

Keep other box arguments

Given the box container 'o' responding 'a:$a c:$c'
Given the box container 'b' responding 'B'
Given the box container 'c' responding '$foo'
Given 'o' contains 'a'
Given 'o' contains 'c'
Given 'o' maps targets to 'a'
Given the request target 'b' is
Given the request argument '_c/foo' is 'bar'
When I get the response from 'o'
Then the response should be 'a:B c:bar'

Disable mapping with header

Given the box container 'o' responding 'a:$a'
Given the box container 'a' responding 'A'
Given 'o' contains 'a'
Given 'o' maps targets to 'a'
Given the request target 'a' is
Given the request has the header 'X-NoBoxing'
When I get the response from 'o'
Then the response should be 'A'

Only map html requests

Given the box container 'o' responding 'a:$a'
Given the box container 'a' responding 'A'
Given 'o' contains 'a'
Given 'o' maps targets to 'a'
Given the request target 'a' is
Given the request format is 'notHtml'
When I get the response from 'o'
Then the response should be 'A'

Map links

Given the box container 'o' responding 'a:$a b:$b'
Given the box container 'a' responding '<a href="foo/bar?me=baz">A</a>'
Given the box container 'b' responding '<a href="foo" target="a">B</a>'
Given 'o' contains 'a'
Given 'o' contains 'b'
Given 'o' maps targets to 'a'
Given the request argument '_b/one' is 'two'
When I get the response from 'o'
Then the response should be 'a:<a href="foo/bar?me=baz&_b[one]=two">A</a> b:<a href="foo?_b[one]=two">B</a>'

Wrap children

Given the box container 'o' responding '$a'
Given the box container 'a' responding '$b'
Given the box container 'b' responding '<a href="?foo=bar">B</a>'
Given 'o' contains 'a'
Given 'a' contains 'b'
Given 'o' maps targets to 'a'
Given the request argument '_a/!' is 'a'
When I get the response from 'o'
Then the response should be '<a href="a?_a[_b][foo]=bar&_a[_]=b">B</a>'

Links to self

Given the box container 'o' responding 'a:$a'
Given the box container 'baz' responding '<a href="?foo=bar">A</a>'
Given 'o' contains 'a'
Given 'o' maps targets to 'a'
Given the request target 'baz' is
When I get the response from 'o'
Then the response should be 'a:<a href="baz?foo=bar">A</a>'

Add base element

Given the box container 'o' responding '<html><head></head></html>'
Given the box container 'a'
Given 'o' contains 'a'
Given 'o' maps targets to 'a'
Given the context is 'my.site/here'
When I get the response from 'o'
Then the response should be '<html><head><base href="my.site/here"/></head></html>'