From 235a6c8c75a573ce3810d4e1a7423bcc7cc5b943 Mon Sep 17 00:00:00 2001 From: Josef Bredreck Date: Sun, 16 Aug 2020 20:42:51 +0200 Subject: [PATCH 01/11] Deprecate underscore prefix --- packages/core/src/lib/readDocumentation.js | 71 ++++++++++++++++++- packages/core/src/lib/ui_builder.js | 14 ++-- .../01-global/{_colors.hbs => colors.hbs} | 0 .../_patterns/00-atoms/01-global/colors.md | 3 + 4 files changed, 78 insertions(+), 10 deletions(-) rename packages/starterkit-handlebars-demo/dist/_patterns/00-atoms/01-global/{_colors.hbs => colors.hbs} (100%) create mode 100644 packages/starterkit-handlebars-demo/dist/_patterns/00-atoms/01-global/colors.md diff --git a/packages/core/src/lib/readDocumentation.js b/packages/core/src/lib/readDocumentation.js index edd11de6e..9e633259a 100644 --- a/packages/core/src/lib/readDocumentation.js +++ b/packages/core/src/lib/readDocumentation.js @@ -1,7 +1,8 @@ 'use strict'; -const path = require('path'); const _ = require('lodash'); +const path = require('path'); +const fs = require('fs-extra'); const ch = require('./changes_hunter'); const logger = require('./log'); @@ -10,14 +11,14 @@ const mp = require('./markdown_parser'); const changes_hunter = new ch(); const markdown_parser = new mp(); -let fs = require('fs-extra'); //eslint-disable-line prefer-const +const FILE_EXTENSION = '.md'; module.exports = function(pattern, patternlab) { try { const markdownFileName = path.resolve( patternlab.config.paths.source.patterns, pattern.subdir, - pattern.fileName + '.md' + pattern.fileName + FILE_EXTENSION ); changes_hunter.checkLastModified(pattern, markdownFileName); @@ -78,4 +79,68 @@ module.exports = function(pattern, patternlab) { logger.warning(err); } } + + // Read Documentation for Pattern-Group + // Use this approach, since pattern lab is a pattern driven software + try { + const markdownFileNameGroup = path.resolve( + patternlab.config.paths.source.patterns, + pattern.patternType, + pattern.patternGroup + FILE_EXTENSION + ); + const markdownFileContentsGroup = fs.readFileSync( + markdownFileNameGroup, + 'utf8' + ); + const markdownObjectGroup = markdown_parser.parse( + markdownFileContentsGroup + ); + + if (!_.isEmpty(markdownObjectGroup)) { + pattern.patternGroupData = markdownObjectGroup; + } + } catch (err) { + // do nothing when file not found + if (err.code !== 'ENOENT') { + logger.warning( + `'there was an error setting pattern group data after markdown parsing for ${path.join( + pattern.patternType, + pattern.patternGroup + FILE_EXTENSION + )}` + ); + logger.warning(err); + } + } + + // Read Documentation for Pattern-Subgroup + try { + const markdownFileNameSubGroup = path.resolve( + patternlab.config.paths.source.patterns, + pattern.patternType, + pattern.patternSubType, + pattern.patternSubGroup + FILE_EXTENSION + ); + const markdownFileContentsSubGroup = fs.readFileSync( + markdownFileNameSubGroup, + 'utf8' + ); + const markdownObjectSubGroup = markdown_parser.parse( + markdownFileContentsSubGroup + ); + + if (!_.isEmpty(markdownObjectSubGroup)) { + pattern.patternSubGroupData = markdownObjectSubGroup; + } + } catch (err) { + // do nothing when file not found + if (err.code !== 'ENOENT') { + logger.warning( + `'there was an error setting pattern sub group data after markdown parsing for ${path.join( + pattern.patternSubType, + pattern.patternSubGroup + FILE_EXTENSION + )}` + ); + logger.warning(err); + } + } }; diff --git a/packages/core/src/lib/ui_builder.js b/packages/core/src/lib/ui_builder.js index 4a077a613..b5730dc1c 100644 --- a/packages/core/src/lib/ui_builder.js +++ b/packages/core/src/lib/ui_builder.js @@ -77,11 +77,11 @@ const ui_builder = function() { return true; } - // skip underscore-prefixed files - isOmitted = pattern.isPattern && pattern.fileName.charAt(0) === '_'; + // skip marked as hidden patterns + isOmitted = pattern.isPattern && pattern.hidden; if (isOmitted) { logger.info( - `Omitting ${pattern.patternPartial} from styleguide patterns because it has an underscore prefix.` + `Omitting ${pattern.patternPartial} from styleguide patterns because it is marked as hidden within it's documentation.` ); return true; } @@ -96,13 +96,13 @@ const ui_builder = function() { return true; } - // this pattern is contained with a directory prefixed with an underscore (a handy way to hide whole directories from the nav + // this pattern is contained with a directory documented as hidden (a handy way to hide whole directories from the nav isOmitted = - pattern.relPath.charAt(0) === '_' || - pattern.relPath.indexOf(path.sep + '_') > -1; + (pattern.patternGroupData && pattern.patternGroupData.hidden) || + (pattern.patternSubGroupData && pattern.patternSubGroupData.hidden); if (isOmitted) { logger.info( - `Omitting ${pattern.patternPartial} from styleguide patterns because its contained within an underscored directory.` + `Omitting ${pattern.patternPartial} from styleguide patterns because its contained within an hidden directory.` ); return true; } diff --git a/packages/starterkit-handlebars-demo/dist/_patterns/00-atoms/01-global/_colors.hbs b/packages/starterkit-handlebars-demo/dist/_patterns/00-atoms/01-global/colors.hbs similarity index 100% rename from packages/starterkit-handlebars-demo/dist/_patterns/00-atoms/01-global/_colors.hbs rename to packages/starterkit-handlebars-demo/dist/_patterns/00-atoms/01-global/colors.hbs diff --git a/packages/starterkit-handlebars-demo/dist/_patterns/00-atoms/01-global/colors.md b/packages/starterkit-handlebars-demo/dist/_patterns/00-atoms/01-global/colors.md new file mode 100644 index 000000000..20ceb0395 --- /dev/null +++ b/packages/starterkit-handlebars-demo/dist/_patterns/00-atoms/01-global/colors.md @@ -0,0 +1,3 @@ +--- +hidden: true +--- \ No newline at end of file From 5c0353cdb8c5c8d936f9c8ff2a08e2b56b708f63 Mon Sep 17 00:00:00 2001 From: Josef Bredreck Date: Sun, 16 Aug 2020 20:55:20 +0200 Subject: [PATCH 02/11] #1237: Update tests to use new "hidden" functionality --- packages/core/test/ui_builder_tests.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/core/test/ui_builder_tests.js b/packages/core/test/ui_builder_tests.js index 00fd29ec0..21defffb2 100644 --- a/packages/core/test/ui_builder_tests.js +++ b/packages/core/test/ui_builder_tests.js @@ -72,7 +72,8 @@ tap.test( function(test) { //arrange var patternlab = createFakePatternLab({}); - var pattern = new Pattern('00-test/_ignored-pattern.mustache'); + var pattern = new Pattern('00-test/ignored-pattern.mustache'); + pattern.hidden = true; //act var result = ui.isPatternExcluded(pattern, patternlab, uikit); @@ -108,7 +109,7 @@ tap.test( var pattern = Pattern.createEmpty({ relPath: path.sep + - '_hidden' + + 'hidden' + path.sep + 'patternsubtype' + path.sep + @@ -118,6 +119,10 @@ tap.test( patternPartial: 'hidden-foo', }); + pattern.patternGroupData = { + hidden: true, + }; + //act var result = ui.isPatternExcluded(pattern, patternlab, uikit); @@ -134,12 +139,16 @@ tap.test( var patternlab = createFakePatternLab({}); var pattern = Pattern.createEmpty({ relPath: - 'shown' + path.sep + '_patternsubtype' + path.sep + 'foo.mustache', + 'shown' + path.sep + 'patternsubtype' + path.sep + 'foo.mustache', isPattern: true, fileName: 'foo.mustache', patternPartial: 'shown-foo', }); + pattern.patternSubGroupData = { + hidden: true, + }; + //act var result = ui.isPatternExcluded(pattern, patternlab, uikit); From acaf69535bfe62c45420f0ecc8bf998aeccc97f7 Mon Sep 17 00:00:00 2001 From: Josef Bredreck Date: Mon, 17 Aug 2020 16:18:51 +0200 Subject: [PATCH 03/11] #1237: Add Documentation --- packages/docs/src/docs/pattern-documenting.md | 2 +- packages/docs/src/docs/pattern-hiding.md | 37 +++++++++++++++++-- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/packages/docs/src/docs/pattern-documenting.md b/packages/docs/src/docs/pattern-documenting.md index 8cdcdb465..7563629af 100644 --- a/packages/docs/src/docs/pattern-documenting.md +++ b/packages/docs/src/docs/pattern-documenting.md @@ -53,5 +53,5 @@ We'd name our documentation file: ## Adding More Attributes to the Front Matter -A future update of Pattern Lab will support more front matter attributes including: excludeFromStyleguide, order, hidden and links. +A future update of Pattern Lab will support more front matter attributes including: excludeFromStyleguide, order and links. It will also support adding custom attributes that could be utilized by plugins. For example, GitHub issues related to patterns. diff --git a/packages/docs/src/docs/pattern-hiding.md b/packages/docs/src/docs/pattern-hiding.md index 52ba3acae..a6fff1589 100644 --- a/packages/docs/src/docs/pattern-hiding.md +++ b/packages/docs/src/docs/pattern-hiding.md @@ -9,14 +9,43 @@ eleventyNavigation: order: 170 --- -To remove a pattern from Pattern Lab's drop-down navigation and style guide add an underscore (`_`) to the beginning of the pattern name. For example, we may have a Google Map-based pattern that we don't need for a particular project. The path might look like: +Removing a pattern from Pattern Lab's drop-down navigation and style guide is accomplished by setting the `hidden` frontmatter key on any pattern's companion `.md` file. For example, we may have a Google Map-based pattern that we don't need for a particular project. The path might look like: molecules/media/map.mustache -To "hide" the pattern we add the underscore and re-generate our site: +We would create or edit a file in the same location, calling it `map.md`: - molecules/media/_map.mustache +``` +--- +hidden: true +--- +The map component... +``` + +## Hiding Pattern Groups + +The same concept applies to `pattern-groups`. For example, we have a `pattern-group` named `atoms` and we create a companion `.md` file for that group under `_patters/atoms/atoms.md`. In that case the whole `pattern-group` and all its components will be hidden in the UI. + +``` +--- +hidden: true +--- +# atoms.md file +``` + +## Hiding Pattern Sub Groups + +The same concept applies to `pattern-sub-groups`. For example, we have a `pattern-sub-group` named `buttons` which is structured under `atoms` and we create a companion `.md` file for that group under `_patters/atoms/buttons/buttons.md`. In that case the whole `pattern-sub-group` and all its components will be hidden in the UI. + +``` +--- +hidden: true +--- +# buttons.md file +``` + +## Additional Information A hidden pattern can still be included in other patterns. -Not all PatternEngines support hiding patterns. +Not all PatternEngines support hiding patterns. \ No newline at end of file From f527bbedf3458ad5ef072ecc760c045394f2185c Mon Sep 17 00:00:00 2001 From: Josef Bredreck Date: Sat, 22 Aug 2020 00:06:18 +0200 Subject: [PATCH 04/11] #1237: Add deprecation warning --- packages/core/src/lib/object_factory.js | 18 ++++++++++++++++++ packages/core/src/lib/pseudopattern_hunter.js | 1 + packages/core/src/lib/readDocumentation.js | 5 +---- packages/core/src/lib/ui_builder.js | 10 ++++++++-- .../.gitignore | 1 + packages/docs/src/docs/pattern-documenting.md | 1 + packages/docs/src/docs/pattern-hiding.md | 8 +++----- 7 files changed, 33 insertions(+), 11 deletions(-) diff --git a/packages/core/src/lib/object_factory.js b/packages/core/src/lib/object_factory.js index e4523d9bd..26c9276cc 100644 --- a/packages/core/src/lib/object_factory.js +++ b/packages/core/src/lib/object_factory.js @@ -2,12 +2,14 @@ const _ = require('lodash'); const path = require('path'); +const logger = require('./log'); const patternEngines = require('./pattern_engines'); // prefixMatcher is intended to match the leading maybe-underscore, // zero or more digits, and maybe-dash at the beginning of a pattern file name we can hack them // off and get at the good part. const prefixMatcher = /^_?(\d+-)?/; +const prefixMatcherDeprecationCheckHidden = /^_.+/; /** * Pattern constructor / Pattern properties @@ -48,6 +50,17 @@ const Pattern = function( this.subdir = pathObj.dir; // '00-atoms/00-global' this.fileExtension = pathObj.ext; // '.mustache' + if ( + (prefixMatcherDeprecationCheckHidden.test(this.getDirLevel(0, info)) || + prefixMatcherDeprecationCheckHidden.test(this.getDirLevel(1, info)) || + prefixMatcherDeprecationCheckHidden.test(this.fileName)) && + !info.isMetaPattern + ) { + logger.warning( + `${info.shortNotation}/${this.fileName} "Pattern", "Group" and "Subgroup" hiding by underscore prefix (_*) will be deprecated in the future.\n See https://patternlab.io/docs/hiding-patterns-in-the-navigation/` + ); + } + // TODO: Remove if when dropping ordering by prefix and keep else code if (info.patternHasOwnDir) { // Since there is still the requirement of having the numbers provided for sorting @@ -298,6 +311,11 @@ Pattern.prototype = { info.dir = info.patternHasOwnDir ? pathObj.dir.split(path.sep).pop() : ''; info.dirLevel = pathObj.dir.split(path.sep).filter(s => !!s).length; + // Only relevant for deprecation check and message + if (path.parse(pathObj.dir).base === '_meta') { + info.isMetaPattern = true; + } + if (info.dirLevel === 0 || (info.dirLevel === 1 && info.patternHasOwnDir)) { // -> ./ info.shortNotation = 'root'; diff --git a/packages/core/src/lib/pseudopattern_hunter.js b/packages/core/src/lib/pseudopattern_hunter.js index 71c178177..22e46a790 100644 --- a/packages/core/src/lib/pseudopattern_hunter.js +++ b/packages/core/src/lib/pseudopattern_hunter.js @@ -114,6 +114,7 @@ pseudopattern_hunter.prototype.find_pseudopatterns = function( }, patternlab ); + patternVariant.hidden = _.clone(currentPattern.hidden); changes_hunter.checkBuildState(patternVariant, patternlab); patternlab.graph.add(patternVariant); diff --git a/packages/core/src/lib/readDocumentation.js b/packages/core/src/lib/readDocumentation.js index 9e633259a..446cae217 100644 --- a/packages/core/src/lib/readDocumentation.js +++ b/packages/core/src/lib/readDocumentation.js @@ -85,7 +85,6 @@ module.exports = function(pattern, patternlab) { try { const markdownFileNameGroup = path.resolve( patternlab.config.paths.source.patterns, - pattern.patternType, pattern.patternGroup + FILE_EXTENSION ); const markdownFileContentsGroup = fs.readFileSync( @@ -104,7 +103,6 @@ module.exports = function(pattern, patternlab) { if (err.code !== 'ENOENT') { logger.warning( `'there was an error setting pattern group data after markdown parsing for ${path.join( - pattern.patternType, pattern.patternGroup + FILE_EXTENSION )}` ); @@ -117,7 +115,6 @@ module.exports = function(pattern, patternlab) { const markdownFileNameSubGroup = path.resolve( patternlab.config.paths.source.patterns, pattern.patternType, - pattern.patternSubType, pattern.patternSubGroup + FILE_EXTENSION ); const markdownFileContentsSubGroup = fs.readFileSync( @@ -136,7 +133,7 @@ module.exports = function(pattern, patternlab) { if (err.code !== 'ENOENT') { logger.warning( `'there was an error setting pattern sub group data after markdown parsing for ${path.join( - pattern.patternSubType, + pattern.patternType, pattern.patternSubGroup + FILE_EXTENSION )}` ); diff --git a/packages/core/src/lib/ui_builder.js b/packages/core/src/lib/ui_builder.js index b5730dc1c..4d772bded 100644 --- a/packages/core/src/lib/ui_builder.js +++ b/packages/core/src/lib/ui_builder.js @@ -78,7 +78,10 @@ const ui_builder = function() { } // skip marked as hidden patterns - isOmitted = pattern.isPattern && pattern.hidden; + isOmitted = + (pattern.isPattern && pattern.hidden) || + // TODO: Remove next line when removing support & deprecation waring for underscore prefix hiding + (pattern.isPattern && pattern.fileName.charAt(0) === '_'); if (isOmitted) { logger.info( `Omitting ${pattern.patternPartial} from styleguide patterns because it is marked as hidden within it's documentation.` @@ -99,7 +102,10 @@ const ui_builder = function() { // this pattern is contained with a directory documented as hidden (a handy way to hide whole directories from the nav isOmitted = (pattern.patternGroupData && pattern.patternGroupData.hidden) || - (pattern.patternSubGroupData && pattern.patternSubGroupData.hidden); + (pattern.patternSubGroupData && pattern.patternSubGroupData.hidden) || + // TODO: Remove next two lines when removing support & deprecation waring for underscore prefix hiding + pattern.relPath.charAt(0) === '_' || + pattern.relPath.indexOf(path.sep + '_') > -1; if (isOmitted) { logger.info( `Omitting ${pattern.patternPartial} from styleguide patterns because its contained within an hidden directory.` diff --git a/packages/development-edition-engine-handlebars/.gitignore b/packages/development-edition-engine-handlebars/.gitignore index 0679bd2b5..30cb59412 100644 --- a/packages/development-edition-engine-handlebars/.gitignore +++ b/packages/development-edition-engine-handlebars/.gitignore @@ -7,3 +7,4 @@ Thumbs.db .idea/ public dependencyGraph.json +source/ \ No newline at end of file diff --git a/packages/docs/src/docs/pattern-documenting.md b/packages/docs/src/docs/pattern-documenting.md index 7563629af..2d0290e6d 100644 --- a/packages/docs/src/docs/pattern-documenting.md +++ b/packages/docs/src/docs/pattern-documenting.md @@ -22,6 +22,7 @@ Attributes overview: * The `title` attribute is used in Pattern Lab's navigation as well as in the styleguide views. Format: `string` * Pattern `tags` has to be an array, like `tags: [new, relaunch, dev]` * [Pattern `states`](/docs/using-pattern-states/) are defined like `state: incomplete` and [provide a simple visual indication](/docs/using-pattern-states/) +* The `hidden` property to [Hide Patterns in the Navigation](/docs/hiding-patterns-in-the-navigation/) Both `tags` and `states` could be used for [not including patterns in a UIKit specific build](/docs/editing-the-configuration-options/#heading-uikits). diff --git a/packages/docs/src/docs/pattern-hiding.md b/packages/docs/src/docs/pattern-hiding.md index a6fff1589..c31e428bc 100644 --- a/packages/docs/src/docs/pattern-hiding.md +++ b/packages/docs/src/docs/pattern-hiding.md @@ -24,7 +24,7 @@ The map component... ## Hiding Pattern Groups -The same concept applies to `pattern-groups`. For example, we have a `pattern-group` named `atoms` and we create a companion `.md` file for that group under `_patters/atoms/atoms.md`. In that case the whole `pattern-group` and all its components will be hidden in the UI. +The same concept applies to `pattern-groups`. For example, you have a `pattern-group` named `atoms`, and you create a companion `.md` file for that group under `_patters/atoms/atoms.md`. In that case, the whole `pattern-group` and all its components will be hidden in the UI. ``` --- @@ -35,7 +35,7 @@ hidden: true ## Hiding Pattern Sub Groups -The same concept applies to `pattern-sub-groups`. For example, we have a `pattern-sub-group` named `buttons` which is structured under `atoms` and we create a companion `.md` file for that group under `_patters/atoms/buttons/buttons.md`. In that case the whole `pattern-sub-group` and all its components will be hidden in the UI. +The same concept applies to `pattern-sub-groups`. For example, we have a `pattern-sub-group` named `buttons` which is structured under `atoms`, and we create a companion `.md` file for that group under `_patters/atoms/buttons/buttons.md`. In that case, the whole `pattern-sub-group` and all its components will be hidden in the UI. ``` --- @@ -46,6 +46,4 @@ hidden: true ## Additional Information -A hidden pattern can still be included in other patterns. - -Not all PatternEngines support hiding patterns. \ No newline at end of file +A hidden pattern can still be included in other patterns. \ No newline at end of file From 3dc22f196ff4ec8ece11bee43f1f4ccddde93db1 Mon Sep 17 00:00:00 2001 From: Josef Bredreck Date: Thu, 17 Dec 2020 20:54:37 +0100 Subject: [PATCH 05/11] Update dev package sources --- .../patternlab-config.json | 25 ++++++++--- .../source/_data/data.json | 44 +++++-------------- .../source/_data/listitems.json | 5 +-- .../source/_meta/_00-head.mustache | 25 ++++++----- .../source/_meta/_01-foot.mustache | 9 ++-- 5 files changed, 52 insertions(+), 56 deletions(-) diff --git a/packages/development-edition-engine-handlebars/patternlab-config.json b/packages/development-edition-engine-handlebars/patternlab-config.json index 36546fb07..be081a639 100644 --- a/packages/development-edition-engine-handlebars/patternlab-config.json +++ b/packages/development-edition-engine-handlebars/patternlab-config.json @@ -21,9 +21,18 @@ "tools-docs": false }, "ishViewportRange": { - "s": [240, 500], - "m": [500, 800], - "l": [800, 2600] + "s": [ + 240, + 500 + ], + "m": [ + 500, + 800 + ], + "l": [ + 800, + 2600 + ] }, "logLevel": "info", "outputFileSuffixes": { @@ -64,7 +73,11 @@ } }, "patternExtension": "hbs", - "patternStateCascade": ["inprogress", "inreview", "complete"], + "patternStateCascade": [ + "inprogress", + "inreview", + "complete" + ], "patternExportAll": false, "patternExportDirectory": "pattern_exports", "patternExportPatternPartials": [], @@ -103,7 +116,9 @@ "enabled": true, "initialized": false, "options": { - "tabsToAdd": ["scss"] + "tabsToAdd": [ + "scss" + ] } } } diff --git a/packages/development-edition-engine-handlebars/source/_data/data.json b/packages/development-edition-engine-handlebars/source/_data/data.json index 250376db0..9177a2289 100644 --- a/packages/development-edition-engine-handlebars/source/_data/data.json +++ b/packages/development-edition-engine-handlebars/source/_data/data.json @@ -1,34 +1,14 @@ { - "version": "2", - "swatches": [ - { - "color": { - "hex": "#031636", - "cmyk": "94 59 0 79" - }, - "label": "dark blue" - }, - { - "color": { - "hex": "#0D80F0", - "cmyk": "95 47 0 6" - }, - "label": "light blue" - }, - { - "color": { - "hex": "#4c4c4c", - "cmyk": "0 0 0 70" - }, - "label": "dark grey" - }, - { - "color": { - "hex": "#b2b2b2", - "cmyk": "0 0 0 30" - }, - "label": "light grey", - "inverted": true - } - ] + "company": { + "name": "Company Name", + "url": "http://company.com" + }, + "page": { + "title": "This is the page title", + "description": "This is the page description" + }, + "title": "Title ipsum dolor sit (39 characters)", + "description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.", + "url": "#", + "htmlText": "

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ipsam necessitatibus reprehenderit ipsum repellat quasi ratione sit possimus 🙂 eveniet, ea, ut mollitia repudiandae eligendi unde aperiam molestiae voluptatibus error. Dolorem, iure.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer fringilla sem a urna porttitor fringilla. Nulla eget justo felis. eget volutpat justo mattis nec. Sed a orci turpis. Aliquam aliquet placerat dui.

This is a second-level heading

Aliquam erat volutpat. Mauris vulputate scelerisque feugiat. Cras a erat a diam venenatis aliquam. Sed tempus, purus ac pretium varius, risus orci sagittis purus, quis auctor libero magna nec magna. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Maecenas eros dolor.

  1. Ordered list item
  2. Another ordered list item
  3. Yet another ordered list item

This is a third-level heading

Aliquam ultrices cursus mauris, eget volutpat justo mattis nec. Sed a orci turpis. Aliquam aliquet placerat dui, consectetur tincidunt leo tristique et. Vivamus enim nisi, blandit a venenatis quis, convallis et arcu. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris libero sapien, placerat in sodales eu, tempor quis dui. Vivamus egestas faucibus pulvinar. Maecenas eget diam nunc. Phasellus at sem eros, ac suscipit neque. Phasellus sollicitudin libero a odio dignissim scelerisque. Aliquam purus nulla, tempor eget ullamcorper quis, rhoncus non dui.

This is a linked heading

  • Bulleted list item
  • Another bulleted list item
  • Yet bulleted list item
  • And here's yet another bulleted list item
This is a blockquote. Eget volutpat justo mattis nec. Sed a orci turpis. Aliquam aliquet placerat dui, consectetur tincidunt leo eget est blandit dignissim a eu ante. Morbi augue nulla Cite Source

This is a fourth-level heading

Cras at fringilla ipsum. Donec nec libero eget est blandit dignissim a eu ante. Morbi augue nulla, luctus eu sagittis vel, malesuada ut felis. Aliquam erat volutpat. Morbi malesuada augue ac massa hendrerit fermentum. Integer scelerisque lacus a dolor convallis lobortis. Curabitur mollis ante in massa ultricies dignissim.

This is a fifth-level heading

Cras at fringilla ipsum. Donec nec libero eget est blandit dignissim a eu ante. Morbi augue nulla, luctus eu sagittis vel.

This is a sixth-level heading

Lorem ipsum dolor sit amet.

" } diff --git a/packages/development-edition-engine-handlebars/source/_data/listitems.json b/packages/development-edition-engine-handlebars/source/_data/listitems.json index c35d1076d..49d1a202f 100644 --- a/packages/development-edition-engine-handlebars/source/_data/listitems.json +++ b/packages/development-edition-engine-handlebars/source/_data/listitems.json @@ -1,6 +1,3 @@ { - "1": {}, - "2": {}, - "3": {}, - "4": {} + } diff --git a/packages/development-edition-engine-handlebars/source/_meta/_00-head.mustache b/packages/development-edition-engine-handlebars/source/_meta/_00-head.mustache index 45ce3bb7d..76899a54a 100644 --- a/packages/development-edition-engine-handlebars/source/_meta/_00-head.mustache +++ b/packages/development-edition-engine-handlebars/source/_meta/_00-head.mustache @@ -1,17 +1,18 @@ - - {{ title }} - - + + {{ title }} + + - - + + - - {{{ patternLabHead }}} - + + + {{{ patternLabHead }}} + + - - - + + diff --git a/packages/development-edition-engine-handlebars/source/_meta/_01-foot.mustache b/packages/development-edition-engine-handlebars/source/_meta/_01-foot.mustache index 797d9418d..98d360860 100644 --- a/packages/development-edition-engine-handlebars/source/_meta/_01-foot.mustache +++ b/packages/development-edition-engine-handlebars/source/_meta/_01-foot.mustache @@ -1,6 +1,9 @@ + - -{{{ patternLabFoot }}} + + + {{{ patternLabFoot }}} + - + From 1742dcd595462dd2cb302ec42344fdd7a59e7689 Mon Sep 17 00:00:00 2001 From: Josef Bredreck Date: Thu, 17 Dec 2020 21:33:27 +0100 Subject: [PATCH 06/11] #1237 Update pattern doc locations --- packages/core/src/lib/readDocumentation.js | 9 ++++++--- packages/docs/src/docs/pattern-hiding.md | 8 ++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/packages/core/src/lib/readDocumentation.js b/packages/core/src/lib/readDocumentation.js index d3d1e9808..02862c345 100644 --- a/packages/core/src/lib/readDocumentation.js +++ b/packages/core/src/lib/readDocumentation.js @@ -12,6 +12,7 @@ const changes_hunter = new ch(); const markdown_parser = new mp(); const FILE_EXTENSION = '.md'; +const GROUP_DOC_PREFIX = '_'; module.exports = function(pattern, patternlab) { try { @@ -84,7 +85,8 @@ module.exports = function(pattern, patternlab) { try { const markdownFileNameGroup = path.resolve( patternlab.config.paths.source.patterns, - pattern.patternGroup + FILE_EXTENSION + path.parse(pattern.subdir).dir, + GROUP_DOC_PREFIX + pattern.patternGroup + FILE_EXTENSION ); const markdownFileContentsGroup = fs.readFileSync( markdownFileNameGroup, @@ -113,8 +115,9 @@ module.exports = function(pattern, patternlab) { try { const markdownFileNameSubGroup = path.resolve( patternlab.config.paths.source.patterns, - pattern.patternType, - pattern.patternSubGroup + FILE_EXTENSION + path.parse(pattern.subdir).dir, + path.parse(pattern.subdir).base, + GROUP_DOC_PREFIX + pattern.patternSubGroup + FILE_EXTENSION ); const markdownFileContentsSubGroup = fs.readFileSync( markdownFileNameSubGroup, diff --git a/packages/docs/src/docs/pattern-hiding.md b/packages/docs/src/docs/pattern-hiding.md index c31e428bc..c5653f7d8 100644 --- a/packages/docs/src/docs/pattern-hiding.md +++ b/packages/docs/src/docs/pattern-hiding.md @@ -24,24 +24,24 @@ The map component... ## Hiding Pattern Groups -The same concept applies to `pattern-groups`. For example, you have a `pattern-group` named `atoms`, and you create a companion `.md` file for that group under `_patters/atoms/atoms.md`. In that case, the whole `pattern-group` and all its components will be hidden in the UI. +The same concept applies to `pattern-groups`. For example, you have a `pattern-group` named `atoms`, and you create a companion `.md` file for that group under `_patters/atoms/_atoms.md`. In that case, the whole `pattern-group` and all its components will be hidden in the UI. The doc-file resolving works the following `{patternsRoot}/{pattern-group folder name}/_{pattern-group raw name without}.md` ``` --- hidden: true --- -# atoms.md file +# _atoms.md file ``` ## Hiding Pattern Sub Groups -The same concept applies to `pattern-sub-groups`. For example, we have a `pattern-sub-group` named `buttons` which is structured under `atoms`, and we create a companion `.md` file for that group under `_patters/atoms/buttons/buttons.md`. In that case, the whole `pattern-sub-group` and all its components will be hidden in the UI. +The same concept applies to `pattern-sub-groups`. For example, you have a `pattern-sub-group` named `buttons` which is structured under `atoms`, and you create a companion `.md` file for that group under `_patters/atoms/buttons/_buttons.md`. In that case, the whole `pattern-sub-group` and all its components will be hidden in the UI. The doc-file resolving works the following `{patternsRoot}/{pattern-group folder name}/{pattern-sub-group folder name}/_{pattern-sub-group raw name without}.md` ``` --- hidden: true --- -# buttons.md file +# _buttons.md file ``` ## Additional Information From 661db7d8facf3ac267ebee85862818f6075d8ab9 Mon Sep 17 00:00:00 2001 From: Josef Bredreck Date: Thu, 17 Dec 2020 21:48:35 +0100 Subject: [PATCH 07/11] #1237 Update log warnings --- packages/core/src/lib/readDocumentation.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/packages/core/src/lib/readDocumentation.js b/packages/core/src/lib/readDocumentation.js index 02862c345..597acc5b7 100644 --- a/packages/core/src/lib/readDocumentation.js +++ b/packages/core/src/lib/readDocumentation.js @@ -74,7 +74,7 @@ module.exports = function(pattern, patternlab) { // do nothing when file not found if (err.code !== 'ENOENT') { logger.warning( - `'there was an error setting pattern keys after markdown parsing of the companion file for pattern ${pattern.patternPartial}` + `There was an error setting pattern keys after markdown parsing of the companion file for pattern ${pattern.patternPartial}` ); logger.warning(err); } @@ -103,8 +103,10 @@ module.exports = function(pattern, patternlab) { // do nothing when file not found if (err.code !== 'ENOENT') { logger.warning( - `'there was an error setting pattern group data after markdown parsing for ${path.join( - pattern.patternGroup + FILE_EXTENSION + `There was an error setting pattern group data after markdown parsing for ${path.join( + patternlab.config.paths.source.patterns, + path.parse(pattern.subdir).dir, + GROUP_DOC_PREFIX + pattern.patternGroup + FILE_EXTENSION )}` ); logger.warning(err); @@ -134,9 +136,11 @@ module.exports = function(pattern, patternlab) { // do nothing when file not found if (err.code !== 'ENOENT') { logger.warning( - `'there was an error setting pattern sub group data after markdown parsing for ${path.join( - pattern.patternType, - pattern.patternSubGroup + FILE_EXTENSION + `There was an error setting pattern sub group data after markdown parsing for ${path.join( + patternlab.config.paths.source.patterns, + path.parse(pattern.subdir).dir, + path.parse(pattern.subdir).base, + GROUP_DOC_PREFIX + pattern.patternSubGroup + FILE_EXTENSION )}` ); logger.warning(err); From 850f5d24dfeeefd7170e4618e78a4b0e5b6bc209 Mon Sep 17 00:00:00 2001 From: Josef Bredreck Date: Tue, 5 Jan 2021 13:48:54 +0100 Subject: [PATCH 08/11] Update documentation --- packages/docs/src/docs/pattern-hiding.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/docs/src/docs/pattern-hiding.md b/packages/docs/src/docs/pattern-hiding.md index c5653f7d8..06df91a90 100644 --- a/packages/docs/src/docs/pattern-hiding.md +++ b/packages/docs/src/docs/pattern-hiding.md @@ -24,7 +24,7 @@ The map component... ## Hiding Pattern Groups -The same concept applies to `pattern-groups`. For example, you have a `pattern-group` named `atoms`, and you create a companion `.md` file for that group under `_patters/atoms/_atoms.md`. In that case, the whole `pattern-group` and all its components will be hidden in the UI. The doc-file resolving works the following `{patternsRoot}/{pattern-group folder name}/_{pattern-group raw name without}.md` +The same concept applies to `pattern-groups`. For example, you have a `pattern-group` named `atoms`, and you create a companion `.md` file for that group under `_patters/atoms/_atoms.md`. In that case, the whole `pattern-group` and all its components will be hidden in the UI. The doc-file resolving works the following `{patternsRoot}/{pattern-group folder name}/_{pattern-group raw name without prefixes}.md` ``` --- @@ -35,7 +35,7 @@ hidden: true ## Hiding Pattern Sub Groups -The same concept applies to `pattern-sub-groups`. For example, you have a `pattern-sub-group` named `buttons` which is structured under `atoms`, and you create a companion `.md` file for that group under `_patters/atoms/buttons/_buttons.md`. In that case, the whole `pattern-sub-group` and all its components will be hidden in the UI. The doc-file resolving works the following `{patternsRoot}/{pattern-group folder name}/{pattern-sub-group folder name}/_{pattern-sub-group raw name without}.md` +The same concept applies to `pattern-sub-groups`. For example, you have a `pattern-sub-group` named `buttons` which is structured under `atoms`, and you create a companion `.md` file for that group under `_patters/atoms/buttons/_buttons.md`. In that case, the whole `pattern-sub-group` and all its components will be hidden in the UI. The doc-file resolving works the following `{patternsRoot}/{pattern-group folder name}/{pattern-sub-group folder name}/_{pattern-sub-group raw name without prefixes}.md` ``` --- From 47a621e21b430a1a940fdb4f58f7cf5544665275 Mon Sep 17 00:00:00 2001 From: Josef Bredreck Date: Tue, 5 Jan 2021 14:00:51 +0100 Subject: [PATCH 09/11] add a possibility to disable deprecation warnings --- packages/core/src/lib/object_factory.js | 6 ++++-- packages/docs/src/docs/pattern-hiding.md | 12 +++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/packages/core/src/lib/object_factory.js b/packages/core/src/lib/object_factory.js index 8b4ddde78..48381d45e 100644 --- a/packages/core/src/lib/object_factory.js +++ b/packages/core/src/lib/object_factory.js @@ -57,10 +57,12 @@ const Pattern = function( (prefixMatcherDeprecationCheckHidden.test(this.getDirLevel(0, info)) || prefixMatcherDeprecationCheckHidden.test(this.getDirLevel(1, info)) || prefixMatcherDeprecationCheckHidden.test(this.fileName)) && - !info.isMetaPattern + !info.isMetaPattern && + !patternlab.config.disableDeprecationWarningForHiddenPatterns ) { logger.warning( - `${info.shortNotation}/${this.fileName} "Pattern", "Group" and "Subgroup" hiding by underscore prefix (_*) will be deprecated in the future.\n See https://patternlab.io/docs/hiding-patterns-in-the-navigation/` + `${info.shortNotation}/${this.fileName} "Pattern", "Group" and "Subgroup" hiding by underscore prefix (_*) will be deprecated in the future.\n + See https://patternlab.io/docs/hiding-patterns-in-the-navigation/` ); } diff --git a/packages/docs/src/docs/pattern-hiding.md b/packages/docs/src/docs/pattern-hiding.md index 06df91a90..80fe8b20e 100644 --- a/packages/docs/src/docs/pattern-hiding.md +++ b/packages/docs/src/docs/pattern-hiding.md @@ -46,4 +46,14 @@ hidden: true ## Additional Information -A hidden pattern can still be included in other patterns. \ No newline at end of file +A hidden pattern can still be included in other patterns. + +## Deactivate deprecation warning + +To deactivate the deprecation warning for hidden patterns, add + +``` +disableDeprecationWarningForHiddenPatterns: true +``` + +to the `patternlab-config.json` \ No newline at end of file From 728a58a89c82c06f777ef12fda57f5b27b309409 Mon Sep 17 00:00:00 2001 From: Josef Bredreck Date: Tue, 5 Jan 2021 14:32:51 +0100 Subject: [PATCH 10/11] Fix failing test by misssing config --- packages/core/src/lib/object_factory.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/core/src/lib/object_factory.js b/packages/core/src/lib/object_factory.js index 48381d45e..8f7f936dc 100644 --- a/packages/core/src/lib/object_factory.js +++ b/packages/core/src/lib/object_factory.js @@ -58,6 +58,8 @@ const Pattern = function( prefixMatcherDeprecationCheckHidden.test(this.getDirLevel(1, info)) || prefixMatcherDeprecationCheckHidden.test(this.fileName)) && !info.isMetaPattern && + patternlab && + patternlab.config && !patternlab.config.disableDeprecationWarningForHiddenPatterns ) { logger.warning( From f8e9c32ae2ae1aa1b7b278932a9054f872940849 Mon Sep 17 00:00:00 2001 From: Josef Bredreck Date: Tue, 5 Jan 2021 14:36:33 +0100 Subject: [PATCH 11/11] Fix message text --- packages/core/src/lib/object_factory.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/core/src/lib/object_factory.js b/packages/core/src/lib/object_factory.js index 8f7f936dc..633edfa38 100644 --- a/packages/core/src/lib/object_factory.js +++ b/packages/core/src/lib/object_factory.js @@ -63,8 +63,7 @@ const Pattern = function( !patternlab.config.disableDeprecationWarningForHiddenPatterns ) { logger.warning( - `${info.shortNotation}/${this.fileName} "Pattern", "Group" and "Subgroup" hiding by underscore prefix (_*) will be deprecated in the future.\n - See https://patternlab.io/docs/hiding-patterns-in-the-navigation/` + `${info.shortNotation}/${this.fileName} "Pattern", "Group" and "Subgroup" hiding by underscore prefix (_*) will be deprecated in the future.\n See https://patternlab.io/docs/hiding-patterns-in-the-navigation/` ); }