summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordefanor <defanor@uberspace.net>2017-12-15 00:05:18 +0300
committerdefanor <defanor@uberspace.net>2017-12-15 00:05:18 +0300
commit157e520082510e78808051d3bc2b46ae5a5bb1cc (patch)
tree6be4c0f9ced74691c342969515bd9f9defac8c93
parent0c430f7d5287db519aaca8d0fd4771c3047a8856 (diff)
Add XSLTs for Hoogle and Hackage
-rw-r--r--.config/pancake/config.yaml9
-rw-r--r--.config/pancake/unclutter/hackage-haddock.xsl25
-rw-r--r--.config/pancake/unclutter/hoogle.xsl22
3 files changed, 53 insertions, 3 deletions
diff --git a/.config/pancake/config.yaml b/.config/pancake/config.yaml
index af28301..fa3028f 100644
--- a/.config/pancake/config.yaml
+++ b/.config/pancake/config.yaml
@@ -51,11 +51,14 @@ shortcuts:
gp: gopher://gopherpedia.com:70/7/lookup?
vs: gopher://gopher.floodgap.com/7/v2/vs?
xiph: http://dir.xiph.org/search?search=
+ hoogle: https://www.haskell.org/hoogle/?hoogle=
unclutter:
hacker-news: ^https://news\.ycombinator\.com/((news|show|ask).*)?$
- duckduckgo: ^https://duckduckgo.com/lite/\?q=
- lobsters: ^https://lobste.rs/((page|recent|newest).*)?$
- github-project: ^https://github.com/[^/]+/[^/]+/?$
+ duckduckgo: ^https://duckduckgo\.com/lite/\?q=
+ lobsters: ^https://lobste\.rs/((page|recent|newest).*)?$
+ github-project: ^https://github\.com/[^/]+/[^/]+/?$
+ hoogle: ^https://www\.haskell\.org/hoogle/\?hoogle=
+ hackage-haddock: ^https?://hackage\.haskell\.org/package/[^/]+/docs/[^/]+$
defaultCommand: ! 'curl --compressed -4 -L -w "
-pancake-
diff --git a/.config/pancake/unclutter/hackage-haddock.xsl b/.config/pancake/unclutter/hackage-haddock.xsl
new file mode 100644
index 0000000..e10b66c
--- /dev/null
+++ b/.config/pancake/unclutter/hackage-haddock.xsl
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+ <xsl:output method="html" indent="yes"/>
+ <xsl:template match="/">
+ <html>
+ <body>
+ <!-- Mostly copying, just inserting horizontal rules before
+ function descriptions. -->
+ <xsl:copy-of select="//div[@id='package-header']" />
+ <xsl:copy-of select="//div[@id='module-header']" />
+ <xsl:copy-of select="//div[@id='description']" />
+ <xsl:copy-of select="//div[@id='table-of-contents']" />
+ <xsl:copy-of select="//div[@id='synopsis']" />
+ <div id="interface">
+ <xsl:for-each select="//div[@id='interface']/node()">
+ <xsl:if test="@class = 'top'">
+ <hr />
+ </xsl:if>
+ <xsl:copy-of select="." />
+ </xsl:for-each>
+ </div>
+ </body>
+ </html>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/.config/pancake/unclutter/hoogle.xsl b/.config/pancake/unclutter/hoogle.xsl
new file mode 100644
index 0000000..87a4ea4
--- /dev/null
+++ b/.config/pancake/unclutter/hoogle.xsl
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+ <xsl:output method="html" indent="yes"/>
+ <xsl:template match="/">
+ <html>
+ <body>
+ Hoogle: <xsl:value-of select="//h1" />
+ <ul>
+ <xsl:for-each select="//div[@class='ans']">
+ <li>
+ <xsl:copy-of select="a[@class='a']" />
+ <xsl:value-of select="a[position()=3]" />
+ <xsl:copy-of select="following::div[position()=1]" />
+ <xsl:copy-of select="following::div[position()=2]" />
+ <br/>
+ </li>
+ </xsl:for-each>
+ </ul>
+ </body>
+ </html>
+ </xsl:template>
+</xsl:stylesheet>