summaryrefslogtreecommitdiff
path: root/.config/pancake
diff options
context:
space:
mode:
authordefanor <defanor@uberspace.net>2017-12-15 22:29:34 +0300
committerdefanor <defanor@uberspace.net>2017-12-15 22:29:34 +0300
commit4bcbee7ee1fd9da5b29aca7e249ab284e02e1c91 (patch)
treeb66571d5bebc66ed374acba8be3849d528d3d60c /.config/pancake
parent3313c829f8bb5b1330f525930f84c3460cb2ded5 (diff)
Improve github uncluttering
Diffstat (limited to '.config/pancake')
-rw-r--r--.config/pancake/config.yaml2
-rw-r--r--.config/pancake/unclutter/github-project.xsl47
-rw-r--r--.config/pancake/unclutter/github.xsl77
-rw-r--r--.config/pancake/unclutter/mediawiki.xsl6
4 files changed, 83 insertions, 49 deletions
diff --git a/.config/pancake/config.yaml b/.config/pancake/config.yaml
index 9ddffda..0e8278d 100644
--- a/.config/pancake/config.yaml
+++ b/.config/pancake/config.yaml
@@ -56,7 +56,7 @@ 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/[^/]+/[^/]+/?$
+ github: ^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/
diff --git a/.config/pancake/unclutter/github-project.xsl b/.config/pancake/unclutter/github-project.xsl
deleted file mode 100644
index 3b24c8a..0000000
--- a/.config/pancake/unclutter/github-project.xsl
+++ /dev/null
@@ -1,47 +0,0 @@
-<?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:variable name="project_uri"
- select="//strong[@itemprop='name']/a/@href"/>
- <html>
- <body>
- <!-- header -->
- <h1>
- <xsl:copy-of select="//a[@rel='author']" />
- /
- <xsl:copy-of select="//strong[@itemprop='name']/a" />
- </h1>
-
- <!-- issues and such -->
- <p>
- <a href="{$project_uri}/issues">
- issues:
- <xsl:copy-of select="//a[@data-hotkey='g i']/span[@class='Counter']" />
- </a>
- |
- <a href="{$project_uri}/pulls">
- PRs:
- <xsl:copy-of select="//a[@data-hotkey='g p']/span[@class='Counter']" />
- </a>
- |
- <a href="{$project_uri}/wiki">
- wiki
- </a>
- </p>
-
- <!-- files -->
- <p>
- <xsl:for-each select="//div[@class='file-wrap']//tr[position()>1]">
- <xsl:copy-of select="td[@class='content']//a" />
- (<xsl:copy-of select=".//time-ago" />)
- <br/>
- </xsl:for-each>
- </p>
-
- <!-- readme -->
- <xsl:copy-of select="//div[@id='readme']" />
- </body>
- </html>
- </xsl:template>
-</xsl:stylesheet>
diff --git a/.config/pancake/unclutter/github.xsl b/.config/pancake/unclutter/github.xsl
new file mode 100644
index 0000000..c4e42d4
--- /dev/null
+++ b/.config/pancake/unclutter/github.xsl
@@ -0,0 +1,77 @@
+<?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>
+ <xsl:apply-templates select="//div[@role='main']" />
+ </body>
+ </html>
+ </xsl:template>
+
+ <xsl:template match="nav[@role='navigation'] | ul[@class='numbers-summary'] | div[@class='repository-lang-stats']">
+ <p>
+ <xsl:for-each select=".//a">
+ <xsl:if test="position()>1">
+ |
+ </xsl:if>
+ <a href="{@href}">
+ <xsl:value-of select="." />
+ </a>
+ </xsl:for-each>
+ </p>
+ </xsl:template>
+
+ <!-- files -->
+ <xsl:template match="div[@class='file-wrap']">
+ <div>
+ <xsl:for-each select=".//tr[position()>1]">
+ <xsl:copy-of select="td[@class='content']//a" />
+ (<xsl:copy-of select=".//time-ago" />)
+ <br/>
+ </xsl:for-each>
+ </div>
+ </xsl:template>
+
+ <!-- code -->
+ <xsl:template match="table[@class='highlight tab-size js-file-line-container']">
+ <pre>
+ <xsl:for-each select=".//td[@class='blob-code blob-code-inner js-file-line']">
+ <xsl:value-of select="." />
+ <xsl:text>&#xa;</xsl:text>
+ </xsl:for-each>
+ </pre>
+ </xsl:template>
+
+ <!-- watch, star, fork -->
+ <xsl:template match="ul[@class='pagehead-actions']" />
+ <!-- signup -->
+ <xsl:template match="div[@class='signup-prompt-bg rounded-1']" />
+ <!-- languages, duplication -->
+ <xsl:template match="div[@class='repository-lang-stats-graph js-toggle-lang-stats']" />
+ <!-- misc clutter -->
+ <xsl:template match="div[@class='js-socket-channel js-updatable-content']" />
+ <xsl:template match="div[@class='mt-3 mb-2 text-center']" />
+ <xsl:template match="div[@class='subnav']" />
+ <!-- issue filters and such -->
+ <xsl:template match="div[@id='js-issues-toolbar']" />
+ <!-- registration thing -->
+ <xsl:template match="div[@class='px-4']" />
+ <!-- another "sign up for free" thing -->
+ <xsl:template match="div[@class='flash flash-warn mt-3']" />
+ <!-- protips -->
+ <xsl:template match="div[@class='protip']" />
+ <!-- branch selection, new PR, etc -->
+ <xsl:template match="div[@class='file-navigation in-mid-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>
diff --git a/.config/pancake/unclutter/mediawiki.xsl b/.config/pancake/unclutter/mediawiki.xsl
index 5fd1e06..2c64c38 100644
--- a/.config/pancake/unclutter/mediawiki.xsl
+++ b/.config/pancake/unclutter/mediawiki.xsl
@@ -3,7 +3,11 @@
<xsl:output method="html" indent="yes"/>
<xsl:template match="/">
- <xsl:apply-templates select="//div[@id='content']" />
+ <html>
+ <body>
+ <xsl:apply-templates select="//div[@id='content']" />
+ </body>
+ </html>
</xsl:template>
<!-- Cut these out -->