Skip to content

Commit

Permalink
Bump dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
bezoerb committed May 10, 2021
1 parent 0ae94df commit 361a702
Show file tree
Hide file tree
Showing 7 changed files with 1,806 additions and 1,166 deletions.
8 changes: 3 additions & 5 deletions cli.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/usr/bin/env node
'use strict';

const os = require('os');
const fs = require('fs');
const path = require('path');
Expand Down Expand Up @@ -93,8 +91,8 @@ if (cli.flags['update-notifier'] !== false) {
updateNotifier({pkg: packageJson}).notify();
}

function logError(err) {
process.stderr.write(indentString(chalk.red('Error: ' + err.message || err), 3));
function logError(error) {
process.stderr.write(indentString(chalk.red('Error: ' + error.message || error), 3));
process.stderr.write(os.EOL);
process.stderr.write(indentString(help, 3));
process.exit(1);
Expand Down Expand Up @@ -127,7 +125,7 @@ function prepare(data) {
if (error) {
logError(error);
} else {
fs.writeFile(filepath, data, (err) => (err && logError(error)) || run(filepath));
fs.writeFile(filepath, data, (error_) => (error_ && logError(error)) || run(filepath));
}
}
);
Expand Down
8 changes: 4 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,15 @@ const fetchHtml = (url, options) =>
// Replace relative php links with corresponding html link
if (body && options.processLinks) {
const linkRegex = /href=['"]([^'"]+\.php(?:\?[^'"]*)?)['"]/gm;
(body.match(linkRegex) || []).forEach((link) => {
if (link.match(/:\/\//)) {
return;
for (const link of body.match(linkRegex) || []) {
if (/:\/\//.test(link)) {
continue;
}

const hlink = link.replace(/(\w)\.php(\W)/g, '$1.html$2');

body = body.replace(link, hlink);
});
}
}

resolve(body);
Expand Down

0 comments on commit 361a702

Please sign in to comment.