diff options
Diffstat (limited to 'sdnr/wireless-transport/code-Carbon-SR1/ux/help')
17 files changed, 2564 insertions, 0 deletions
diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-bundle/pom.xml b/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-bundle/pom.xml new file mode 100644 index 00000000..06081c2c --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-bundle/pom.xml @@ -0,0 +1,89 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>help</artifactId> + <groupId>com.highstreet.technologies.odl.dlux</groupId> + <version>0.5.1-SNAPSHOT</version> + </parent> + <artifactId>help-bundle</artifactId> + <name>${prefix} ${project.artifactId}</name> + <packaging>bundle</packaging> + <dependencies> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.core</artifactId> + <version>${osgi.core.version}</version> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.compendium</artifactId> + <version>${osgi.core.version}</version> + </dependency> + <dependency> + <groupId>org.apache.felix</groupId> + <artifactId>org.osgi.compendium</artifactId> + <version>${apache.felix.compendium}</version> + </dependency> + <dependency> + <groupId>org.opendaylight.dlux</groupId> + <artifactId>loader</artifactId> + <version>${dlux.loader.version}</version> + </dependency> + <dependency> + <groupId>com.highstreet.technologies.odl.dlux</groupId> + <artifactId>help-module</artifactId> + <version>0.5.1-SNAPSHOT</version> + </dependency> + </dependencies> + <build> + <resources> + <resource> + <directory>target/generated-resources</directory> + </resource> + <resource> + <directory>src/main/resources</directory> + </resource> + </resources> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <version>2.6</version> + <executions> + <!--loader Resources --> + <execution> + <id>unpack-loader-resources</id> + <goals> + <goal>unpack-dependencies</goal> + </goals> + <phase>generate-resources</phase> + <configuration> + <outputDirectory>${project.build.directory}/generated-resources</outputDirectory> + <groupId>com.highstreet.technologies.odl.dlux</groupId> + <includeArtifactIds>help-module</includeArtifactIds> + <excludes>META-INF\/**</excludes> + <excludeTransitive>true</excludeTransitive> + <ignorePermissions>false</ignorePermissions> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <Import-Package>org.osgi.service.http, + org.osgi.framework;version="1.0.0", + org.opendaylight.dlux.loader + </Import-Package> + <Export-Package></Export-Package> + </instructions> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml new file mode 100644 index 00000000..490a2301 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml @@ -0,0 +1,19 @@ +<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"> + <reference id="httpService" availability="mandatory" activation="eager" interface="org.osgi.service.http.HttpService"/> + <reference id="loader" availability="mandatory" activation="eager" interface="org.opendaylight.dlux.loader.DluxModuleLoader"/> + + <bean id="bundle" init-method="initialize" destroy-method="clean" class="org.opendaylight.dlux.loader.DluxModule"> + <property name="httpService" ref="httpService"/> + <property name="loader" ref="loader"/> + <property name="moduleName" value="help"/> + <property name="url" value="/src/app/help"/> + <property name="directory" value="/help"/> + <property name="requireJs" value="app/help/help.module"/> + <property name="angularJs" value="app.help"/> + <property name="cssDependencies"> + <list> + <value>src/app/help/help.custom.css</value> + </list> + </property> + </bean> +</blueprint>
\ No newline at end of file diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-module/pom.xml b/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-module/pom.xml new file mode 100644 index 00000000..dd744b3a --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-module/pom.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project + xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>help</artifactId> + <groupId>com.highstreet.technologies.odl.dlux</groupId> + <version>0.5.1-SNAPSHOT</version> + </parent> + <artifactId>help-module</artifactId> + <name>${prefix} ${project.artifactId}</name> + <packaging>jar</packaging> +</project>
\ No newline at end of file diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-module/src/main/resources/help/help.controller.js b/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-module/src/main/resources/help/help.controller.js new file mode 100644 index 00000000..c82464a8 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-module/src/main/resources/help/help.controller.js @@ -0,0 +1,284 @@ +var __assign = (this && this.__assign) || Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; +}; +define("help.tree", ["require", "exports", "angularAMD"], function (require, exports, angular) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var help = angular.module('app.help'); + // class HelpTreeController implements ng.IController { + // constructor(private $scope: ng.IScope & { rootNode: Node, data: Node[]}) { + // $scope.$watch("rootNode", (n, o) => { + // $scope.data = Object.keys($scope.rootNode).map(key => $scope.rootNode[key]); + // }); + // } + // } + // help.controller("treeCtrl", ["$scope", HelpTreeController]); + var helpTree = function ($compile) { + return { + restrict: "E", + transclude: true, + scope: { rootNode: '=' }, + //controller: 'treeCtrl', + template: '<ul>' + + '<li ng-transclude></li>' + + '<li ng-repeat="child in rootNode.nodes">' + + '<tree root-node="child"><div ng-transclude></div></tree>' + + '</li>' + + '</ul>', + compile: function (tElement, tAttr, transclude) { + var contents = tElement.contents().remove(); + var compiledContents; + return function (scope, iElement, iAttr) { + if (!compiledContents) { + compiledContents = $compile(contents, transclude); + } + compiledContents(scope, function (clone, scope) { + iElement.append(clone); + }); + }; + } + }; + }; + help.directive("tree", ["$compile", helpTree]); +}); +define("help.service", ["require", "exports", "angularAMD"], function (require, exports, angular) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var help = angular.module('app.help'); + var Helpservice = /** @class */ (function () { + function Helpservice($q, $http, env) { + this.$q = $q; + this.$http = $http; + this.env = env; + this.tocNodeCollection = null; + this.documents = {}; + } + Helpservice.prototype.getTableOfContents = function () { + var _this = this; + if (this.tocNodeCollection) { + return this.$q.resolve(this.tocNodeCollection); + } + return this.$http({ + method: "GET", + url: window.location.origin + "/help/?meta" + }).then(function (result) { + if (result.status === 200) { + _this.tocNodeCollection = result.data; + return result.data; + } + }); + }; + Helpservice.prototype.getDocument = function (path) { + var _this = this; + if (this.documents[path] != null) { + return this.$q.resolve(this.documents[path]); + } + return this.$http({ + method: "GET", + url: window.location.origin + "/help/" + path + }).then(function (result) { + if (result.status === 200) { + return _this.documents[path] = { + basePath: result.config && result.config.url && result.config.url, + document: result.data + }; + } + }); + }; + return Helpservice; + }()); + help.service('helpService', ['$q', '$http', Helpservice]); +}); +define("help.utilities", ["require", "exports"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.resolvePath = function () { + var paths = []; + for (var _i = 0; _i < arguments.length; _i++) { + paths[_i] = arguments[_i]; + } + console.log(paths); + function resolve(pathA, pathB) { + // ‘a’ => ['a'] + // 'a/b' => ['a', 'b'] + // '/a/b' => ['', 'a', 'b'] + // '/a/b/' => ['', 'a', 'b', ''] + pathB = pathB.split('/'); + if (pathB[0] === '') { + return pathB.join('/'); + } + pathA = pathA.split('/'); + var aLastIndex = pathA.length - 1; + if (pathA[aLastIndex] !== '') { + pathA[aLastIndex] = ''; + } + var part; + var i = 0; + while (typeof (part = pathB[i]) === 'string') { + switch (part) { + case '..': + pathA.pop(); + pathA.pop(); + pathA.push(''); + break; + case '.': + pathA.pop(); + pathA.push(''); + break; + default: + pathA.pop(); + pathA.push(part); + pathA.push(''); + break; + } + i++; + } + if (pathB[pathB.length - 1] !== '') + pathA.pop(); + return pathA.join('/'); + } + var i = 0; + var path; + var r = location.pathname; + var urlRegex = /^https?\:\/\/([^\/?#]+)(?:[\/?#]|$)/i; + var multiSlashReg = /\/\/+/g; + while (typeof (path = paths[i]) === 'string') { + // debugger; + var matches = path && path.match(urlRegex); + if (matches || !i) { + r = path; + } + else { + path = path.replace(multiSlashReg, '/'); + r = resolve(r, path); + } + i++; + } + return r; + }; +}); +define( ["require", "exports", "./lib/marked", "help.utilities", "help.tree", "help.service"], function (require, exports, marked, help_utilities_1) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var currentPath = '/help'; + var currentDoc = ''; + var renderer = new marked.Renderer(); + renderer.link = function (href, title, text) { + // check if href is rel or abs + var absUrlMatch = href.trim().match(/^https?:\/\//i); + return "<a "+(absUrlMatch ? "target=\"_blank\"":"")+" href=\"" + (absUrlMatch ? href : help_utilities_1.resolvePath('#/help/', currentDoc, href)) + "\" title=\"" + title + "\" >" + text + "</a>"; + }; + renderer.image = function (href, title, text) { + return "<img src=\"" + help_utilities_1.resolvePath(currentPath, href) + "\" alt=\"" + title + "\" />"; + }; + marked.setOptions({ + renderer: renderer, + gfm: true, + tables: true, + breaks: false, + pedantic: false, + sanitize: false, + smartLists: true, + smartypants: false, + xhtml: false + }); + var help = angular.module('app.help'); + var HelpDirective = function () { + return { + restrict: 'AE', + template: "<div class=\"global-help\" ><a href=\"{{ '#/help/'+ link }}\"><i class=\"fa fa-question-circle\"></i> Help</a></div>", + scope: { + link: '@' + }, + replace: true + }; + }; + help.directive('help', [HelpDirective]); + var MarkdownItDirective = function ($sanitize) { + var attribute = 'markdownIt'; + var render = function (value) { + var md2html = (marked instanceof Function) ? marked : marked.default; + return value + ? $sanitize(md2html(value.trim())) + : ''; + }; + return { + restrict: 'AE', + scope: { + markdownIt: '=' + }, + replace: true, + link: function (scope, element, attrs) { + if (attrs[attribute]) { + scope.$watch(attribute, function (value) { + element.html(render(value)); + }); + } + else { + element.html(render(element.text())); + } + } + }; + }; + help.directive('markdownIt', ['$sanitize', MarkdownItDirective]); + var mapNode = function (tocNode) { + return tocNode && Object.keys(tocNode).map(function (key) { + return __assign({}, tocNode[key], { href: "#/help/" + tocNode[key]['versions']['current']['path'], nodes: mapNode(tocNode[key].nodes) }); + }); + }; + var HelpController = /** @class */ (function () { + function HelpController($scope, $rootScope, $state, $timeout, helpService) { + var _this = this; + this.$scope = $scope; + this.$state = $state; + this.$timeout = $timeout; + this.helpService = helpService; + this._content = "## Loading"; + this._path = ''; + this._toc = {}; + + $rootScope.section_logo = 'src/app/help/images/help.png'; + + helpService.getTableOfContents().then(function (toc) { + _this._toc = { nodes: mapNode(toc) }; + if (!$state.params.path) { + $state.go('main.help', { path: toc['sdnr']['versions']['current']['path'] }); + } + else { + _this.navigateTo($state.params.path); + } + }); + } + Object.defineProperty(HelpController.prototype, "content", { + get: function () { return this._content; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(HelpController.prototype, "path", { + get: function () { return this._path; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(HelpController.prototype, "toc", { + get: function () { return this._toc; }, + enumerable: true, + configurable: true + }); + HelpController.prototype.navigateTo = function (path) { + var _this = this; + this.helpService.getDocument(path).then(function (result) { + currentDoc = path; + currentPath = result.basePath; + _this._content = result.document; + }); + }; + return HelpController; + }()); + help.controller('helpCtrl', ['$scope', '$rootScope', '$state', '$timeout', 'helpService', HelpController]); +}); +//# source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mICghJHN0YXRlLnBhcmFtcy5wYXRoKSB7XG4gICAgICAgICRzdGF0ZS5nbygnbWFpbi5oZWxwJywgeyBwYXRoOiB0b2NbJ29wZW5kYXlsaWdodCddWyd2ZXJzaW9ucyddWydjdXJyZW50J11bJ3BhdGgnXSB9KVxuICAgICAgfSBlbHNlIHtcbiAgICAgICAgdGhpcy5uYXZpZ2F0ZVRvKCRzdGF0ZS5wYXJhbXMucGF0aCk7XG4gICAgICB9XG4gICAgfSk7XG4gIH1cblxuICBwdWJsaWMgZ2V0IGNvbnRlbnQoKSB7IHJldHVybiB0aGlzLl9jb250ZW50OyB9XG4gIHB1YmxpYyBnZXQgcGF0aCgpIHsgcmV0dXJuIHRoaXMuX3BhdGg7IH1cbiAgcHVibGljIGdldCB0b2MoKSB7IHJldHVybiB0aGlzLl90b2M7IH1cblxuICBwcml2YXRlIG5hdmlnYXRlVG8ocGF0aDogc3RyaW5nKTogdm9pZCB7XG4gICAgdGhpcy5oZWxwU2VydmljZS5nZXREb2N1bWVudChwYXRoKS50aGVuKChyZXN1bHQpID0+IHtcbiAgICAgIGN1cnJlbnREb2MgPSBwYXRoO1xuICAgICAgY3VycmVudFBhdGggPSByZXN1bHQuYmFzZVBhdGg7XG4gICAgICB0aGlzLl9jb250ZW50ID0gcmVzdWx0LmRvY3VtZW50O1xuICAgIH0pO1xuICB9XG5cbn1cblxuaGVscC5jb250cm9sbGVyKCdoZWxwQ3RybCcsIFsnJHNjb3BlJywgJyRzdGF0ZScsICckdGltZW91dCcsICdoZWxwU2VydmljZScsIEhlbHBDb250cm9sbGVyIF0pOyJdfQ==
\ No newline at end of file diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-module/src/main/resources/help/help.controller.ts b/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-module/src/main/resources/help/help.controller.ts new file mode 100644 index 00000000..5a12bbfe --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-module/src/main/resources/help/help.controller.ts @@ -0,0 +1,130 @@ +declare var angular: angular.IAngularStatic; + +import * as marked from "./lib/marked"; + +import "./help.tree"; +import "./help.service"; + +import { IHelpService , TocNodeCollection } from "./help.service"; +import { resolvePath } from './help.utilities'; +import { Node } from "./help.tree"; + +let currentPath = '/help'; +let currentDoc = ''; + +const renderer = new marked.Renderer(); + +renderer.link = (href: string, title: string, text: string) => { + // check if href is rel or abs + const absUrlMatch = href.trim().match(/^https?:\/\//i); + return `<a href="${absUrlMatch ? href : resolvePath('#/help/', currentDoc, href)}" title="${title}" >${text}</a>` +}; + +renderer.image = (href: string, title: string, text: string) => { + return `<img src="${resolvePath(currentPath, href)}" alt="${title}" />` +}; + +marked.setOptions({ + renderer: renderer, + gfm: true, + tables: true, + breaks: false, + pedantic: false, + sanitize: false, + smartLists: true, + smartypants: false, + xhtml: false +}); + +const help = angular.module('app.help'); + +const HelpDirective = () => { + + return { + restrict: 'AE', + template: `<div class="global-help" ><a href="{{ '#/help/'+ link }}"><i class="fa fa-question-circle"></i> Help</a></div>`, + scope: { + link: '@' + }, + replace: true + }; +} + +help.directive('help', [HelpDirective]); + +const MarkdownItDirective = ($sanitize: angular.sanitize.ISanitizeService) => { + const attribute = 'markdownIt'; + + const render = function (value) { + const md2html = (marked instanceof Function) ? marked : marked.default; + return value + ? $sanitize(md2html(value.trim())) + : ''; + }; + + return { + restrict: 'AE', + scope: { + markdownIt: '=' + }, + replace: true, + link: function (scope, element, attrs) { + if (attrs[attribute]) { + scope.$watch(attribute, function (value) { + element.html(render(value)); + }); + } else { + element.html(render(element.text())); + } + } + }; +} + +help.directive('markdownIt', ['$sanitize', MarkdownItDirective]); + +interface IHelpScope extends angular.IScope { + toc: TocNodeCollection +} + +const mapNode = (tocNode: TocNodeCollection): Node[] => { + return tocNode && Object.keys(tocNode).map(key => { + return { + ...tocNode[key], + href: `#/help/${tocNode[key]['versions']['current']['path']}`, + nodes: mapNode(tocNode[key].nodes) + }; + }); +}; + +class HelpController { + private _content = "## Loading"; + private _path = ''; + private _toc : Node = { }; + + constructor(private $scope: IHelpScope, private $state, private $timeout: angular.ITimeoutService, private helpService: IHelpService) { + + helpService.getTableOfContents().then(toc => { + this._toc = { nodes: mapNode(toc) } ; + if (!$state.params.path) { + $state.go('main.help', { path: toc['sdnr']['versions']['current']['path'] }) + } else { + this.navigateTo($state.params.path); + } + }); + } + + public get content() { return this._content; } + public get path() { return this._path; } + public get toc() { return this._toc; } + + private navigateTo(path: string): void { + this.helpService.getDocument(path).then((result) => { + currentDoc = path; + currentPath = result.basePath; + this._content = result.document; + }); + } + +} + +help.controller('helpCtrl', ['$scope', '$state', '$timeout', 'helpService', HelpController ]);
\ No newline at end of file diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-module/src/main/resources/help/help.custom.css b/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-module/src/main/resources/help/help.custom.css new file mode 100644 index 00000000..d54b5c25 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-module/src/main/resources/help/help.custom.css @@ -0,0 +1,105 @@ +.app-help { + color:azure; +} + +.global-help { + float: left; + margin: 5px; + margin-left: 8px; +} + +.app-help th { + padding: 3px; + border-bottom: #eeeeee solid 1px; +} + +.app-help td { + padding: 2px; +} + +.app-help tbody { + padding: 2px; + border-bottom: #eeeeee solid 1px; + margin-bottom: 20px; +} + +.app-help .toc { + padding-left: 0; + padding-top: 25px; + max-width: 170px; +} + +.app-help a[href^="http://"]:after { + content: "\f08e"; + display: inline-block; + font-family: FontAwesome; + font-weight: normal; + font-style: normal; + text-decoration: none; + padding-left: 3px; +} + +.app-help a[href^="https://"]:after { + content: "\f08e"; + display: inline-block; + font-family: FontAwesome; + font-weight: normal; + font-style: normal; + text-decoration: none; + padding-left: 3px; +} + +.app-help a, .global-help a { + color:azure; + text-decoration: none; +} + +.app-help a:visited, .global-help a:visited { + color:azure; + text-decoration: none; +} + +.app-help a:hover, .global-help a:hover { + color:bisque; +} + +.app-help .toc ul { + margin: 0; + padding: 0; + list-style: none; + border: none; + overflow: hidden; +} + +.app-help .toc li { + line-height: 1.5em; + position: relative; + padding: 0 0 0 20px; +} + +.app-help .toc > tree > ul > li { + padding: 0 +} + +.app-help .toc li a { + color:azure; + text-decoration: none; +} + +.app-help .toc li a:visited { + color:azure; + text-decoration: none; +} + +.app-help .toc li a:hover { + color:bisque; + text-decoration: none; +} + +.app-help > .help { + color:azure; +} + +.app-help > .help img { + width: 100% +}
\ No newline at end of file diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-module/src/main/resources/help/help.module.js b/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-module/src/main/resources/help/help.module.js new file mode 100644 index 00000000..71d43be9 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-module/src/main/resources/help/help.module.js @@ -0,0 +1,33 @@ +define( ["require", "exports"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.help = angular.module('app.help', ['app.core']); + exports.help.config(function ($stateProvider, $compileProvider, $controllerProvider, $provide, NavHelperProvider, $httpProvider, $translateProvider, $translatePartialLoaderProvider) { + //$translatePartialLoaderProvider.addPart('app/help/locale/locale'); + NavHelperProvider.addControllerUrl('app/help/help.controller'); + NavHelperProvider.addToMenu('help', { + "link": "#/help/", + "active": "main.help", + "title": "Help", + "icon": "fa fa-question-circle", + "page": { + "title": "Help", + "description": "help" + } + }); + $stateProvider.state('main.help', { + url: 'help/*path', + access: 2, + views: { + 'content': { + templateUrl: 'src/app/help/help.tpl.html', + controller: 'helpCtrl as vm' + } + } + }); + }); +}); +/* non ES6 export */ +// export = help; +// export default help; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaGVscC5tb2R1bGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJzcmMvYXBwL2hlbHAvaGVscC5tb2R1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0lBRW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3NyYy9hcHAvaGVscC9oZWxwLnRwbC5odG1sJyxcbiAgICAgICAgY29udHJvbGxlcjogJ2hlbHBDdHJsIGFzIHZtJ1xuICAgICAgfVxuICAgIH1cbiAgfSk7XG59KTtcblxuLyogbm9uIEVTNiBleHBvcnQgKi9cbi8vIGV4cG9ydCA9IGhlbHA7ICAgXG4vLyBleHBvcnQgZGVmYXVsdCBoZWxwOyJdfQ== diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-module/src/main/resources/help/help.module.ts b/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-module/src/main/resources/help/help.module.ts new file mode 100644 index 00000000..d3acc645 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-module/src/main/resources/help/help.module.ts @@ -0,0 +1,35 @@ +declare var angular: angular.IAngularStatic; + +export const help = angular.module('app.help', ['app.core']); + +help.config(function ($stateProvider, $compileProvider, $controllerProvider, $provide, NavHelperProvider, $httpProvider, $translateProvider, $translatePartialLoaderProvider) { + + //$translatePartialLoaderProvider.addPart('app/help/locale/locale'); + + NavHelperProvider.addControllerUrl('app/help/help.controller'); + NavHelperProvider.addToMenu('help', { + "link": "#/help/", + "active": "main.help", + "title": "Help", + "icon": "fa fa-question-circle", // Add navigation icon css class here + "page": { + "title": "MWTN Demo", + "description": "help" + } + }); + + $stateProvider.state('main.help', { + url: 'help/*path', + access: 2, + views: { + 'content': { + templateUrl: 'src/app/help/help.tpl.html', + controller: 'helpCtrl as vm' + } + } + }); +}); + +/* non ES6 export */ +// export = help; +// export default help;
\ No newline at end of file diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-module/src/main/resources/help/help.service.ts b/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-module/src/main/resources/help/help.service.ts new file mode 100644 index 00000000..f09ec7b7 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-module/src/main/resources/help/help.service.ts @@ -0,0 +1,92 @@ +import * as angular from 'angularAMD'; + +const help = angular.module('app.help'); + +export interface VersionInfo { + label: string, + path: string, + date: string +} + +export interface TocNode { + label: string; + versions: { + [versionKey: string]: VersionInfo + }; + nodes?: TocNodeCollection; +} + +export type TocNodeCollection = { [tocNodeKey: string]: TocNode }; + + +interface IEnv { + getBaseURL: (salType: 'AD_SAL' | 'MD_SAL') => string; +} + +/** Represents a service used for the help application. */ +export interface IHelpService { + + /** + * Queries the table of contents for a specific version. + * @param version The version the table of contents shall be requested for. + * @returns A Promise containing the requested table of contents. + * + */ + getTableOfContents(version?: string): angular.IPromise<TocNodeCollection>; + + /** + * Get a specitic document by its path. + * @param path The path of the document to get. + * @returns A Promise containing the requested document. + * + */ + getDocument(path: string): angular.IPromise<{ basePath: string, document: string }>; +} + +class Helpservice implements IHelpService { + + private tocNodeCollection: TocNodeCollection; + private documents: { [path: string]: { basePath: string, document: string } }; + + constructor(private $q: angular.IQService, private $http: angular.IHttpService, private env: IEnv) { + this.tocNodeCollection = null; + this.documents = {}; + } + + public getTableOfContents(): angular.IPromise<TocNodeCollection> { + if (this.tocNodeCollection) { + return this.$q.resolve(this.tocNodeCollection); + } + + return this.$http({ + method: "GET", + url: `${this.env.getBaseURL('MD_SAL')}/help/?meta` + }).then((result: angular.IHttpResponse<TocNodeCollection>) => { + if (result.status === 200) { + this.tocNodeCollection = result.data; + return result.data; + } + }); + } + + public getDocument(path: string): angular.IPromise<{basePath: string, document: string}> { + if (this.documents[path] != null) { + return this.$q.resolve(this.documents[path]); + } + + return this.$http({ + method: "GET", + url: `${this.env.getBaseURL('MD_SAL')}/help/${path}` + }).then((result: angular.IHttpResponse<string>) => { + if (result.status === 200) { + return this.documents[path] = { + basePath: result.config && result.config.url && result.config.url, + document: result.data + }; + } + }); + + } +} + +help.service('helpService', ['$q', '$http', 'ENV', Helpservice]);
\ No newline at end of file diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-module/src/main/resources/help/help.tpl.html b/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-module/src/main/resources/help/help.tpl.html new file mode 100644 index 00000000..6c2970c8 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-module/src/main/resources/help/help.tpl.html @@ -0,0 +1,17 @@ +<ht-header help-link='sdnr/0.4.0/README.md'></ht-header> + +<div class="app-help"> + + <div class="toc col-sm-12 col-md-2"> + <tree root-node= "vm.toc" > + <a href="{{rootNode.href}}" >{{ rootNode.label }}</a> + </tree> + </div> + + <div markdown-it="vm.content" class="help col-sm-12 col-md-10" ></div> + +</div> +<hr class="col-sm-12"/> +<div class="owl col-sm-12"> + <span class="white">ONAP SDN-R | ONF Wireless - Build: @buildtime@</span> +</div>
\ No newline at end of file diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-module/src/main/resources/help/help.tree.html b/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-module/src/main/resources/help/help.tree.html new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-module/src/main/resources/help/help.tree.html diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-module/src/main/resources/help/help.tree.ts b/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-module/src/main/resources/help/help.tree.ts new file mode 100644 index 00000000..3d142804 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-module/src/main/resources/help/help.tree.ts @@ -0,0 +1,55 @@ +import * as angular from 'angularAMD'; + +export interface Node { + label?: string, + nodes?: Node[], + versions?: { + [version: string]: { + label: string, + date: string, + path: string + } + } +} + +const help = angular.module('app.help'); + +// class HelpTreeController implements ng.IController { +// constructor(private $scope: ng.IScope & { rootNode: Node, data: Node[]}) { +// $scope.$watch("rootNode", (n, o) => { +// $scope.data = Object.keys($scope.rootNode).map(key => $scope.rootNode[key]); +// }); +// } +// } + +// help.controller("treeCtrl", ["$scope", HelpTreeController]); + +const helpTree = function ($compile) { + return { + restrict: "E", + transclude: true, + scope: { rootNode: '=' }, + //controller: 'treeCtrl', + template: + '<ul>' + + '<li ng-transclude></li>' + + '<li ng-repeat="child in rootNode.nodes">' + + '<tree root-node="child"><div ng-transclude></div></tree>' + + '</li>' + + '</ul>', + compile: function (tElement, tAttr, transclude) { + var contents = tElement.contents().remove(); + var compiledContents; + return function (scope, iElement, iAttr) { + if (!compiledContents) { + compiledContents = $compile(contents, transclude); + } + compiledContents(scope, function (clone, scope) { + iElement.append(clone); + }); + }; + } + }; +}; + +help.directive("tree", ["$compile", helpTree]);
\ No newline at end of file diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-module/src/main/resources/help/help.utilities.ts b/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-module/src/main/resources/help/help.utilities.ts new file mode 100644 index 00000000..ec34b624 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-module/src/main/resources/help/help.utilities.ts @@ -0,0 +1,63 @@ +export var resolvePath = function (...paths: string[]): string { + console.log(paths); + function resolve(pathA, pathB) { + // ‘a’ => ['a'] + // 'a/b' => ['a', 'b'] + // '/a/b' => ['', 'a', 'b'] + // '/a/b/' => ['', 'a', 'b', ''] + pathB = pathB.split('/'); + if (pathB[0] === '') { + return pathB.join('/'); + } + pathA = pathA.split('/'); + var aLastIndex = pathA.length - 1; + if (pathA[aLastIndex] !== '') { + pathA[aLastIndex] = ''; + } + + var part; + var i = 0; + while (typeof (part = pathB[i]) === 'string') { + switch (part) { + case '..': + pathA.pop(); + pathA.pop(); + pathA.push(''); + break; + case '.': + pathA.pop(); + pathA.push(''); + break; + default: + pathA.pop(); + pathA.push(part); + pathA.push(''); + break; + } + i++; + } + if (pathB[pathB.length - 1] !== '') pathA.pop(); + return pathA.join('/'); + } + + var i = 0; + var path; + var r = location.pathname; + + const urlRegex = /^https?\:\/\/([^\/?#]+)(?:[\/?#]|$)/i; + const multiSlashReg = /\/\/+/g; + + while (typeof (path = paths[i]) === 'string') { + // debugger; + const matches = path && path.match(urlRegex); + if (matches || !i) { + r = path; + } else { + path = path.replace(multiSlashReg, '/'); + r = resolve(r, path); + } + i++; + } + + return r; +};
\ No newline at end of file diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-module/src/main/resources/help/images/help.png b/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-module/src/main/resources/help/images/help.png Binary files differnew file mode 100755 index 00000000..5ca1f1cc --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-module/src/main/resources/help/images/help.png diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-module/src/main/resources/help/lib/marked.d.ts b/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-module/src/main/resources/help/lib/marked.d.ts new file mode 100644 index 00000000..74a11ae8 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-module/src/main/resources/help/lib/marked.d.ts @@ -0,0 +1,284 @@ +// Type definitions for Marked 0.3 +// Project: https://github.com/chjj/marked +// Definitions by: William Orr <https://github.com/worr> +// BendingBender <https://github.com/BendingBender> +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare var marked : marked.markedStatic; + +export as namespace marked; + +export = marked; + +declare namespace marked { + /** + * Compiles markdown to HTML. + * + * @param src String of markdown source to be compiled + * @param callback Function called when the markdownString has been fully parsed when using async highlighting + * @return String of compiled HTML + */ + function markedStatic(src: string, callback: (error: any | undefined, parseResult: string) => void): string; + + /** + * Compiles markdown to HTML. + * + * @param src String of markdown source to be compiled + * @param options Hash of options + * @param callback Function called when the markdownString has been fully parsed when using async highlighting + * @return String of compiled HTML + */ + function markedStatic(src: string, options?: marked.MarkedOptions, callback?: (error: any | undefined, parseResult: string) => void): string; + + /** + * @param src String of markdown source to be compiled + * @param options Hash of options + */ + function lexer(src: string, options?: MarkedOptions): TokensList; + + /** + * Compiles markdown to HTML. + * + * @param src String of markdown source to be compiled + * @param callback Function called when the markdownString has been fully parsed when using async highlighting + * @return String of compiled HTML + */ + function parse(src: string, callback: (error: any | undefined, parseResult: string) => void): string; + + /** + * Compiles markdown to HTML. + * + * @param src String of markdown source to be compiled + * @param options Hash of options + * @param callback Function called when the markdownString has been fully parsed when using async highlighting + * @return String of compiled HTML + */ + function parse(src: string, options?: MarkedOptions, callback?: (error: any | undefined, parseResult: string) => void): string; + + /** + * @param src Tokenized source as array of tokens + * @param options Hash of options + */ + function parser(src: TokensList, options?: MarkedOptions): string; + + /** + * Sets the default options. + * + * @param options Hash of options + */ + function setOptions(options: MarkedOptions): typeof marked; + + class Renderer { + constructor(options?: MarkedOptions); + code(code: string, language: string, isEscaped: boolean): string; + blockquote(quote: string): string; + html(html: string): string; + heading(text: string, level: number, raw: string): string; + hr(): string; + list(body: string, ordered: boolean): string; + listitem(text: string): string; + paragraph(text: string): string; + table(header: string, body: string): string; + tablerow(content: string): string; + tablecell(content: string, flags: { + header: boolean; + align: 'center' | 'left' | 'right' | null; + }): string; + strong(text: string): string; + em(text: string): string; + codespan(code: string): string; + br(): string; + del(text: string): string; + link(href: string, title: string, text: string): string; + image(href: string, title: string, text: string): string; + text(text: string): string; + } + + class Lexer { + rules: Rules; + tokens: TokensList; + constructor(options?: MarkedOptions); + lex(src: string): TokensList; + } + + interface Rules { + [ruleName: string]: RegExp | Rules; + } + + type TokensList = Token[] & { + links: { + [key: string]: { href: string; title: string; } + } + }; + + type Token = + Tokens.Space + | Tokens.Code + | Tokens.Heading + | Tokens.Table + | Tokens.Hr + | Tokens.BlockquoteStart + | Tokens.BlockquoteEnd + | Tokens.ListStart + | Tokens.LooseItemStart + | Tokens.ListItemStart + | Tokens.ListItemEnd + | Tokens.ListEnd + | Tokens.Paragraph + | Tokens.HTML + | Tokens.Text; + + namespace Tokens { + interface Space { + type: 'space'; + } + + interface Code { + type: 'code'; + lang?: string; + text: string; + } + + interface Heading { + type: 'heading'; + depth: number; + text: string; + } + + interface Table { + type: 'table'; + header: string[]; + align: Array<'center' | 'left' | 'right' | null>; + cells: string[][]; + } + + interface Hr { + type: 'hr'; + } + + interface BlockquoteStart { + type: 'blockquote_start'; + } + + interface BlockquoteEnd { + type: 'blockquote_end'; + } + + interface ListStart { + type: 'list_start'; + ordered: boolean; + } + + interface LooseItemStart { + type: 'loose_item_start'; + } + + interface ListItemStart { + type: 'list_item_start'; + } + + interface ListItemEnd { + type: 'list_item_end'; + } + + interface ListEnd { + type: 'list_end'; + } + + interface Paragraph { + type: 'paragraph'; + pre?: boolean; + text: string; + } + + interface HTML { + type: 'html'; + pre: boolean; + text: string; + } + + interface Text { + type: 'text'; + text: string; + } + } + + interface MarkedOptions { + /** + * Type: object Default: new Renderer() + * + * An object containing functions to render tokens to HTML. + */ + renderer?: Renderer; + + /** + * Enable GitHub flavored markdown. + */ + gfm?: boolean; + + /** + * Enable GFM tables. This option requires the gfm option to be true. + */ + tables?: boolean; + + /** + * Enable GFM line breaks. This option requires the gfm option to be true. + */ + breaks?: boolean; + + /** + * Conform to obscure parts of markdown.pl as much as possible. Don't fix any of the original markdown bugs or poor behavior. + */ + pedantic?: boolean; + + /** + * Sanitize the output. Ignore any HTML that has been input. + */ + sanitize?: boolean; + + /** + * Optionally sanitize found HTML with a sanitizer function. + */ + sanitizer?(html: string): string; + + /** + * Mangle autolinks (<email@domain.com>). + */ + mangle?: boolean; + + /** + * Use smarter list behavior than the original markdown. May eventually be default with the old behavior moved into pedantic. + */ + smartLists?: boolean; + + /** + * Shows an HTML error message when rendering fails. + */ + silent?: boolean; + + /** + * A function to highlight code blocks. The function takes three arguments: code, lang, and callback. + */ + highlight?(code: string, lang: string, callback?: (error: any | undefined, code: string) => void): string; + + /** + * Set the prefix for code block classes. + */ + langPrefix?: string; + + /** + * Use "smart" typograhic punctuation for things like quotes and dashes. + */ + smartypants?: boolean; + + /** + * Set the prefix for header tag ids. + */ + headerPrefix?: string; + + /** + * Generate closing slash for self-closing tags (<br/> instead of <br>) + */ + xhtml?: boolean; + } +} diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-module/src/main/resources/help/lib/marked.js b/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-module/src/main/resources/help/lib/marked.js new file mode 100644 index 00000000..04386a6c --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/help/help-module/src/main/resources/help/lib/marked.js @@ -0,0 +1,1320 @@ +/** + * marked - a markdown parser + * Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed) + * https://github.com/chjj/marked + */ + +; (function () { + 'use strict'; + + /** + * Block-Level Grammar + */ + + var block = { + newline: /^\n+/, + code: /^( {4}[^\n]+\n*)+/, + fences: noop, + hr: /^( *[-*_]){3,} *(?:\n+|$)/, + heading: /^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/, + nptable: noop, + lheading: /^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/, + blockquote: /^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/, + list: /^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/, + html: /^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/, + def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/, + table: noop, + paragraph: /^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/, + text: /^[^\n]+/ + }; + + block.bullet = /(?:[*+-]|\d+\.)/; + block.item = /^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/; + block.item = replace(block.item, 'gm') + (/bull/g, block.bullet) + (); + + block.list = replace(block.list) + (/bull/g, block.bullet) + ('hr', '\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))') + ('def', '\\n+(?=' + block.def.source + ')') + (); + + block.blockquote = replace(block.blockquote) + ('def', block.def) + (); + + block._tag = '(?!(?:' + + 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code' + + '|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo' + + '|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b'; + + block.html = replace(block.html) + ('comment', /<!--[\s\S]*?-->/) + ('closed', /<(tag)[\s\S]+?<\/\1>/) + ('closing', /<tag(?:"[^"]*"|'[^']*'|[^'">])*?>/) + (/tag/g, block._tag) + (); + + block.paragraph = replace(block.paragraph) + ('hr', block.hr) + ('heading', block.heading) + ('lheading', block.lheading) + ('blockquote', block.blockquote) + ('tag', '<' + block._tag) + ('def', block.def) + (); + + /** + * Normal Block Grammar + */ + + block.normal = merge({}, block); + + /** + * GFM Block Grammar + */ + + block.gfm = merge({}, block.normal, { + fences: /^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\s*\1 *(?:\n+|$)/, + paragraph: /^/, + heading: /^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/ + }); + + block.gfm.paragraph = replace(block.paragraph) + ('(?!', '(?!' + + block.gfm.fences.source.replace('\\1', '\\2') + '|' + + block.list.source.replace('\\1', '\\3') + '|') + (); + + /** + * GFM + Tables Block Grammar + */ + + block.tables = merge({}, block.gfm, { + nptable: /^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/, + table: /^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/ + }); + + /** + * Block Lexer + */ + + function Lexer(options) { + this.tokens = []; + this.tokens.links = {}; + this.options = options || marked.defaults; + this.rules = block.normal; + + if (this.options.gfm) { + if (this.options.tables) { + this.rules = block.tables; + } else { + this.rules = block.gfm; + } + } + } + + /** + * Expose Block Rules + */ + + Lexer.rules = block; + + /** + * Static Lex Method + */ + + Lexer.lex = function (src, options) { + var lexer = new Lexer(options); + return lexer.lex(src); + }; + + /** + * Preprocessing + */ + + Lexer.prototype.lex = function (src) { + src = src + .replace(/\r\n|\r/g, '\n') + .replace(/\t/g, ' ') + .replace(/\u00a0/g, ' ') + .replace(/\u2424/g, '\n'); + + return this.token(src, true); + }; + + /** + * Lexing + */ + + Lexer.prototype.token = function (src, top, bq) { + var src = src.replace(/^ +$/gm, '') + , next + , loose + , cap + , bull + , b + , item + , space + , i + , l; + + while (src) { + // newline + if (cap = this.rules.newline.exec(src)) { + src = src.substring(cap[0].length); + if (cap[0].length > 1) { + this.tokens.push({ + type: 'space' + }); + } + } + + // code + if (cap = this.rules.code.exec(src)) { + src = src.substring(cap[0].length); + cap = cap[0].replace(/^ {4}/gm, ''); + this.tokens.push({ + type: 'code', + text: !this.options.pedantic + ? cap.replace(/\n+$/, '') + : cap + }); + continue; + } + + // fences (gfm) + if (cap = this.rules.fences.exec(src)) { + src = src.substring(cap[0].length); + this.tokens.push({ + type: 'code', + lang: cap[2], + text: cap[3] || '' + }); + continue; + } + + // heading + if (cap = this.rules.heading.exec(src)) { + src = src.substring(cap[0].length); + this.tokens.push({ + type: 'heading', + depth: cap[1].length, + text: cap[2] + }); + continue; + } + + // table no leading pipe (gfm) + if (top && (cap = this.rules.nptable.exec(src))) { + src = src.substring(cap[0].length); + + item = { + type: 'table', + header: cap[1].replace(/^ *| *\| *$/g, '').split(/ *\| */), + align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */), + cells: cap[3].replace(/\n$/, '').split('\n') + }; + + for (i = 0; i < item.align.length; i++) { + if (/^ *-+: *$/.test(item.align[i])) { + item.align[i] = 'right'; + } else if (/^ *:-+: *$/.test(item.align[i])) { + item.align[i] = 'center'; + } else if (/^ *:-+ *$/.test(item.align[i])) { + item.align[i] = 'left'; + } else { + item.align[i] = null; + } + } + + for (i = 0; i < item.cells.length; i++) { + item.cells[i] = item.cells[i].split(/ *\| */); + } + + this.tokens.push(item); + + continue; + } + + // lheading + if (cap = this.rules.lheading.exec(src)) { + src = src.substring(cap[0].length); + this.tokens.push({ + type: 'heading', + depth: cap[2] === '=' ? 1 : 2, + text: cap[1] + }); + continue; + } + + // hr + if (cap = this.rules.hr.exec(src)) { + src = src.substring(cap[0].length); + this.tokens.push({ + type: 'hr' + }); + continue; + } + + // blockquote + if (cap = this.rules.blockquote.exec(src)) { + src = src.substring(cap[0].length); + + this.tokens.push({ + type: 'blockquote_start' + }); + + cap = cap[0].replace(/^ *> ?/gm, ''); + + // Pass `top` to keep the current + // "toplevel" state. This is exactly + // how markdown.pl works. + this.token(cap, top, true); + + this.tokens.push({ + type: 'blockquote_end' + }); + + continue; + } + + // list + if (cap = this.rules.list.exec(src)) { + src = src.substring(cap[0].length); + bull = cap[2]; + + this.tokens.push({ + type: 'list_start', + ordered: bull.length > 1 + }); + + // Get each top-level item. + cap = cap[0].match(this.rules.item); + + next = false; + l = cap.length; + i = 0; + + for (; i < l; i++) { + item = cap[i]; + + // Remove the list item's bullet + // so it is seen as the next token. + space = item.length; + item = item.replace(/^ *([*+-]|\d+\.) +/, ''); + + // Outdent whatever the + // list item contains. Hacky. + if (~item.indexOf('\n ')) { + space -= item.length; + item = !this.options.pedantic + ? item.replace(new RegExp('^ {1,' + space + '}', 'gm'), '') + : item.replace(/^ {1,4}/gm, ''); + } + + // Determine whether the next list item belongs here. + // Backpedal if it does not belong in this list. + if (this.options.smartLists && i !== l - 1) { + b = block.bullet.exec(cap[i + 1]) [0]; + if (bull !== b && !(bull.length > 1 && b.length > 1)) { + src = cap.slice(i + 1).join('\n') + src; + i = l - 1; + } + } + + // Determine whether item is loose or not. + // Use: /(^|\n)(?! )[^\n]+\n\n(?!\s*$)/ + // for discount behavior. + loose = next || /\n\n(?!\s*$)/.test(item); + if (i !== l - 1) { + next = item.charAt(item.length - 1) === '\n'; + if (!loose) loose = next; + } + + this.tokens.push({ + type: loose + ? 'loose_item_start' + : 'list_item_start' + }); + + // Recurse. + this.token(item, false, bq); + + this.tokens.push({ + type: 'list_item_end' + }); + } + + this.tokens.push({ + type: 'list_end' + }); + + continue; + } + + // html + if (cap = this.rules.html.exec(src)) { + src = src.substring(cap[0].length); + this.tokens.push({ + type: this.options.sanitize + ? 'paragraph' + : 'html', + pre: !this.options.sanitizer + && (cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style'), + text: cap[0] + }); + continue; + } + + // def + if ((!bq && top) && (cap = this.rules.def.exec(src))) { + src = src.substring(cap[0].length); + this.tokens.links[cap[1].toLowerCase()] = { + href: cap[2], + title: cap[3] + }; + continue; + } + + // table (gfm) + if (top && (cap = this.rules.table.exec(src))) { + src = src.substring(cap[0].length); + + item = { + type: 'table', + header: cap[1].replace(/^ *| *\| *$/g, '').split(/ *\| */), + align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */), + cells: cap[3].replace(/(?: *\| *)?\n$/, '').split('\n') + }; + + for (i = 0; i < item.align.length; i++) { + if (/^ *-+: *$/.test(item.align[i])) { + item.align[i] = 'right'; + } else if (/^ *:-+: *$/.test(item.align[i])) { + item.align[i] = 'center'; + } else if (/^ *:-+ *$/.test(item.align[i])) { + item.align[i] = 'left'; + } else { + item.align[i] = null; + } + } + + for (i = 0; i < item.cells.length; i++) { + item.cells[i] = item.cells[i] + .replace(/^ *\| *| *\| *$/g, '') + .split(/ *\| */); + } + + this.tokens.push(item); + + continue; + } + + // top-level paragraph + if (top && (cap = this.rules.paragraph.exec(src))) { + src = src.substring(cap[0].length); + this.tokens.push({ + type: 'paragraph', + text: cap[1].charAt(cap[1].length - 1) === '\n' + ? cap[1].slice(0, -1) + : cap[1] + }); + continue; + } + + // text + if (cap = this.rules.text.exec(src)) { + // Top-level should never reach here. + src = src.substring(cap[0].length); + this.tokens.push({ + type: 'text', + text: cap[0] + }); + continue; + } + + if (src) { + throw new + Error('Infinite loop on byte: ' + src.charCodeAt(0)); + } + } + + return this.tokens; + }; + + /** + * Inline-Level Grammar + */ + + var inline = { + escape: /^\\([\\`*{}\[\]()#+\-.!_>])/, + autolink: /^<([^ <>]+(@|:\/)[^ <>]+)>/, + url: noop, + tag: /^<!--[\s\S]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^<'">])*?>/, + link: /^!?\[(inside)\]\(href\)/, + reflink: /^!?\[(inside)\]\s*\[([^\]]*)\]/, + nolink: /^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/, + strong: /^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/, + em: /^\b_((?:[^_]|__)+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/, + code: /^(`+)([\s\S]*?[^`])\1(?!`)/, + br: /^ {2,}\n(?!\s*$)/, + del: noop, + text: /^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/ + }; + + inline._inside = /(?:\[[^\]]*\]|\\[\[\]]|[^\[\]]|\](?=[^\[]*\]))*/; + inline._href = /\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/; + + inline.link = replace(inline.link) + ('inside', inline._inside) + ('href', inline._href) + (); + + inline.reflink = replace(inline.reflink) + ('inside', inline._inside) + (); + + /** + * Normal Inline Grammar + */ + + inline.normal = merge({}, inline); + + /** + * Pedantic Inline Grammar + */ + + inline.pedantic = merge({}, inline.normal, { + strong: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/, + em: /^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/ + }); + + /** + * GFM Inline Grammar + */ + + inline.gfm = merge({}, inline.normal, { + escape: replace(inline.escape)('])', '~|])')(), + url: /^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/, + del: /^~~(?=\S)([\s\S]*?\S)~~/, + text: replace(inline.text) + (']|', '~]|') + ('|', '|https?://|') + () + }); + + /** + * GFM + Line Breaks Inline Grammar + */ + + inline.breaks = merge({}, inline.gfm, { + br: replace(inline.br)('{2,}', '*')(), + text: replace(inline.gfm.text)('{2,}', '*')() + }); + + /** + * Inline Lexer & Compiler + */ + + function InlineLexer(links, options) { + this.options = options || marked.defaults; + this.links = links; + this.rules = inline.normal; + this.renderer = this.options.renderer || new Renderer; + this.renderer.options = this.options; + + if (!this.links) { + throw new + Error('Tokens array requires a `links` property.'); + } + + if (this.options.gfm) { + if (this.options.breaks) { + this.rules = inline.breaks; + } else { + this.rules = inline.gfm; + } + } else if (this.options.pedantic) { + this.rules = inline.pedantic; + } + } + + /** + * Expose Inline Rules + */ + + InlineLexer.rules = inline; + + /** + * Static Lexing/Compiling Method + */ + + InlineLexer.output = function (src, links, options) { + var inline = new InlineLexer(links, options); + return inline.output(src); + }; + + /** + * Lexing/Compiling + */ + + InlineLexer.prototype.output = function (src) { + var out = '' + , link + , text + , href + , cap; + + while (src) { + // escape + if (cap = this.rules.escape.exec(src)) { + src = src.substring(cap[0].length); + out += cap[1]; + continue; + } + + // autolink + if (cap = this.rules.autolink.exec(src)) { + src = src.substring(cap[0].length); + if (cap[2] === '@') { + text = escape( + cap[1].charAt(6) === ':' + ? this.mangle(cap[1].substring(7)) + : this.mangle(cap[1]) + ); + href = this.mangle('mailto:') + text; + } else { + text = escape(cap[1]); + href = text; + } + out += this.renderer.link(href, null, text); + continue; + } + + // url (gfm) + if (!this.inLink && (cap = this.rules.url.exec(src))) { + src = src.substring(cap[0].length); + text = escape(cap[1]); + href = text; + out += this.renderer.link(href, null, text); + continue; + } + + // tag + if (cap = this.rules.tag.exec(src)) { + if (!this.inLink && /^<a /i.test(cap[0])) { + this.inLink = true; + } else if (this.inLink && /^<\/a>/i.test(cap[0])) { + this.inLink = false; + } + src = src.substring(cap[0].length); + out += this.options.sanitize + ? this.options.sanitizer + ? this.options.sanitizer(cap[0]) + : escape(cap[0]) + : cap[0] + continue; + } + + // link + if (cap = this.rules.link.exec(src)) { + src = src.substring(cap[0].length); + this.inLink = true; + out += this.outputLink(cap, { + href: cap[2], + title: cap[3] + }); + this.inLink = false; + continue; + } + + // reflink, nolink + if ((cap = this.rules.reflink.exec(src)) + || (cap = this.rules.nolink.exec(src))) { + src = src.substring(cap[0].length); + link = (cap[2] || cap[1]).replace(/\s+/g, ' '); + link = this.links[link.toLowerCase()]; + if (!link || !link.href) { + out += cap[0].charAt(0); + src = cap[0].substring(1) + src; + continue; + } + this.inLink = true; + out += this.outputLink(cap, link); + this.inLink = false; + continue; + } + + // strong + if (cap = this.rules.strong.exec(src)) { + src = src.substring(cap[0].length); + out += this.renderer.strong(this.output(cap[2] || cap[1])); + continue; + } + + // em + if (cap = this.rules.em.exec(src)) { + src = src.substring(cap[0].length); + out += this.renderer.em(this.output(cap[2] || cap[1])); + continue; + } + + // code + if (cap = this.rules.code.exec(src)) { + src = src.substring(cap[0].length); + out += this.renderer.codespan(escape(cap[2].trim(), true)); + continue; + } + + // br + if (cap = this.rules.br.exec(src)) { + src = src.substring(cap[0].length); + out += this.renderer.br(); + continue; + } + + // del (gfm) + if (cap = this.rules.del.exec(src)) { + src = src.substring(cap[0].length); + out += this.renderer.del(this.output(cap[1])); + continue; + } + + // text + if (cap = this.rules.text.exec(src)) { + src = src.substring(cap[0].length); + out += this.renderer.text(escape(this.smartypants(cap[0]))); + continue; + } + + if (src) { + throw new + Error('Infinite loop on byte: ' + src.charCodeAt(0)); + } + } + + return out; + }; + + /** + * Compile Link + */ + + InlineLexer.prototype.outputLink = function (cap, link) { + var href = escape(link.href) + , title = link.title ? escape(link.title) : null; + + return cap[0].charAt(0) !== '!' + ? this.renderer.link(href, title, this.output(cap[1])) + : this.renderer.image(href, title, escape(cap[1])); + }; + + /** + * Smartypants Transformations + */ + + InlineLexer.prototype.smartypants = function (text) { + if (!this.options.smartypants) return text; + return text + // em-dashes + .replace(/---/g, '\u2014') + // en-dashes + .replace(/--/g, '\u2013') + // opening singles + .replace(/(^|[-\u2014/(\[{"\s])'/g, '$1\u2018') + // closing singles & apostrophes + .replace(/'/g, '\u2019') + // opening doubles + .replace(/(^|[-\u2014/(\[{\u2018\s])"/g, '$1\u201c') + // closing doubles + .replace(/"/g, '\u201d') + // ellipses + .replace(/\.{3}/g, '\u2026'); + }; + + /** + * Mangle Links + */ + + InlineLexer.prototype.mangle = function (text) { + if (!this.options.mangle) return text; + var out = '' + , l = text.length + , i = 0 + , ch; + + for (; i < l; i++) { + ch = text.charCodeAt(i); + if (Math.random() > 0.5) { + ch = 'x' + ch.toString(16); + } + out += '&#' + ch + ';'; + } + + return out; + }; + + /** + * Renderer + */ + + function Renderer(options) { + this.options = options || {}; + } + + Renderer.prototype.code = function (code, lang, escaped) { + if (this.options.highlight) { + var out = this.options.highlight(code, lang); + if (out != null && out !== code) { + escaped = true; + code = out; + } + } + + if (!lang) { + return '<pre><code>' + + (escaped ? code : escape(code, true)) + + '\n</code></pre>'; + } + + return '<pre><code class="' + + this.options.langPrefix + + escape(lang, true) + + '">' + + (escaped ? code : escape(code, true)) + + '\n</code></pre>\n'; + }; + + Renderer.prototype.blockquote = function (quote) { + return '<blockquote>\n' + quote + '</blockquote>\n'; + }; + + Renderer.prototype.html = function (html) { + return html; + }; + + Renderer.prototype.heading = function (text, level, raw) { + return '<h' + + level + + ' id="' + + this.options.headerPrefix + + raw.toLowerCase().replace(/[^\w]+/g, '-') + + '">' + + text + + '</h' + + level + + '>\n'; + }; + + Renderer.prototype.hr = function () { + return this.options.xhtml ? '<hr/>\n' : '<hr>\n'; + }; + + Renderer.prototype.list = function (body, ordered) { + var type = ordered ? 'ol' : 'ul'; + return '<' + type + '>\n' + body + '</' + type + '>\n'; + }; + + Renderer.prototype.listitem = function (text) { + return '<li>' + text + '</li>\n'; + }; + + Renderer.prototype.paragraph = function (text) { + return '<p>' + text + '</p>\n'; + }; + + Renderer.prototype.table = function (header, body) { + return '<table>\n' + + '<thead>\n' + + header + + '</thead>\n' + + '<tbody>\n' + + body + + '</tbody>\n' + + '</table>\n'; + }; + + Renderer.prototype.tablerow = function (content) { + return '<tr>\n' + content + '</tr>\n'; + }; + + Renderer.prototype.tablecell = function (content, flags) { + var type = flags.header ? 'th' : 'td'; + var tag = flags.align + ? '<' + type + ' style="text-align:' + flags.align + '">' + : '<' + type + '>'; + return tag + content + '</' + type + '>\n'; + }; + + // span level renderer + Renderer.prototype.strong = function (text) { + return '<strong>' + text + '</strong>'; + }; + + Renderer.prototype.em = function (text) { + return '<em>' + text + '</em>'; + }; + + Renderer.prototype.codespan = function (text) { + return '<code>' + text + '</code>'; + }; + + Renderer.prototype.br = function () { + return this.options.xhtml ? '<br/>' : '<br>'; + }; + + Renderer.prototype.del = function (text) { + return '<del>' + text + '</del>'; + }; + + Renderer.prototype.link = function (href, title, text) { + if (this.options.sanitize) { + try { + var prot = decodeURIComponent(unescape(href)) + .replace(/[^\w:]/g, '') + .toLowerCase(); + } catch (e) { + return text; + } + if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0 || prot.indexOf('data:') === 0) { + return text; + } + } + if (this.options.baseUrl && !originIndependentUrl.test(href)) { + href = resolveUrl(this.options.baseUrl, href); + } + var out = '<a href="' + href + '"'; + if (title) { + out += ' title="' + title + '"'; + } + out += '>' + text + '</a>'; + return out; + }; + + Renderer.prototype.image = function (href, title, text) { + if (this.options.baseUrl && !originIndependentUrl.test(href)) { + href = resolveUrl(this.options.baseUrl, href); + } + var out = '<img src="' + href + '" alt="' + text + '"'; + if (title) { + out += ' title="' + title + '"'; + } + out += this.options.xhtml ? '/>' : '>'; + return out; + }; + + Renderer.prototype.text = function (text) { + return text; + }; + + /** + * Parsing & Compiling + */ + + function Parser(options) { + this.tokens = []; + this.token = null; + this.options = options || marked.defaults; + this.options.renderer = this.options.renderer || new Renderer; + this.renderer = this.options.renderer; + this.renderer.options = this.options; + } + + /** + * Static Parse Method + */ + + Parser.parse = function (src, options, renderer) { + var parser = new Parser(options, renderer); + return parser.parse(src); + }; + + /** + * Parse Loop + */ + + Parser.prototype.parse = function (src) { + this.inline = new InlineLexer(src.links, this.options, this.renderer); + this.tokens = src.reverse(); + + var out = ''; + while (this.next()) { + out += this.tok(); + } + + return out; + }; + + /** + * Next Token + */ + + Parser.prototype.next = function () { + return this.token = this.tokens.pop(); + }; + + /** + * Preview Next Token + */ + + Parser.prototype.peek = function () { + return this.tokens[this.tokens.length - 1] || 0; + }; + + /** + * Parse Text Tokens + */ + + Parser.prototype.parseText = function () { + var body = this.token.text; + + while (this.peek().type === 'text') { + body += '\n' + this.next().text; + } + + return this.inline.output(body); + }; + + /** + * Parse Current Token + */ + + Parser.prototype.tok = function () { + switch (this.token.type) { + case 'space': { + return ''; + } + case 'hr': { + return this.renderer.hr(); + } + case 'heading': { + return this.renderer.heading( + this.inline.output(this.token.text), + this.token.depth, + this.token.text); + } + case 'code': { + return this.renderer.code(this.token.text, + this.token.lang, + this.token.escaped); + } + case 'table': { + var header = '' + , body = '' + , i + , row + , cell + , flags + , j; + + // header + cell = ''; + for (i = 0; i < this.token.header.length; i++) { + flags = { header: true, align: this.token.align[i] }; + cell += this.renderer.tablecell( + this.inline.output(this.token.header[i]), + { header: true, align: this.token.align[i] } + ); + } + header += this.renderer.tablerow(cell); + + for (i = 0; i < this.token.cells.length; i++) { + row = this.token.cells[i]; + + cell = ''; + for (j = 0; j < row.length; j++) { + cell += this.renderer.tablecell( + this.inline.output(row[j]), + { header: false, align: this.token.align[j] } + ); + } + + body += this.renderer.tablerow(cell); + } + return this.renderer.table(header, body); + } + case 'blockquote_start': { + var body = ''; + + while (this.next().type !== 'blockquote_end') { + body += this.tok(); + } + + return this.renderer.blockquote(body); + } + case 'list_start': { + var body = '' + , ordered = this.token.ordered; + + while (this.next().type !== 'list_end') { + body += this.tok(); + } + + return this.renderer.list(body, ordered); + } + case 'list_item_start': { + var body = ''; + + while (this.next().type !== 'list_item_end') { + body += this.token.type === 'text' + ? this.parseText() + : this.tok(); + } + + return this.renderer.listitem(body); + } + case 'loose_item_start': { + var body = ''; + + while (this.next().type !== 'list_item_end') { + body += this.tok(); + } + + return this.renderer.listitem(body); + } + case 'html': { + var html = !this.token.pre && !this.options.pedantic + ? this.inline.output(this.token.text) + : this.token.text; + return this.renderer.html(html); + } + case 'paragraph': { + return this.renderer.paragraph(this.inline.output(this.token.text)); + } + case 'text': { + return this.renderer.paragraph(this.parseText()); + } + } + }; + + /** + * Helpers + */ + + function escape(html, encode) { + return html + .replace(!encode ? /&(?!#?\w+;)/g : /&/g, '&') + .replace(/</g, '<') + .replace(/>/g, '>') + .replace(/"/g, '"') + .replace(/'/g, '''); + } + + function unescape(html) { + // explicitly match decimal, hex, and named HTML entities + return html.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig, function (_, n) { + n = n.toLowerCase(); + if (n === 'colon') return ':'; + if (n.charAt(0) === '#') { + return n.charAt(1) === 'x' + ? String.fromCharCode(parseInt(n.substring(2), 16)) + : String.fromCharCode(+n.substring(1)); + } + return ''; + }); + } + + function replace(regex, opt) { + regex = regex.source; + opt = opt || ''; + return function self(name, val) { + if (!name) return new RegExp(regex, opt); + val = val.source || val; + val = val.replace(/(^|[^\[])\^/g, '$1'); + regex = regex.replace(name, val); + return self; + }; + } + + function resolveUrl(base, href) { + if (!baseUrls[' ' + base]) { + // we can ignore everything in base after the last slash of its path component, + // but we might need to add _that_ + // https://tools.ietf.org/html/rfc3986#section-3 + if (/^[^:]+:\/*[^/]*$/.test(base)) { + baseUrls[' ' + base] = base + '/'; + } else { + baseUrls[' ' + base] = base.replace(/[^/]*$/, ''); + } + } + base = baseUrls[' ' + base]; + + if (href.slice(0, 2) === '//') { + return base.replace(/:[\s\S]*/, ':') + href; + } else if (href.charAt(0) === '/') { + return base.replace(/(:\/*[^/]*)[\s\S]*/, '$1') + href; + } else { + return base + href; + } + } + var baseUrls = {}; + var originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i; + + function noop() { } + noop.exec = noop; + + function merge(obj) { + var i = 1 + , target + , key; + + for (; i < arguments.length; i++) { + target = arguments[i]; + for (key in target) { + if (Object.prototype.hasOwnProperty.call(target, key)) { + obj[key] = target[key]; + } + } + } + + return obj; + } + + + /** + * Marked + */ + + function marked(src, opt, callback) { + if (callback || typeof opt === 'function') { + if (!callback) { + callback = opt; + opt = null; + } + + opt = merge({}, marked.defaults, opt || {}); + + var highlight = opt.highlight + , tokens + , pending + , i = 0; + + try { + tokens = Lexer.lex(src, opt) + } catch (e) { + return callback(e); + } + + pending = tokens.length; + + var done = function (err) { + if (err) { + opt.highlight = highlight; + return callback(err); + } + + var out; + + try { + out = Parser.parse(tokens, opt); + } catch (e) { + err = e; + } + + opt.highlight = highlight; + + return err + ? callback(err) + : callback(null, out); + }; + + if (!highlight || highlight.length < 3) { + return done(); + } + + delete opt.highlight; + + if (!pending) return done(); + + for (; i < tokens.length; i++) { + (function (token) { + if (token.type !== 'code') { + return --pending || done(); + } + return highlight(token.text, token.lang, function (err, code) { + if (err) return done(err); + if (code == null || code === token.text) { + return --pending || done(); + } + token.text = code; + token.escaped = true; + --pending || done(); + }); + })(tokens[i]); + } + + return; + } + try { + if (opt) opt = merge({}, marked.defaults, opt); + return Parser.parse(Lexer.lex(src, opt), opt); + } catch (e) { + e.message += '\nPlease report this to https://github.com/chjj/marked.'; + if ((opt || marked.defaults).silent) { + return '<p>An error occurred:</p><pre>' + + escape(e.message + '', true) + + '</pre>'; + } + throw e; + } + } + + /** + * Options + */ + + marked.options = + marked.setOptions = function (opt) { + merge(marked.defaults, opt); + return marked; + }; + + marked.defaults = { + gfm: true, + tables: true, + breaks: false, + pedantic: false, + sanitize: false, + sanitizer: null, + mangle: true, + smartLists: false, + silent: false, + highlight: null, + langPrefix: 'lang-', + smartypants: false, + headerPrefix: '', + renderer: new Renderer, + xhtml: false, + baseUrl: null + }; + + /** + * Expose + */ + + marked.Parser = Parser; + marked.parser = Parser.parse; + + marked.Renderer = Renderer; + + marked.Lexer = Lexer; + marked.lexer = Lexer.lex; + + marked.InlineLexer = InlineLexer; + marked.inlineLexer = InlineLexer.output; + + marked.parse = marked; + + if (typeof module !== 'undefined' && typeof exports === 'object') { + module.exports = marked; + } else if (typeof define === 'function' && define.amd) { + define(function () { return marked; }); + } else { + this.marked = marked; + } + +}).call(function () { + return this || (typeof window !== 'undefined' ? window : global); +}());
\ No newline at end of file diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/help/pom.xml b/sdnr/wireless-transport/code-Carbon-SR1/ux/help/pom.xml new file mode 100644 index 00000000..91fc77bb --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/help/pom.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>mwtn</artifactId> + <groupId>com.highstreet.technologies.odl.dlux</groupId> + <version>0.5.1-SNAPSHOT</version> + <relativePath>..</relativePath> + </parent> + <packaging>pom</packaging> + <groupId>com.highstreet.technologies.odl.dlux</groupId> + <artifactId>help</artifactId> + <version>0.5.1-SNAPSHOT</version> + <name>${prefix} ${project.artifactId}</name> + + <prerequisites> + <maven>3.0</maven> + </prerequisites> + + <modules> + <module>help-module</module> + <module>help-bundle</module> + </modules> +</project>
\ No newline at end of file |