functional-docs
Advanced tools
Comparing version 0.0.5 to 0.0.6
{ | ||
"name": "functional-docs", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"author": "Garen Torikian", | ||
@@ -5,0 +5,0 @@ "keywords": ["documentation", "docs", "testing", "html"], |
@@ -1,2 +0,1 @@ | ||
var util = require("util"); | ||
var fs = require('fs'); | ||
@@ -6,3 +5,2 @@ var path = require('path'); | ||
var jsdom = require('jsdom'); | ||
var async = require('async'); | ||
@@ -17,3 +15,3 @@ exports.checkMissingImage = function(filename, doc, callback) { | ||
if (src === undefined || src.length == 0) { | ||
if (src === undefined || src.length === 0) { | ||
errors.push(printMessage("Missing src attribute", filename));//, l, lines[l])); | ||
@@ -79,5 +77,16 @@ } | ||
else { // if the hash file doesn't exist, this is an internal hash (i.e. "href='#blah'") | ||
if (doc.getElementById(hashId) == null) { | ||
// get attributes "name" | ||
errors.push(printMessage(filename + " has an incorrect internal hash to '#" + hashId + "'", filename)); | ||
if (doc.getElementById(hashId) === null) { | ||
// checking the name attribute; I weep to do this twice | ||
var foundName = false; | ||
var links = doc.getElementsByTagName('a'); | ||
for(var i = 0; i< links.length; i++){ | ||
var n = links[i].getAttribute("name"); | ||
if (n && n == hashId) { | ||
found = true; | ||
break; | ||
} | ||
} | ||
if (!found) | ||
errors.push(printMessage(filename + " has an incorrect internal hash to '#" + hashId + "'", filename)); | ||
} | ||
@@ -105,5 +114,5 @@ else { | ||
var refDirName = href.substr(0, lastSlashPos); | ||
refFileName = href.substr(lastSlashPos + 1); | ||
var refFileName = href.substr(lastSlashPos + 1); | ||
if (refDirName.length == 0 || lastSlashPos < 0) { | ||
if (refDirName.length === 0 || lastSlashPos < 0) { | ||
refDirName = path.dirname(filepath); | ||
@@ -128,2 +137,2 @@ } | ||
return msg + " in " + path.basename(filename);// + " around line " + line + ": " + string; | ||
}; | ||
} |
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
25616
237
1