aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-01-08 13:45:53 +0100
committerbptato <nincsnevem662@gmail.com>2023-01-08 13:46:26 +0100
commit7bed16fa67df23f1bd1156e709a4b959b274b2ca (patch)
tree02c2cf0c57333e6984bd861126dc318eb363fba0
parent844fec3672b6b3f5da3362798e93036e20e9fac9 (diff)
downloadchawan-7bed16fa67df23f1bd1156e709a4b959b274b2ca.tar.gz
res/config, doc/config: encode search query strings
-rw-r--r--doc/config.md28
-rw-r--r--res/config.toml2
2 files changed, 15 insertions, 15 deletions
diff --git a/doc/config.md b/doc/config.md
index 70db113a..e8421f4d 100644
--- a/doc/config.md
+++ b/doc/config.md
@@ -1,23 +1,23 @@
# Configuration
-Chawan supports custom keybindings and user stylesheets. The configuration
-format is very similar to the toml format, with the following exceptions:
+Chawan supports configuration of various options like keybindings, user
+stylesheets, site preferences, etc. The configuration format is very similar
+to toml, with the following exceptions:
-* Table arrays can be cleared like this:
-```
-omnirule = []
+* Inline tables may span across multiple lines.
+* Table arrays can be cleared by setting a variable by the same to the
+ empty array. This allows users to disable default table array rules.
-[[omnirule]] # this is accepted
+Example:
```
-This allows users to disable default table array rules. Note that these
-declarations must be placed at the beginning of the file.
+omnirule = [] # note: this must be placed at the beginning of the file.
-* Inline tables may span across multiple lines. Rationale: the toml specified
- behavior is counter-intuitive.
+[[omnirule]] # this is legal. all default omni-rules are now disabled.
+```
Chawan will look for a config file in the ~/.config/chawan/ directory called
-`config.toml`. See the default configuration in the res/ folder for the default
-configuration.
+`config.toml`. See the default configuration file in the res/ folder, and
+bonus configuration files in the bonus/ folder for further examples.
**Table of contents**
@@ -216,12 +216,12 @@ Examples:
# Search using DuckDuckGo Lite. (Bound to C-k by default.)
[[omnirule]]
match = '^ddg:'
-substitute-url = '(x) => "https://lite.duckduckgo.com/lite/?kp=-1&kd=-1&q=" + x.substring(4)'
+substitute-url = '(x) => "https://lite.duckduckgo.com/lite/?kp=-1&kd=-1&q=" + encodeURIComponent(x.split(":").slice(1).join(":"))'
# Search using Wikipedia, Firefox-style.
[[omnirule]]
match = '^@wikipedia'
-substitute-url = '(x) => "https://en.wikipedia.org/wiki/Special:Search?search=" + x.replace(/@wikipedia/, "")'
+substitute-url = '(x) => "https://en.wikipedia.org/wiki/Special:Search?search=" + encodeURIComponent(x.replace(/@wikipedia/, ""))'
```
Omnirule options:
diff --git a/res/config.toml b/res/config.toml
index 968e4626..541f28e3 100644
--- a/res/config.toml
+++ b/res/config.toml
@@ -27,7 +27,7 @@ force-clear = false
[[omnirule]]
match = '^ddg:'
-substitute-url = '(x) => "https://lite.duckduckgo.com/lite/?kp=-1&kd=-1&q=" + x.split(":").slice(1).join(":")'
+substitute-url = '(x) => "https://lite.duckduckgo.com/lite/?kp=-1&kd=-1&q=" + encodeURIComponent(x.split(":").slice(1).join(":"))'
[page]
q = 'quit()'