Skip to content

Commit

Permalink
add .npmignore. minor.
Browse files Browse the repository at this point in the history
  • Loading branch information
chjj committed Aug 4, 2013
1 parent 5dd2456 commit 9eafd2e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .npmignore
@@ -0,0 +1,2 @@
.git*
test/
25 changes: 12 additions & 13 deletions test/index.js
Expand Up @@ -342,19 +342,18 @@ function fix(options) {
.replace(/&__APOS__;/g, '\'');

// add heading id's
html = html
.replace(/<(h[1-6])>([^<]+)<\/\1>/g, function(s, h, text) {
var id = text
.replace(/&#39;/g, '\'')
.replace(/&quot;/g, '"')
.replace(/&gt;/g, '>')
.replace(/&lt;/g, '<')
.replace(/&amp;/g, '&');

id = id.toLowerCase().replace(/[^\w]+/g, '-');

return '<' + h + ' id="' + id + '">' + text + '</' + h + '>';
});
html = html.replace(/<(h[1-6])>([^<]+)<\/\1>/g, function(s, h, text) {
var id = text
.replace(/&#39;/g, '\'')
.replace(/&quot;/g, '"')
.replace(/&gt;/g, '>')
.replace(/&lt;/g, '<')
.replace(/&amp;/g, '&');

id = id.toLowerCase().replace(/[^\w]+/g, '-');

return '<' + h + ' id="' + id + '">' + text + '</' + h + '>';
});

fs.writeFileSync(file, html);
});
Expand Down

0 comments on commit 9eafd2e

Please sign in to comment.