summaryrefslogtreecommitdiff
path: root/.config/pancake/unclutter/github.xsl
blob: c4e42d4c5272517980f040e12f43775184b1d191 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
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>