From ad3dbd4d0b52ff814b90dc5e13136e2ae893fe66 Mon Sep 17 00:00:00 2001 From: Andy Stark <30621568+therealandeeee@users.noreply.github.com> Date: Fri, 23 Feb 2018 09:35:16 +0000 Subject: [PATCH] [ADF-2334] Added status icons and version index based on metadata (#2987) * [ADF-2334] Added status icons to index page * [ADF-2334] Improved status icons * [ADF-2334] Added version index page * [ADF-2334] Fixed bad anchors in version index --- docs/README.md | 27 ++- docs/docassets/images/DeprecatedIcon.png | Bin 0 -> 595 bytes docs/docassets/images/ExperimentalIcon.png | Bin 0 -> 642 bytes docs/versionIndex.md | 178 ++++++++++++++++++ lib/config/DocProcessor/docProcessor.js | 31 +-- lib/config/DocProcessor/tools/index.js | 44 ++++- lib/config/DocProcessor/tools/versionIndex.js | 121 ++++++++++++ lib/config/DocProcessor/unistHelpers.js | 8 + 8 files changed, 369 insertions(+), 40 deletions(-) create mode 100644 docs/docassets/images/DeprecatedIcon.png create mode 100644 docs/docassets/images/ExperimentalIcon.png create mode 100644 docs/versionIndex.md create mode 100644 lib/config/DocProcessor/tools/versionIndex.js diff --git a/docs/README.md b/docs/README.md index b203e3046c..cf5704d713 100644 --- a/docs/README.md +++ b/docs/README.md @@ -3,8 +3,18 @@ Below is an index of the documentation for ADF. The [User Guide](#user-guide) section discusses particular techniques in depth. The other sections are references for the ADF libraries. Click the name of an item to see its documentation or click the source link to see -its main source file. Note that ADF is developed continuously, so the source files for some items -may be listed here before their documentation is available. +its main source file. Note that ADF is developed continuously, so the source files for some items may be listed here before their documentation is available. + +See the [Version Index](versionIndex.md) for a list of components ordered by +the ADF version where they were introduced. + +Components are sometimes marked with an icon to show their status. No icon indicates +that the component is complete and suitable for normal use. The other status levels are: + +- **Deprecated** ![](docassets/images/DeprecatedIcon.png) - The component is still available + but is now obsolete and will probably be removed in a future version of ADF. +- **Experimental** ![](docassets/images/ExperimentalIcon.png) - The component is available for + experimentation but not fully complete and tested for production code. ## Contents @@ -22,7 +32,6 @@ may be listed here before their documentation is available. - [Angular Material Design](angular-material-design.md) - [Theming](theming.md) - [Typography](typography.md) -- [Internationalization](internationalization.md) - [Walkthrough - adding indicators to highlight information about a node](metadata-indicators.md) @@ -130,7 +139,7 @@ for more information about installing and using the source code. | [Page title service](page-title.service.md) | Sets the page title. | [Source](../lib/core/services/page-title.service.ts) | | [People content service](people-content.service.md) | Gets information about a Content Services user. | [Source](../lib/core/services/people-content.service.ts) | | [People process service](people-process.service.md) | Gets information about Process Services users. | [Source](../lib/core/services/people-process.service.ts) | -| [Renditions service](renditions.service.md) | Manages prearranged conversions of content to different formats. | [Source](../lib/core/services/renditions.service.ts) | +| [Renditions service](renditions.service.md) ![Deprecated](docassets/images/DeprecatedIcon.png) | Manages prearranged conversions of content to different formats. | [Source](../lib/core/services/renditions.service.ts) | | [Search configuration service](search-configuration.service.md) | Provides fine control of parameters to a search. | [Source](../lib/core/services/search-configuration.service.ts) | | [Shared links api service](shared-links-api.service.md) | Finds shared links to Content Services items. | [Source](../lib/core/services/shared-links-api.service.ts) | | [Sites service](sites.service.md) | Accesses and manipulates sites from a Content Services repository. | [Source](../lib/core/services/sites.service.ts) | @@ -191,18 +200,19 @@ for more information about installing and using the source code. | [File uploading dialog component](file-uploading-dialog.component.md) | Shows a dialog listing all the files uploaded with the Upload Button or Drag Area components. | [Source](../lib/content-services/upload/components/file-uploading-dialog.component.ts) | | [Upload button component](upload-button.component.md) | Activates a file upload. | [Source](../lib/content-services/upload/components/upload-button.component.ts) | | [Upload drag area component](upload-drag-area.component.md) | Adds a drag and drop area to upload files to Alfresco. | [Source](../lib/content-services/upload/components/upload-drag-area.component.ts) | -| [Version list component](version-list.component.md) | Displays the version history of a node in a [Version Manager component](version-manager.component.md) | [Source](../lib/content-services/version-manager/version-list.component.ts) | -| [Version manager component](version-manager.component.md) | Displays the version history of a node with the ability to upload a new version. | [Source](../lib/content-services/version-manager/version-manager.component.ts) | +| [Version list component](version-list.component.md) ![Experimental](docassets/images/ExperimentalIcon.png) | Displays the version history of a node in a [Version Manager component](version-manager.component.md) | [Source](../lib/content-services/version-manager/version-list.component.ts) | +| [Version manager component](version-manager.component.md) ![Experimental](docassets/images/ExperimentalIcon.png) | Displays the version history of a node with the ability to upload a new version. | [Source](../lib/content-services/version-manager/version-manager.component.ts) | | [Webscript component](webscript.component.md) | Provides access to Webscript features. | [Source](../lib/content-services/webscript/webscript.component.ts) | +| _Empty search result component_ | _Not currently documented_ | [Source](../lib/content-services/search/components/empty-search-result.component.ts) | ## Directives | Name | Description | Source link | | ---- | ----------- | ----------- | +| [Node download directive](node-download.directive.md) | Allows folders and/or files to be downloaded. Multiple nodes are packed as a '.ZIP' archive. | [Source](../lib/content-services/directives/node-download.directive.ts) | | [Folder create directive](folder-create.directive.md) | Allows folders to be created. | [Source](../lib/content-services/folder-directive/folder-create.directive.ts) | | [Folder edit directive](folder-edit.directive.md) | Allows folders to be edited. | [Source](../lib/content-services/folder-directive/folder-edit.directive.ts) | | [File draggable directive](file-draggable.directive.md) | Provide drag-and-drop features for an element such as a `div`. | [Source](../lib/content-services/upload/directives/file-draggable.directive.ts) | -| [Node download directive](node-download.directive.md) | Downloads folders and files. Packs folders and/or multiple files into a .ZIP archive. | [Source](../lib/content-services/directives/node-download.directive.ts) | ## Models @@ -221,6 +231,7 @@ for more information about installing and using the source code. | [Folder actions service](folder-actions.service.md) | Implements the folder menu actions for the Document List component. | [Source](../lib/content-services/document-list/services/folder-actions.service.ts) | | [Rating service](rating.service.md) | Manages ratings for items in Content Services. | [Source](../lib/content-services/social/services/rating.service.ts) | | [Tag service](tag.service.md) | Manages tags in Content Services. | [Source](../lib/content-services/tag/services/tag.service.ts) | +| _Property groups translator service_ | _Not currently documented_ | [Source](../lib/content-services/content-metadata/services/property-groups-translator.service.ts) | @@ -311,7 +322,7 @@ for more information about installing and using the source code. | [Analytics generator component](analytics-generator.component.md) | Generates and shows charts | [Source](../lib/insights/analytics-process/components/analytics-generator.component.ts) | | [Analytics report list component](analytics-report-list.component.md) | Shows a list of all available reports | [Source](../lib/insights/analytics-process/components/analytics-report-list.component.ts) | | [Analytics component](analytics.component.md) | Shows the charts related to the reportId passed as input | [Source](../lib/insights/analytics-process/components/analytics.component.ts) | -| [Diagram component](diagram.component.md) | This component shows the diagram of a process. | [Source](../lib/insights/diagram/components/diagram.component.ts) | +| [Diagram component](diagram.component.md) | Displays process diagrams. | [Source](../lib/insights/diagram/components/diagram.component.ts) | diff --git a/docs/docassets/images/DeprecatedIcon.png b/docs/docassets/images/DeprecatedIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..53279438f349e4e98bbd26873f023e4f2c177410 GIT binary patch literal 595 zcmV-Z0<8UsP)A4ImwMQnCO503B&m zSad^gZEa<4bN~PV002XBWnpw>WFU8GbZ8()Nlj2>E@cM*00Fm2L_t(I%e9p~O9Md= zhM!Gr5(pwT5)=i&)+XgxVO@jdCT0zFd!cIUFpd@JCCS%vuu)QUL?y6PI=Wj=K*k+ms$VlNL^fz z@9GNTLUtK!O6&%F-?tvL&7UZdC>lWq*ae1T&NoNEUFba<)aRWYGB7Z1>E&?;yr(uV?FgSJ8Y(c#eDot9+&XMFw3 hfNl2*@V~eMUI0w?N%O`_8N&bo002ovPDHLkV1jki>jD4( literal 0 HcmV?d00001 diff --git a/docs/docassets/images/ExperimentalIcon.png b/docs/docassets/images/ExperimentalIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..4c36201b42715639298a34d7a6ec7b11a65a680d GIT binary patch literal 642 zcmV-|0)737P)A3p>F{JlFsL03B&m zSad^gZEa<4bN~PV002XBWnpw>WFU8GbZ8()Nlj2>E@cM*00HJnL_t(I%bk_IOIuMG z#((D|Lt6u(L!qHc5!oi7I9TONINtIHwOvWKcFE)8!R{ruH7oSh>&a!B9b)~ zItfmKNb6ueyf^WFoDMlD;d1Y}X`k`l=l$`XkM}u(fJ(V70i=W!ua&Rf1Jl5m{(TPA zfNkIyXqW2+HCQhKu)9KtH%h5bKo+x3fOVi!t{3e7M>zmX0~<=Iogi%K^BgPRmV&@6 zunTPHS^yIL&VaALTCi$v^#!j!JSY7y#p7ItAC=RfF{erw45PzA^1-5lBg3#&iI7ql@SEftCrF1!g3W zH@WO)2hZ__=@1|<^*xJ}b=}49cX(yR0jK4_r8RWe12%ufb~q;E99E-?=MKGOq#mb8 zdAA-y^aiTax{c$VC-rPjm|Q;(&Ui3>pCMFB>Oo&N4sG?6A+;@aYMewlL_*-$F23s{ zlQJ$WjwR66sS&CtQ=_bYf5*qYJdk07*qoM6N<$f=xdN$p8QV literal 0 HcmV?d00001 diff --git a/docs/versionIndex.md b/docs/versionIndex.md new file mode 100644 index 0000000000..e2f748e253 --- /dev/null +++ b/docs/versionIndex.md @@ -0,0 +1,178 @@ +# Version Index + +This file contains a list of components grouped according to the +ADF version in which they were introduced. See the +[main index page](README.md) for a list organized by ADF libraries. + + + +## Versions + +- [v2.2.0](#v220) +- [v2.1.0](#v210) +- [v2.0.0](#v200) + +## v2.2.0 + +- [Node download directive](node-download.directive.md) + +## v2.1.0 + +- [Content metadata component](content-metadata.component.md) +- [Content node dialog service](content-node-dialog.service.md) +- [Content node selector panel component](content-node-selector-panel.component.md) +- [Search configuration service](search-configuration.service.md) +- [Sidebar action menu component](sidebar-action-menu.component.md) + +## v2.0.0 + +- [Accordion group component](accordion-group.component.md) +- [Accordion component](accordion.component.md) +- [Activiti alfresco service](activiti-alfresco.service.md) +- [Alfresco api service](alfresco-api.service.md) +- [Alfresco content service](alfresco-content.service.md) +- [Analytics generator component](analytics-generator.component.md) +- [Analytics report list component](analytics-report-list.component.md) +- [Analytics component](analytics.component.md) +- [App config service](app-config.service.md) +- [Apps list component](apps-list.component.md) +- [Apps process service](apps-process.service.md) +- [Auth guard bpm service](auth-guard-bpm.service.md) +- [Auth guard ecm service](auth-guard-ecm.service.md) +- [Auth guard service](auth-guard.service.md) +- [Authentication service](authentication.service.md) +- [Bpm user model](bpm-user.model.md) +- [Bpm user service](bpm-user.service.md) +- [Breadcrumb component](breadcrumb.component.md) +- [Card view update service](card-view-update.service.md) +- [Card view component](card-view.component.md) +- [Checklist component](checklist.component.md) +- [Comment list component](comment-list.component.md) +- [Comment process model](comment-process.model.md) +- [Comment process service](comment-process.service.md) +- [Comments component](comments.component.md) +- [Content action component](content-action.component.md) +- [Content node selector component](content-node-selector.component.md) +- [Content service](content.service.md) +- [Content widget](content.widget.md) +- [Context menu directive](context-menu.directive.md) +- [Cookie service](cookie.service.md) +- [Create process attachment component](create-process-attachment.component.md) +- [Create task attachment component](create-task-attachment.component.md) +- [Data column component](data-column.component.md) +- [Datatable component](datatable.component.md) +- [Deleted nodes api service](deleted-nodes-api.service.md) +- [Diagram component](diagram.component.md) +- [Discovery api service](discovery-api.service.md) +- [Document actions service](document-actions.service.md) +- [Document library model](document-library.model.md) +- [Document list component](document-list.component.md) +- [Document list service](document-list.service.md) +- [Dropdown breadcrumb component](dropdown-breadcrumb.component.md) +- [Ecm user model](ecm-user.model.md) +- [Ecm user service](ecm-user.service.md) +- [Favorites api service](favorites-api.service.md) +- [File draggable directive](file-draggable.directive.md) +- [File size pipe](file-size.pipe.md) +- [File uploading dialog component](file-uploading-dialog.component.md) +- [Filter model](filter.model.md) +- [Folder actions service](folder-actions.service.md) +- [Folder create directive](folder-create.directive.md) +- [Folder edit directive](folder-edit.directive.md) +- [Form field component](form-field.component.md) +- [Form field model](form-field.model.md) +- [Form list component](form-list.component.md) +- [Form rendering service](form-rendering.service.md) +- [Form component](form.component.md) +- [Form service](form.service.md) +- [Highlight transform service](highlight-transform.service.md) +- [Highlight directive](highlight.directive.md) +- [Host settings component](host-settings.component.md) +- [Infinite pagination component](infinite-pagination.component.md) +- [Info drawer layout component](info-drawer-layout.component.md) +- [Info drawer component](info-drawer.component.md) +- [Language menu component](language-menu.component.md) +- [Like component](like.component.md) +- [Log service](log.service.md) +- [Login component](login.component.md) +- [Logout directive](logout.directive.md) +- [Mime type icon pipe](mime-type-icon.pipe.md) +- [Node delete directive](node-delete.directive.md) +- [Node favorite directive](node-favorite.directive.md) +- [Node name tooltip pipe](node-name-tooltip.pipe.md) +- [Node permission directive](node-permission.directive.md) +- [Node restore directive](node-restore.directive.md) +- [Node service](node.service.md) +- [Nodes api service](nodes-api.service.md) +- [Notification service](notification.service.md) +- [Page title service](page-title.service.md) +- [Pagination component](pagination.component.md) +- [People content service](people-content.service.md) +- [People list component](people-list.component.md) +- [People process service](people-process.service.md) +- [People search component](people-search.component.md) +- [People component](people.component.md) +- [Permissions style model](permissions-style.model.md) +- [Process attachment list component](process-attachment-list.component.md) +- [Process audit directive](process-audit.directive.md) +- [Process comments component](process-comments.component.md) +- [Process content service](process-content.service.md) +- [Process filter service](process-filter.service.md) +- [Process filters component](process-filters.component.md) +- [Process instance details component](process-instance-details.component.md) +- [Process instance header component](process-instance-header.component.md) +- [Process instance tasks component](process-instance-tasks.component.md) +- [Process list component](process-list.component.md) +- [Process service](process.service.md) +- [Product version model](product-version.model.md) +- [Rating component](rating.component.md) +- [Rating service](rating.service.md) +- [Renditions service](renditions.service.md) +- [Search api service](search-api.service.md) +- [Search control component](search-control.component.md) +- [Search component](search.component.md) +- [Select apps dialog component](select-apps-dialog.component.md) +- [Shared links api service](shared-links-api.service.md) +- [Site model](site.model.md) +- [Sites dropdown component](sites-dropdown.component.md) +- [Sites service](sites.service.md) +- [Start form component](start-form.component.md) +- [Start process component](start-process.component.md) +- [Start task component](start-task.component.md) +- [Storage service](storage.service.md) +- [Tag actions component](tag-actions.component.md) +- [Tag list component](tag-list.component.md) +- [Tag node list component](tag-node-list.component.md) +- [Tag service](tag.service.md) +- [Task attachment list component](task-attachment-list.component.md) +- [Task audit directive](task-audit.directive.md) +- [Task details component](task-details.component.md) +- [Task details model](task-details.model.md) +- [Task filter service](task-filter.service.md) +- [Task filters component](task-filters.component.md) +- [Task header component](task-header.component.md) +- [Task list component](task-list.component.md) +- [Tasklist service](tasklist.service.md) +- [Text highlight pipe](text-highlight.pipe.md) +- [Text mask component](text-mask.component.md) +- [Thumbnail service](thumbnail.service.md) +- [Time ago pipe](time-ago.pipe.md) +- [Toolbar divider component](toolbar-divider.component.md) +- [Toolbar title component](toolbar-title.component.md) +- [Toolbar component](toolbar.component.md) +- [Translation service](translation.service.md) +- [Upload button component](upload-button.component.md) +- [Upload drag area component](upload-drag-area.component.md) +- [Upload directive](upload.directive.md) +- [Upload service](upload.service.md) +- [User info component](user-info.component.md) +- [User initial pipe](user-initial.pipe.md) +- [User preferences service](user-preferences.service.md) +- [User process model](user-process.model.md) +- [Version list component](version-list.component.md) +- [Version manager component](version-manager.component.md) +- [Viewer component](viewer.component.md) +- [Webscript component](webscript.component.md) +- [Widget component](widget.component.md) + + diff --git a/lib/config/DocProcessor/docProcessor.js b/lib/config/DocProcessor/docProcessor.js index 87ce734411..ee19af12b5 100644 --- a/lib/config/DocProcessor/docProcessor.js +++ b/lib/config/DocProcessor/docProcessor.js @@ -5,12 +5,8 @@ var program = require("commander"); var remark = require("remark"); var parse = require("remark-parse"); var stringify = require("remark-stringify"); +var frontMatter = require("remark-frontmatter"); -/* -var managetoc = require("./managetoc"); -var sa = require("./seealso"); -var index = require("./index"); -*/ // "Aggregate" data collected over the whole file set. var aggData = {}; @@ -21,11 +17,6 @@ var defaultFolder = path.resolve("..", "docs"); function initPhase(aggData) { - /* - toolModules.seealso.initPhase(aggData); - toolModules.index.initPhase(aggData); - */ - toolList.forEach(toolName => { toolModules[toolName].initPhase(aggData); }); @@ -37,16 +28,11 @@ function readPhase(srcFolder, filenames, aggData) { var pathname = path.resolve(srcFolder, filenames[i]); var src = fs.readFileSync(pathname); - var tree = remark().parse(src) + var tree = remark().use(frontMatter, ["yaml"]).parse(src); toolList.forEach(toolName => { toolModules[toolName].readPhase(tree, pathname, aggData); }); - - /* - toolModules.seealso.readPhase(tree, pathname, aggData); - toolModules.index.readPhase(tree, pathname, aggData); - */ } //console.log(JSON.stringify(aggData.mdFileData)); @@ -57,11 +43,6 @@ function aggPhase(aggData) { toolList.forEach(toolName => { toolModules[toolName].aggPhase(aggData); }); - - /* - toolModules.seealso.aggPhase(aggData); - toolModules.index.aggPhase(aggData); - */ } @@ -119,15 +100,7 @@ if (program.args.length === 0) { return 0; } -/* -var sourcePath; - -if (program.args.length > 0) - sourcePath = path.resolve(program.args[0]); -else - sourcePath = defaultFolder; -*/ var sourcePath = path.resolve(program.args[0]); var sourceInfo = fs.statSync(sourcePath); diff --git a/lib/config/DocProcessor/tools/index.js b/lib/config/DocProcessor/tools/index.js index 6ce79ec65d..dcb011823c 100644 --- a/lib/config/DocProcessor/tools/index.js +++ b/lib/config/DocProcessor/tools/index.js @@ -4,6 +4,7 @@ var path = require("path"); var remark = require("remark"); var stringify = require("remark-stringify"); var zone = require("mdast-zone"); +var yaml = require("js-yaml"); var unist = require("../unistHelpers"); var ngHelpers = require("../ngHelpers"); @@ -29,11 +30,15 @@ var maxBriefDescLength = 180; var adfLibNames = ["core", "content-services", "insights", "process-services"]; +var deprecatedIconURL = "docassets/images/DeprecatedIcon.png"; +var experimentalIconURL = "docassets/images/ExperimentalIcon.png"; + function initPhase(aggData) { aggData.stoplist = makeStoplist(undocStoplistFileName); aggData.srcData = {}; aggData.mdFileDesc = []; + aggData.mdFileStatus = []; searchLibraryRecursive(aggData.srcData, path.resolve(rootFolder)); @@ -49,8 +54,12 @@ function readPhase(tree, pathname, aggData) { var s; var briefDesc; - for ( + if (tree.children[0].type == "yaml") + s = 1; + else s = 0; + + for (; (s < tree.children.length) && !unist.isParagraph(tree.children[s]); s++ ); @@ -60,6 +69,17 @@ function readPhase(tree, pathname, aggData) { } aggData.mdFileDesc[itemName] = briefDesc; + + if (tree.children[0].type == "yaml") { + var metadata = yaml.load(tree.children[0].value); + var status = metadata["Status"]; + + if (status) { + var compName = path.basename(pathname, ".md"); + aggData.mdFileStatus[compName] = status; + } + + } } function aggPhase(aggData) { @@ -165,12 +185,18 @@ function prepareIndexSections(aggData) { var displayName = ngHelpers.ngNameToDisplayName(itemName); + var status = ""; + + if (aggData.mdFileStatus[itemName]) + status = aggData.mdFileStatus[itemName]; + if (briefDesc) { sections[libName][srcData.type].documented.push({ "displayName": displayName, "mdName": itemName + ".md", "srcPath": srcData.path, - "briefDesc": briefDesc + "briefDesc": briefDesc, + "status": status }); } else if (!rejectItemViaStoplist(aggData.stoplist, itemName)) { sections[libName][srcData.type].undocumented.push({ @@ -283,8 +309,20 @@ function makeMDDocumentedTableRow(docItem) { var srcFileLink = unist.makeLink(unist.makeText("Source"), "../lib/" + docItem.srcPath); var desc = docItem.briefDesc; + var linkCellItems = [mdFileLink]; + + if (docItem.status) { + if (docItem.status === "Deprecated") { + linkCellItems.push(unist.makeText(" ")); + linkCellItems.push(unist.makeImage(deprecatedIconURL, "Deprecated")); + } else if (docItem.status === "Experimental") { + linkCellItems.push(unist.makeText(" ")); + linkCellItems.push(unist.makeImage(experimentalIconURL, "Experimental")); + } + } + return unist.makeTableRow([ - unist.makeTableCell([mdFileLink]), + unist.makeTableCell(linkCellItems), unist.makeTableCell([desc]), unist.makeTableCell([srcFileLink]) ]); diff --git a/lib/config/DocProcessor/tools/versionIndex.js b/lib/config/DocProcessor/tools/versionIndex.js new file mode 100644 index 0000000000..a67df3f5c5 --- /dev/null +++ b/lib/config/DocProcessor/tools/versionIndex.js @@ -0,0 +1,121 @@ +var fs = require("fs"); +var path = require("path"); +var yaml = require("js-yaml"); + +var remark = require("remark"); +var stringify = require("remark-stringify"); +var zone = require("mdast-zone"); + +var unist = require("../unistHelpers"); +var ngHelpers = require("../ngHelpers"); + + +module.exports = { + "initPhase": initPhase, + "readPhase": readPhase, + "aggPhase": aggPhase, + "updatePhase": updatePhase +} + +var angFilenameRegex = /([a-zA-Z0-9\-]+)\.((component)|(directive)|(model)|(pipe)|(service)|(widget))\.ts/; + +var docsFolderPath = path.resolve("..", "docs"); +var histFilePath = path.resolve(docsFolderPath, "versionIndex.md"); + +var histSectionName = "history"; +var initialVersion = "v2.0.0"; + +function initPhase(aggData) { + aggData.versions = { "v2.0.0":[] }; +} + + +function readPhase(tree, pathname, aggData) { + var compName = path.basename(pathname, ".md"); + var angNameRegex = /([a-zA-Z0-9\-]+)\.((component)|(directive)|(model)|(pipe)|(service)|(widget))/; + + if (!compName.match(angNameRegex)) + return; + + if (compName.match(/boilerplate/)) + return; + + if (tree.children[0].type == "yaml") { + var metadata = yaml.load(tree.children[0].value); + var version = metadata["Added"]; + + if (version) { + if (aggData.versions[version]) { + aggData.versions[version].push(compName); + } else { + aggData.versions[version] = [compName]; + } + } else { + aggData.versions[initialVersion].push(compName); + } + } else { + aggData.versions[initialVersion].push(compName); + } +} + +function aggPhase(aggData) { + var histFileText = fs.readFileSync(histFilePath, "utf8"); + var histFileTree = remark().parse(histFileText); + + var keys = Object.keys(aggData.versions); + keys.sort((a, b) => { + if (a > b) + return -1; + else if (b > a) + return 1; + else + return 0; + }); + + var sections = [unist.makeHeading(unist.makeText("Versions"), 2)]; + + var vListItems = []; + + for (var i = 0; i < keys.length; i++) { + var keyAnchor = keys[i].replace(/\./g, ""); + vListItems.push(unist.makeListItem(unist.makeLink(unist.makeText(keys[i]), `#${keyAnchor}`))); + } + + sections.push(unist.makeListUnordered(vListItems)); + + for (var i = 0; i < keys.length; i++) { + var version = keys[i]; + var versionItems = aggData.versions[version]; + versionItems.sort(); + + var versListItems = []; + + for (var v = 0; v < versionItems.length; v++) { + var displayName = ngHelpers.ngNameToDisplayName(versionItems[v]); + var pageLink = versionItems[v] + ".md"; + + versListItems.push( + unist.makeListItem( + unist.makeLink(unist.makeText(displayName), pageLink) + ) + ); + } + + sections.push(unist.makeHeading(unist.makeText(version), 2)); + sections.push(unist.makeListUnordered(versListItems)); + } + + zone(histFileTree, histSectionName, (startComment, oldSection, endComment) => { + sections.unshift(startComment); + sections.push(endComment); + return sections; + }); + + //console.log(JSON.stringify(histFileTree)); + fs.writeFileSync(histFilePath, remark().stringify(histFileTree)); +} + + +function updatePhase(tree, pathname, aggData) { + return false; +} \ No newline at end of file diff --git a/lib/config/DocProcessor/unistHelpers.js b/lib/config/DocProcessor/unistHelpers.js index cd669a7b5a..d9892a6794 100644 --- a/lib/config/DocProcessor/unistHelpers.js +++ b/lib/config/DocProcessor/unistHelpers.js @@ -110,6 +110,14 @@ module.exports = { } }, + makeImage: function (url, alt) { + return { + "type": "image", + "url": url, + "alt": alt + } + }, + isHeading: function (node) { return node.type === "heading"; },