Skip to content

Commit abd2e49

Browse files
committed
Doing away with slug dep
1 parent 04573ea commit abd2e49

File tree

3 files changed

+23
-18
lines changed

3 files changed

+23
-18
lines changed

.doxie.render.toc.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
var tips = require('./tips.json');
2-
var slug = require('slug');
2+
// from https://gist.github.com/mathewbyrne/1280286
3+
slugify = function(text){
4+
return text.toString().toLowerCase()
5+
.replace(/\s+/g, '-') // Replace spaces with -
6+
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
7+
.replace(/\-\-+/g, '-') // Replace multiple - with single -
8+
.replace(/^-+/, '') // Trim - from start of text
9+
.replace(/-+$/, ''); // Trim - from end of text
10+
}
311

412
var render = function(data) {
513
var data = data.data;
614

7-
var out = '* [' + data.title + '](https://github.com/git-tips/tips#' + slug(data.title) + ')\n';
15+
var out = '* [' + data.title + '](https://github.com/git-tips/tips#' + slugify(data.title) + ')\n';
816

917
if (tips[tips.length -1].title === data.title) out = out + '\n';
1018
return out;

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33
44
<!-- @doxie.inject start toc -->
55
<!-- Don’t remove or change the comment above – that can break automatic updates. -->
6-
* [Overwrite pull](https://github.com/git-tips/tips#Overwrite-pull)
7-
* [List of all the files changed in a commit](https://github.com/git-tips/tips#List-of-all-the-files-changed-in-a-commit)
8-
* [Git reset first commit](https://github.com/git-tips/tips#Git-reset-first-commit)
9-
* [List all the conflicted files](https://github.com/git-tips/tips#List-all-the-conflicted-files)
10-
* [List all branches that are already merged into master](https://github.com/git-tips/tips#List-all-branches-that-are-already-merged-into-master)
11-
* [Quickly switch to the previous branch](https://github.com/git-tips/tips#Quickly-switch-to-the-previous-branch)
12-
* [Remove branches that have already been merged with master](https://github.com/git-tips/tips#Remove-branches-that-have-already-been-merged-with-master)
13-
* [List all branches and their upstreams, as well as last commit on branch](https://github.com/git-tips/tips#List-all-branches-and-their-upstreams-as-well-as-last-commit-on-branch)
14-
* [Track upstream branch](https://github.com/git-tips/tips#Track-upstream-branch)
15-
* [Delete local branch](https://github.com/git-tips/tips#Delete-local-branch)
16-
* [Delete remote branch](https://github.com/git-tips/tips#Delete-remote-branch)
17-
* [Undo local changes with the last content in head](https://github.com/git-tips/tips#Undo-local-changes-with-the-last-content-in-head)
18-
* [Changing a remote's URL](https://github.com/git-tips/tips#Changing-a-remotes-URL)
6+
* [Overwrite pull](https://github.com/git-tips/tips#overwrite-pull)
7+
* [List of all the files changed in a commit](https://github.com/git-tips/tips#list-of-all-the-files-changed-in-a-commit)
8+
* [Git reset first commit](https://github.com/git-tips/tips#git-reset-first-commit)
9+
* [List all the conflicted files](https://github.com/git-tips/tips#list-all-the-conflicted-files)
10+
* [List all branches that are already merged into master](https://github.com/git-tips/tips#list-all-branches-that-are-already-merged-into-master)
11+
* [Quickly switch to the previous branch](https://github.com/git-tips/tips#quickly-switch-to-the-previous-branch)
12+
* [Remove branches that have already been merged with master](https://github.com/git-tips/tips#remove-branches-that-have-already-been-merged-with-master)
13+
* [List all branches and their upstreams, as well as last commit on branch](https://github.com/git-tips/tips#list-all-branches-and-their-upstreams-as-well-as-last-commit-on-branch)
14+
* [Track upstream branch](https://github.com/git-tips/tips#track-upstream-branch)
15+
* [Delete local branch](https://github.com/git-tips/tips#delete-local-branch)
16+
* [Delete remote branch](https://github.com/git-tips/tips#delete-remote-branch)
17+
* [Undo local changes with the last content in head](https://github.com/git-tips/tips#undo-local-changes-with-the-last-content-in-head)
18+
* [Changing a remote's URL](https://github.com/git-tips/tips#changing-a-remotes-url)
1919

2020
<!-- Don’t remove or change the comment below – that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
2121
<!-- @doxie.inject end toc -->

package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,5 @@
3333
"doxie.output": "^0.3.0",
3434
"doxie.render": "^0.3.0",
3535
"husky": "^0.8.1"
36-
},
37-
"dependencies": {
38-
"slug": "^0.9.1"
3936
}
4037
}

0 commit comments

Comments
 (0)