diff options
author | defanor <defanor@uberspace.net> | 2017-12-13 07:46:46 +0300 |
---|---|---|
committer | defanor <defanor@uberspace.net> | 2017-12-13 07:46:46 +0300 |
commit | f735c69d6d0d13858588c3c35317ef294f2382d6 (patch) | |
tree | 6d5e69b76a5d082b44d25a81db24e061043a3107 /README | |
parent | 3c03b674fbec2dddce744365ddc6b96daf398864 (diff) |
Add uncluttering/XSLT support
Diffstat (limited to 'README')
-rw-r--r-- | README | 36 |
1 files changed, 36 insertions, 0 deletions
@@ -92,6 +92,8 @@ simplified):: commands: gopher: torify curl "${URI}" ssh: scp "${URI_REGNAME}:${URI_PATH}" /dev/stdout + unclutter: + duckduckgo: ^https://duckduckgo\.com/lite/\?q= defaultCommand: ! 'curl --compressed -4 -L -w " -pancake- @@ -115,6 +117,40 @@ simplified):: paginate: true +Uncluttering +~~~~~~~~~~~~ + +XSLT can be used to extract useful data from HTML documents. In the +above sample configuration, ``duckduckgo`` is defined along with an +URI regex to determine when it should be applied, and the +corresponding XSLT file should be in +``~/.config/pancake/unclutter/duckduckgo.xsl``:: + + <?xml version="1.0" encoding="UTF-8"?> + <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> + <xsl:output method="xml" indent="yes"/> + <xsl:template match="/"> + <html> + <body> + <xsl:for-each select="//tr[not(@class) or @class!='result-sponsored']"> + <xsl:for-each select="td/a[@class='result-link']"> + <br /> + <br /> + <a href="{@href}"> + <xsl:value-of select="." /> + </a> + </xsl:for-each> + <xsl:for-each select="td[@class='result-snippet']"> + <br /> + <xsl:value-of select="." /> + </xsl:for-each> + </xsl:for-each> + </body> + </html> + </xsl:template> + </xsl:stylesheet> + + Screenshots ----------- |