Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support filenames with multiple dots #29

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion markdown-include.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var q = require('q');

this.ignoreTag = ' !ignore';
this.headingTag = ' !heading';
this.includePattern = /^#include\s"(.+\/|\/|\w|-|\/)+\.(md|markdown)"/gm;
this.includePattern = /^#include\s"(.+\/|\/|\w|-|\/|\.)+\.(md|markdown)"/gm;
this.ignorePattern = new RegExp('^#include\\s"(.+\\/|\\/|\\w|-|\\/)+\.(md|markdown)"' + this.ignoreTag, 'gm');
this.headingPattern = new RegExp('^#+\\s.+' + this.headingTag, 'gm');
this.tableOfContents = '';
Expand Down
3 changes: 2 additions & 1 deletion tests/data/docs/has_include_tags.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#include "tests/data/docs/1.md"
#include "tests/data/docs/2.md"
#include "tests/data/docs/2.md"
#include "tests/data/docs/3.extradot.md"
2 changes: 1 addition & 1 deletion tests/unit/findIncludeTags.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ define([
bdd.it('should return an array if include tags are found', function () {
var file = fs.readFileSync('tests/data/docs/has_include_tags.md').toString();
var findHeadingTags = markdownInclude.findIncludeTags(file);
assert.equal(findHeadingTags.length, 2, 'Heading tags length match');
assert.equal(findHeadingTags.length, 3, 'Heading tags length match');
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note I was unable to test these changes, when I run npm test I get the following error:

% npm run test 

> [email protected] test
> node_modules/.bin/intern-client config=tests/intern.js

internal/modules/cjs/loader.js:883
  throw err;
  ^

Error: Cannot find module 'dojo/dojo'
Require stack:
- /repos/markdown-include/node_modules/@theintern/dojo/dojo.js
- /repos/markdown-include/node_modules/intern/client.js
- /repos/markdown-include/node_modules/intern/bin/intern-client.js

});
});
});