Skip to content

Commit

Permalink
Merge pull request #24 from marcel-hofer/feature/20-fix-include-paths
Browse files Browse the repository at this point in the history
Allow '-', '.' and ' ' in include file paths
  • Loading branch information
marcel-hofer authored Nov 4, 2017
2 parents 9d085bd + 3c538e3 commit 75ec68c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions specs/services/markdown/include-plugin-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ describe('IncludePlugin', function() {

// Special cases
{ input: '@(include path/to/file.md)', match: true, file: 'path/to/file.md' },
{ input: '@(include file_1.md)', match: true, file: 'file_1.md' },
{ input: '@(include file-1.md)', match: true, file: 'file-1.md' },
{ input: '@(include file.1.md)', match: true, file: 'file.1.md' },
{ input: '@(include file 1.md)', match: true, file: 'file 1.md' },

// Non-matching cases
{ input: '# Title', match: false, file: '' },
Expand Down Expand Up @@ -227,6 +231,4 @@ describe('IncludePlugin', function() {
should.throws(act);
});
});


});
2 changes: 1 addition & 1 deletion src/services/markdown/include-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import fileService from "../file-service";
*/
export class IncludePlugin {
public static readonly IDENTIFIER = 'include';
public static readonly REGEX = /^\s*@\(include \s*([\w\/]+\.md)\s*\)\s*$/;
public static readonly REGEX = /^\s*@\(include \s*([\w\.\- \/]+\.md)\s*\)\s*$/;

private readonly dependencyManager = new DependencyManager();

Expand Down

0 comments on commit 75ec68c

Please sign in to comment.