From: James Thomas <jimjoe@gmx.net>
To: help-gnu-emacs@gnu.org
Subject: Browsing Github using eww
Date: Sat, 27 Jul 2024 17:42:25 +0530 [thread overview]
Message-ID: <86sevvt4nq.fsf@gmx.net> (raw)
I had, by now, accumulated the following hacks:
--8<---------------cut here---------------start------------->8---
;; For eww-url-transformers
(defun eww-redirect-github (url)
"Redirect github.com automatically."
(replace-regexp-in-string "^https://\\(github.com/\\(.*?\\)/blob\\)/.*" "raw.githubusercontent.com/\\2" url t nil 1))
;; For file list being hidden.
(defun my/eww-tag-script (dom)
(when-let ((url (eww-current-url))
(_ (string-prefix-p "https://github.com/" url))
(_ (string= "application/json" (dom-attr dom 'type)))
(_ (string= "react-app.embeddedData" (dom-attr dom 'data-target)))
(start (point)))
(seq-map (lambda (i)
(shr-ensure-newline)
(shr-tag-a
(dom-node
'a
(list
(cons
'href
(replace-regexp-in-string
"https://github.com/[a-zA-Z0-9-_.]+/[a-zA-Z0-9-_.]+/tree/[a-zA-Z0-9-_.]+/\\(.+\\)"
(gethash "path" i) url t t 1)))
(gethash "name" i))))
(gethash
"items"
(gethash
"tree"
(gethash
"payload"
(json-parse-string (car (dom-children dom)))))))
;; (put-text-property start (point) 'face 'shr-code)
))
(setq shr-external-rendering-functions '((script . my/eww-tag-script)))
--8<---------------cut here---------------end--------------->8---
...for this, but I've realized that the latter, for e.g. may not be
necessary: refreshing the page 3-4 times gets a version with the files
list shown.
So I was wondering if someone out there has something better (simpler,
cheaper, more reliable) to share. Or know of anyone maybe compiling any
such workarounds - for others like Gitlab as well?
Regards,
James
next reply other threads:[~2024-07-27 12:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-27 12:12 James Thomas [this message]
2024-07-27 19:41 ` Browsing Github using eww tpeplt
2024-07-27 22:15 ` James Thomas
2024-08-02 19:32 ` Björn Bidar
[not found] ` <87msluoh4y.fsf@>
2024-08-02 21:52 ` James Thomas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86sevvt4nq.fsf@gmx.net \
--to=jimjoe@gmx.net \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.