aboutsummaryrefslogtreecommitdiff
path: root/pentadactyl/.pentadactylrc
diff options
context:
space:
mode:
authorAdrian Kummerlaender2016-06-03 20:23:33 +0200
committerAdrian Kummerlaender2016-06-03 20:23:33 +0200
commitcc6c4e01ffab77681d8fd6989580ce9c5c4957c3 (patch)
treecc2e2e82129371fc07f9d56a8ff3caab9d3a99ad /pentadactyl/.pentadactylrc
parentd2b24636731c0555f6561cee2eb9b4d4d375aa3b (diff)
downloaddotfiles-cc6c4e01ffab77681d8fd6989580ce9c5c4957c3.tar
dotfiles-cc6c4e01ffab77681d8fd6989580ce9c5c4957c3.tar.gz
dotfiles-cc6c4e01ffab77681d8fd6989580ce9c5c4957c3.tar.bz2
dotfiles-cc6c4e01ffab77681d8fd6989580ce9c5c4957c3.tar.lz
dotfiles-cc6c4e01ffab77681d8fd6989580ce9c5c4957c3.tar.xz
dotfiles-cc6c4e01ffab77681d8fd6989580ce9c5c4957c3.tar.zst
dotfiles-cc6c4e01ffab77681d8fd6989580ce9c5c4957c3.zip
Simplify custom note taking integration in pentadactyl
Diffstat (limited to 'pentadactyl/.pentadactylrc')
-rw-r--r--pentadactyl/.pentadactylrc24
1 files changed, 8 insertions, 16 deletions
diff --git a/pentadactyl/.pentadactylrc b/pentadactyl/.pentadactylrc
index 702c881..65312fa 100644
--- a/pentadactyl/.pentadactylrc
+++ b/pentadactyl/.pentadactylrc
@@ -43,34 +43,26 @@ EOF
map -builtin -ex <F9> :reader
command! push2inbox -js <<EOF
-function escape(msg) {
- return msg.replace(/([^a-zA-Z0-9_])/g, "\\$1");
-}
-
var selection = content.getSelection().toString();
-var entry = '\\* ' + escape(buffer.URL);
+var entry = '\* ' + buffer.URL;
if ( selection ) {
- entry += '\\n\\t\\* ' + escape(selection);
+ entry += '\\n\\t\* ' + selection;
} else if ( content.document.title ) {
- entry += '\\n\\t\\* ' + escape(content.document.title);
+ entry += '\\n\\t\* ' + content.document.title;
}
-dactyl.execute('!echo ' + entry + ' >> ~/note/src/web/inbox.wiki');
+dactyl.execute('!echo -e "' + entry + '" >> ~/note/src/web/inbox.wiki');
EOF
nmap b :push2inbox<CR>
command! cite -js <<EOF
-function escape(msg) {
- return msg.replace(/([^a-zA-Z0-9_])/g, "\\$1");
-}
-
var entry = '\\n'
- + '\\ \\ \\ \\ \\[...\\] ' + escape(content.getSelection().toString()) + ' \\[...\\]\\n'
- + '\\ \\ \\ \\ \\<br\\/\\>\\<br\\/\\>\\n'
- + '\\ \\ \\ \\ ― ' + escape(buffer.URL)
+ + '\ \ \ \ \[...\] ' + content.getSelection().toString() + ' \[...\]\\n'
+ + '\ \ \ \ \<br\/\>\<br\/\>\\n'
+ + '\ \ \ \ ― ' + buffer.URL
+ '\\n';
-dactyl.execute('!echo ' + entry + ' >> ~/note/src/web/inbox.wiki');
+dactyl.execute('!echo -e "' + entry + '" >> ~/note/src/web/inbox.wiki');
EOF
nmap c :cite<CR>