Commit 19920616 authored by Iván Sánchez Ortega's avatar Iván Sánchez Ortega

Bump deshortify dependency; refactor a bit newline stuff

parent e291b1c3
......@@ -9,11 +9,10 @@
"dependencies": {
"chalk256": "^5.1.0",
"configstore": "^3.0.0",
"deshortify": "^0.1.2",
"deshortify": "^0.2.2",
"flatten-obj": "^3.1.0",
"he": "^1.1.1",
"inquirer": "^3.0.6",
"json-stringify-safe": "^5.0.1",
"mastodon-api": "^1.1.1",
"oauth": "^0.9.15",
"striptags": "^3.0.1",
......@@ -28,5 +27,6 @@
"devDependencies": {
"rollup": "^0.41.6",
"rollup-plugin-buble": "^0.15.0"
}
},
"bin": "dist/soclial.js"
}
import chalk from 'chalk256';
/// TODO: make these replacements configurable. Somehow "␤" and "␍" UTF8 chars
/// break spacing on terminal emulators.
let newline = String.fromCharCode(9252); // "␤", http://www.fileformat.info/info/unicode/char/2424/index.htm
let carReturn = String.fromCharCode(9229); // "␍", http://www.fileformat.info/info/unicode/char/240d/index.htm
// Turns a soCLIal item into a string, prettyfied with chalk.
export default function stringify(conf, item) {
let { str, channel, realtime, timestamp, account } = item;
......@@ -35,7 +38,9 @@ export default function stringify(conf, item) {
quotedStr = '\n ' + stringify(conf, item.quoted);
}
str = str.replace(/\n/g, ' ␤ ');
str = str.replace(/\n/g, newline);
str = str.replace(/\r/g, carReturn);
let formatted =
(sender ? (' <' + chalk.bold(sender) + '>') : '') +
......@@ -44,8 +49,5 @@ export default function stringify(conf, item) {
formattedMedia +
quotedStr;
/// TODO: handle quotes (by recursive call)
/// TODO: handle echoes/boosts/RT (by recursive call)
return formatted;
}
......@@ -333,9 +333,9 @@ delayed-stream@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619"
deshortify@^0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/deshortify/-/deshortify-0.1.2.tgz#fbc6c7aab4efdd6e08bd91e153f27d5e3a821502"
deshortify@^0.2.2:
version "0.2.2"
resolved "https://registry.yarnpkg.com/deshortify/-/deshortify-0.2.2.tgz#3a0525f6e83bd05ee92288fe88a25b6bbbc6d7ed"
doctrine@^2.0.0:
version "2.0.0"
......@@ -923,7 +923,7 @@ json-stable-stringify@^1.0.0, json-stable-stringify@^1.0.1:
dependencies:
jsonify "~0.0.0"
json-stringify-safe@^5.0.1, json-stringify-safe@~5.0.1:
json-stringify-safe@~5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment