mirror of
https://github.com/namibia/tips.git
synced 2024-12-23 02:28:58 +00:00
Doing away with slug dep
This commit is contained in:
parent
04573ea87d
commit
abd2e497a2
@ -1,10 +1,18 @@
|
||||
var tips = require('./tips.json');
|
||||
var slug = require('slug');
|
||||
// from https://gist.github.com/mathewbyrne/1280286
|
||||
slugify = function(text){
|
||||
return text.toString().toLowerCase()
|
||||
.replace(/\s+/g, '-') // Replace spaces with -
|
||||
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
|
||||
.replace(/\-\-+/g, '-') // Replace multiple - with single -
|
||||
.replace(/^-+/, '') // Trim - from start of text
|
||||
.replace(/-+$/, ''); // Trim - from end of text
|
||||
}
|
||||
|
||||
var render = function(data) {
|
||||
var data = data.data;
|
||||
|
||||
var out = '* [' + data.title + '](https://github.com/git-tips/tips#' + slug(data.title) + ')\n';
|
||||
var out = '* [' + data.title + '](https://github.com/git-tips/tips#' + slugify(data.title) + ')\n';
|
||||
|
||||
if (tips[tips.length -1].title === data.title) out = out + '\n';
|
||||
return out;
|
||||
|
26
README.md
26
README.md
@ -3,19 +3,19 @@
|
||||
|
||||
<!-- @doxie.inject start toc -->
|
||||
<!-- Don’t remove or change the comment above – that can break automatic updates. -->
|
||||
* [Overwrite pull](https://github.com/git-tips/tips#Overwrite-pull)
|
||||
* [List of all the files changed in a commit](https://github.com/git-tips/tips#List-of-all-the-files-changed-in-a-commit)
|
||||
* [Git reset first commit](https://github.com/git-tips/tips#Git-reset-first-commit)
|
||||
* [List all the conflicted files](https://github.com/git-tips/tips#List-all-the-conflicted-files)
|
||||
* [List all branches that are already merged into master](https://github.com/git-tips/tips#List-all-branches-that-are-already-merged-into-master)
|
||||
* [Quickly switch to the previous branch](https://github.com/git-tips/tips#Quickly-switch-to-the-previous-branch)
|
||||
* [Remove branches that have already been merged with master](https://github.com/git-tips/tips#Remove-branches-that-have-already-been-merged-with-master)
|
||||
* [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)
|
||||
* [Track upstream branch](https://github.com/git-tips/tips#Track-upstream-branch)
|
||||
* [Delete local branch](https://github.com/git-tips/tips#Delete-local-branch)
|
||||
* [Delete remote branch](https://github.com/git-tips/tips#Delete-remote-branch)
|
||||
* [Undo local changes with the last content in head](https://github.com/git-tips/tips#Undo-local-changes-with-the-last-content-in-head)
|
||||
* [Changing a remote's URL](https://github.com/git-tips/tips#Changing-a-remotes-URL)
|
||||
* [Overwrite pull](https://github.com/git-tips/tips#overwrite-pull)
|
||||
* [List of all the files changed in a commit](https://github.com/git-tips/tips#list-of-all-the-files-changed-in-a-commit)
|
||||
* [Git reset first commit](https://github.com/git-tips/tips#git-reset-first-commit)
|
||||
* [List all the conflicted files](https://github.com/git-tips/tips#list-all-the-conflicted-files)
|
||||
* [List all branches that are already merged into master](https://github.com/git-tips/tips#list-all-branches-that-are-already-merged-into-master)
|
||||
* [Quickly switch to the previous branch](https://github.com/git-tips/tips#quickly-switch-to-the-previous-branch)
|
||||
* [Remove branches that have already been merged with master](https://github.com/git-tips/tips#remove-branches-that-have-already-been-merged-with-master)
|
||||
* [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)
|
||||
* [Track upstream branch](https://github.com/git-tips/tips#track-upstream-branch)
|
||||
* [Delete local branch](https://github.com/git-tips/tips#delete-local-branch)
|
||||
* [Delete remote branch](https://github.com/git-tips/tips#delete-remote-branch)
|
||||
* [Undo local changes with the last content in head](https://github.com/git-tips/tips#undo-local-changes-with-the-last-content-in-head)
|
||||
* [Changing a remote's URL](https://github.com/git-tips/tips#changing-a-remotes-url)
|
||||
|
||||
<!-- Don’t remove or change the comment below – that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
|
||||
<!-- @doxie.inject end toc -->
|
||||
|
@ -33,8 +33,5 @@
|
||||
"doxie.output": "^0.3.0",
|
||||
"doxie.render": "^0.3.0",
|
||||
"husky": "^0.8.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"slug": "^0.9.1"
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user