<%@
input ({
idPrefix:'string',
tour:'string',
pageUrl:'string'
});
required (
'UizeSite.Examples',
'Uize.Url'
);
%>
<%
var
_tour = input.tour,
_tourExamples = UizeSite.Examples ()
;
/*** if tour is not "all", find all pages for this specific tour ***/
if (_tour.toLowerCase () != 'all') {
var
_examples = _tourExamples,
_keywordsMatchRegExp = new RegExp ('\\b' + _tour + '\\b','i')
;
_tourExamples = [];
for (var _exampleNo = -1, _examplesLength = _examples.length; ++_exampleNo < _examplesLength;) {
var _example = _examples [_exampleNo];
_keywordsMatchRegExp.test (_example.keywords) && _tourExamples.push (_example);
}
}
var
_tourExamplesLength = _tourExamples.length,
_tourExampleUrlSuffix = '?tour=' + _tour,
_pageNo = Uize.indexIn (
Uize.map (_tourExamples,function (_tourExample) {return Uize.Url.from (_tourExample.path).fileName}),
Uize.Url.from (input.pageUrl).fileName
)
;
function _getExamplePageLink (_example) {
return _example.path.match (/[\\\/]([^\\\/]+)$/) [1] + _tourExampleUrlSuffix;
}
%>
<%
for (var _tourExampleNo = -1; ++_tourExampleNo < _tourExamplesLength;) {
var _tourExample = _tourExamples [_tourExampleNo];
%>
| <%
}
%>