~sircmpwn/sr.ht-dev

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
2 2

[PATCH hub.sr.ht] Prefix README links to rendered pages

Details
Message ID
<09453840deec1c960309.1607411552@freefall>
DKIM signature
missing
Download raw message
Patch: +6 -4
Relative links from project summaries resulted in raw pages rather
than rendered pages for both mercurial and git repositories.

This patch is intended to match the behavior of git.sr.ht and hg.sr.ht
README rendering by passing the previous raw links as secondary link
prefixes (for rendering images) but otherwise link to rendered
resources.

related ticket: todo.sr.ht/~sircmpwn/hub.sr.ht/67

diff --git a/hubsrht/services.py b/hubsrht/services.py
--- a/hubsrht/services.py
+++ b/hubsrht/services.py
@@ -120,8 +120,9 @@

        content = repo["md"] or repo["markdown"]
        if content:
            link_prefix = repo_url + "/blob/HEAD/"
            html = markdown(content["object"]["text"], link_prefix=link_prefix)
            blob_prefix = repo_url + "/blob/HEAD/"
            rendered_prefix = repo_url + "/tree/HEAD/"
            html = markdown(content["object"]["text"], link_prefix=[rendered_prefix, blob_prefix])
            return Markup(html)

        content = repo["plaintext"]
@@ -271,7 +272,8 @@
        override = try_html_readme(self.session, _hgsrht, user, repo_name)
        if override is not None:
            return override
        link_prefix = repo_url + "/raw/"
        blob_prefix = repo_url + "/raw/"
        rendered_prefix = repo_url + "/browse/"
        for readme_name in readme_names:
            r = self.session.get(f"{_hgsrht}/api/repos/{repo_name}/raw/{readme_name}",
                    headers=encrypt_request_authorization(user))
@@ -279,7 +281,7 @@
                continue
            elif r.status_code != 200:
                raise Exception(r.text)
            return format_readme(r.text, readme_name, link_prefix)
            return format_readme(r.text, readme_name, link_prefix=[rendered_prefix, blob_prefix])
        return format_readme("")

    def create_repo(self, user, valid, visibility):

[hub.sr.ht/patches] build success

builds.sr.ht <builds@sr.ht>
Details
Message ID
<C7N7W4CS6A52.1PIWBHYURA3A2@cirno>
In-Reply-To
<09453840deec1c960309.1607411552@freefall> (view parent)
DKIM signature
missing
Download raw message
hub.sr.ht/patches: SUCCESS in 2m22s

[Prefix README links to rendered pages][0] from [Nolan Prescott][1]

[0]: https://lists.sr.ht/~sircmpwn/sr.ht-dev/patches/15845
[1]: mail@nprescott.com

✓ #362217 SUCCESS hub.sr.ht/patches/archlinux.yml https://builds.sr.ht/~sircmpwn/job/362217
✓ #362218 SUCCESS hub.sr.ht/patches/debian.yml    https://builds.sr.ht/~sircmpwn/job/362218
✓ #362216 SUCCESS hub.sr.ht/patches/alpine.yml    https://builds.sr.ht/~sircmpwn/job/362216
Details
Message ID
<C7NGA04LXE25.32UCY9M060F2N@taiga>
In-Reply-To
<09453840deec1c960309.1607411552@freefall> (view parent)
DKIM signature
missing
Download raw message
Thanks!

To git@git.sr.ht:~sircmpwn/hub.sr.ht
   64cd1e0..5c97b72  master -> master
Reply to thread Export thread (mbox)