From 4c66a07a995c0d551cd284d6e72826b4f7748bab Mon Sep 17 00:00:00 2001 From: Joe Mou Date: Thu, 3 Sep 2026 00:08:06 -0400 Subject: Render repository wikis Wikis are one of the last parts of GitHub still served as plain Rails HTML, with no embedded JSON to read, so this scrapes the markup: a page and any older revision of it, the _Sidebar and _Footer a wiki can define, and the page index. Every page is already in the sidebar of every page, since the "Show N more pages" button only unhides the rest, so linking the whole wiki costs no second request. Routes mirror GitHub's and resolve in its order, so an underscore name reserved for its own actions (_pages, _history, _new, _edit) can never be mistaken for a page; the ones we don't serve fall through to the usual redirect. A slug reaches us decoded and has to be encoded again rather than interpolated the way a ref is, or a page named C# would truncate at the fragment. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_013rQG1io1i4GJQW5RFcXNGd --- cgithub/src/app.test.ts | 98 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) (limited to 'cgithub/src/app.test.ts') diff --git a/cgithub/src/app.test.ts b/cgithub/src/app.test.ts index e28c375..3ecebd0 100644 --- a/cgithub/src/app.test.ts +++ b/cgithub/src/app.test.ts @@ -178,6 +178,104 @@ describe("embedded files", () => { }); }); +describe("wiki", () => { + const repo = { owner: "ariya", name: "phantomjs" }; + const page = { + repo, + title: "Home", + updatedBy: "pixiuPL", + updatedAt: "2018-02-08T18:57:56Z", + bodyHtml: "

New to PhantomJS?

", + sidebarHtml: null, + footerHtml: null, + pages: [ + { name: "Home", href: "/ariya/phantomjs/wiki" }, + { name: "API Reference WebPage", href: "/ariya/phantomjs/wiki/API-Reference-WebPage" }, + ], + }; + + it("should render the page beside who last edited it", () => { + const html = eta.render("wiki.eta", page); + + assert.match(html, /

New to PhantomJS<\/strong>\?<\/p>/); + assert.match(html, /pixiuPL edited this page/); + assert.match(html, /

", + footerHtml: "

fine print

", + }); + assert.match(html, /