summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordefanor <defanor@uberspace.net>2017-12-15 05:17:34 +0300
committerdefanor <defanor@uberspace.net>2017-12-15 05:20:59 +0300
commit3313c829f8bb5b1330f525930f84c3460cb2ded5 (patch)
tree10b155fc2524cf5997846b4d358892e908529325
parent188b435accffb0438a929077cc8e8a77446c268c (diff)
Add mediawiki.xsl
-rw-r--r--.config/pancake/config.yaml1
-rw-r--r--.config/pancake/unclutter/mediawiki.xsl23
2 files changed, 24 insertions, 0 deletions
diff --git a/.config/pancake/config.yaml b/.config/pancake/config.yaml
index fa3028f..9ddffda 100644
--- a/.config/pancake/config.yaml
+++ b/.config/pancake/config.yaml
@@ -59,6 +59,7 @@ unclutter:
github-project: ^https://github\.com/[^/]+/[^/]+/?$
hoogle: ^https://www\.haskell\.org/hoogle/\?hoogle=
hackage-haddock: ^https?://hackage\.haskell\.org/package/[^/]+/docs/[^/]+$
+ mediawiki: ^https://en\.(m.)?(wiktionary|wikipedia)\.org/wiki/
defaultCommand: ! 'curl --compressed -4 -L -w "
-pancake-
diff --git a/.config/pancake/unclutter/mediawiki.xsl b/.config/pancake/unclutter/mediawiki.xsl
new file mode 100644
index 0000000..5fd1e06
--- /dev/null
+++ b/.config/pancake/unclutter/mediawiki.xsl
@@ -0,0 +1,23 @@
+<?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="/">
+ <xsl:apply-templates select="//div[@id='content']" />
+ </xsl:template>
+
+ <!-- Cut these out -->
+ <xsl:template match="span[@class='mw-editsection']" />
+ <xsl:template match="ul[@id='page-actions']" />
+ <xsl:template match="div[@class='mw-ui-icon mw-ui-icon-element indicator']" />
+ <xsl:template match="a[@class='mw-ui-icon mw-ui-icon-element mw-ui-icon-edit-enabled edit-page']" />
+
+
+ <!-- Catch-all: copy and apply templates -->
+ <xsl:template match="node()" priority="0">
+ <xsl:copy>
+ <xsl:copy-of select="@*" />
+ <xsl:apply-templates />
+ </xsl:copy>
+ </xsl:template>
+</xsl:stylesheet>