reorg util-fns.jade
This commit is contained in:
parent
7934b8450a
commit
cb136b1028
|
@ -1,6 +1,30 @@
|
||||||
|
//- Mixins and associated functions
|
||||||
|
|
||||||
|
mixin makeExample(path, fileName, title, stylePatterns)
|
||||||
|
|
||||||
|
- var language = attributes.language || getExtn(fileName);
|
||||||
|
- var format = attributes.format || "linenums";
|
||||||
|
- var extPath = getPathToFrags() + path + "/";
|
||||||
|
|
||||||
|
if (title)
|
||||||
|
.example-title #{title}
|
||||||
|
code-example(language="#{language}" format="#{format}")
|
||||||
|
!= getFrag(extPath + fileName + ".md", stylePatterns)
|
||||||
|
|
||||||
|
mixin makeTabs(path, fileNames, tabNames, stylePatterns)
|
||||||
|
- fileNames = fileNames.split(",");
|
||||||
|
- tabNames = tabNames.split(",")
|
||||||
|
|
||||||
|
code-tabs
|
||||||
|
each fileName,index in fileNames
|
||||||
|
- var tabName = tabNames[index].trim();
|
||||||
|
- var fileName = fileNames[index].trim();
|
||||||
|
- var language = attributes.language || getExtn(fileName);
|
||||||
|
- var format = attributes.format || "linenums";
|
||||||
|
- var extPath = getPathToFrags() + path + "/";
|
||||||
|
- var sps = Array.isArray(stylePatterns) ? stylePatterns[index] : stylePatterns;
|
||||||
|
code-pane(language="#{language}" name="#{tabName}" format="#{format}")
|
||||||
|
!= getFrag(extPath + fileName + ".md", sps)
|
||||||
|
|
||||||
- var getFrag = function(fileName, stylePatterns) {
|
- var getFrag = function(fileName, stylePatterns) {
|
||||||
- var frag = partial(fileName);
|
- var frag = partial(fileName);
|
||||||
|
@ -55,30 +79,3 @@
|
||||||
- // we will almost certainly never go 10 or 11 deep but ...
|
- // we will almost certainly never go 10 or 11 deep but ...
|
||||||
- return current.pathToFrags || "../../../../../../../../../../../".substr(0, (currentPath.length-2)*3) + "_fragments/";
|
- return current.pathToFrags || "../../../../../../../../../../../".substr(0, (currentPath.length-2)*3) + "_fragments/";
|
||||||
- }
|
- }
|
||||||
|
|
||||||
mixin makeExample(path, fileName, title, stylePatterns)
|
|
||||||
|
|
||||||
- var language = attributes.language || getExtn(fileName);
|
|
||||||
- var format = attributes.format || "linenums";
|
|
||||||
- var extPath = getPathToFrags() + path + "/";
|
|
||||||
|
|
||||||
if (title)
|
|
||||||
.example-title #{title}
|
|
||||||
code-example(language="#{language}" format="#{format}")
|
|
||||||
!= getFrag(extPath + fileName + ".md", stylePatterns)
|
|
||||||
|
|
||||||
mixin makeTabs(path, fileNames, tabNames, stylePatterns)
|
|
||||||
- fileNames = fileNames.split(",");
|
|
||||||
- tabNames = tabNames.split(",")
|
|
||||||
// .p Length #{currentPath.length}
|
|
||||||
|
|
||||||
code-tabs
|
|
||||||
each fileName,index in fileNames
|
|
||||||
- var tabName = tabNames[index].trim();
|
|
||||||
- var fileName = fileNames[index].trim();
|
|
||||||
- var language = attributes.language || getExtn(fileName);
|
|
||||||
- var format = attributes.format || "linenums";
|
|
||||||
- var extPath = getPathToFrags() + path + "/";
|
|
||||||
- var sps = Array.isArray(stylePatterns) ? stylePatterns[index] : stylePatterns;
|
|
||||||
code-pane(language="#{language}" name="#{tabName}" format="#{format}")
|
|
||||||
!= getFrag(extPath + fileName + ".md", sps)
|
|
||||||
|
|
Loading…
Reference in New Issue