From abd2e497a24511714ecdcd20f21e60f18134fa08 Mon Sep 17 00:00:00 2001 From: "Hemanth.HM" Date: Thu, 16 Jul 2015 09:16:42 +0530 Subject: [PATCH] Doing away with slug dep --- .doxie.render.toc.js | 12 ++++++++++-- README.md | 26 +++++++++++++------------- package.json | 3 --- 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/.doxie.render.toc.js b/.doxie.render.toc.js index ea4df5e..97e2bb8 100644 --- a/.doxie.render.toc.js +++ b/.doxie.render.toc.js @@ -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; diff --git a/README.md b/README.md index b76911f..6d74c39 100644 --- a/README.md +++ b/README.md @@ -3,19 +3,19 @@ -* [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) diff --git a/package.json b/package.json index 64d7229..158ea8a 100644 --- a/package.json +++ b/package.json @@ -33,8 +33,5 @@ "doxie.output": "^0.3.0", "doxie.render": "^0.3.0", "husky": "^0.8.1" - }, - "dependencies": { - "slug": "^0.9.1" } }