Jay Traband 6f6e83722e squashed commits for PR 222 from jtraband
- add warning when bad example tag is encountered.
- shredding for api docs + refactoring of gulpfile to clarify task names.
- added top level gulp tasks + error handling cleanup
- added test-api-builder gulp task
- added warning messages during build-shred-map processing
- mixin signature change
- updated styleguide ... continued.
- added @exampleTabs inlinetag support + refactoring shared services between @example and @exampleTabs
- added new inline tag @linkDevGuide + cleanup
- added angular source watch logic for serve-and-sync and source for examples changed from test -> examples + cleanup
- promisify del
- styleguide explanation of @example, @exampleTabs and @linkDevGuide
2015-09-23 14:04:58 -07:00

25 lines
1010 B
JavaScript

var path = require('canonical-path');
var FRAGMENT_DIR = "./public/docs/_fragments";
/**
* @dgService getApiFragmentFileName
* @description
* returns the name of the api fragment file given a relative path and a region tag.
* @kind function
* @param {String} relativePath The relative path to the example file some part of which will be pulled in.
* @param {String} region Name of a region within this file ( may be null).
* @return {Object} The api fragment file name
* @return {Object} The api fragment file name
*/
module.exports = function getApiFragmentFileName() {
return function getApiFragmentFileName(relativePath, region) {
var dir = path.join("_api", path.dirname(relativePath));
var extn = path.extname(relativePath);
var baseNameNoExtn = path.basename(relativePath, extn);
var fileName = region ? baseNameNoExtn + "-" + region + extn : baseNameNoExtn + extn;
var fragFileName = path.join(FRAGMENT_DIR, dir, fileName + '.md');
return fragFileName;
}
}