dlang.org endpoint for permanent links to DIPs

Seb seb at wilzba.ch
Wed Jun 3 13:25:05 UTC 2020


On Wednesday, 3 June 2020 at 12:29:09 UTC, Dennis wrote:
> Given an issue number, getting the URL for that issue is not 
> hard. Just put it into this string:
> https://issues.dlang.org/show_bug.cgi?id=#####
>
> DIPs, however, have it harder. Early DIPs are at:
>
> https://wiki.dlang.org/DIP##
>
> DIPs above 1000 under review can be found like this:
>
> https://github.com/dlang/DIPs/blob/master/DIPs/DIP####.md
>
> But after review, it will be moved to sub folders like 
> 'accepted', 'rejected' and 'other'. Consequently, links to DIPs 
> can easily become dead, for example:
>
> https://github.com/dlang/dmd/pull/10817
>
> You can use a permanent link to a commit on GitHub, but those 
> are very long and refer to the DIP at that moment, not the most 
> recent version.
>
> Can we create an endpoint on dlang.org that redirects to the 
> latest version of a DIP? Something like:
>
> https://dips.dlang.org/####
> https://www.dlang.org/dips/####
>
> I would try to implement this myself but I'm not an experienced 
> web developer, and as far as I can tell only the static content 
> of dlang.org is open source, so help from people in charge of 
> the dlang.org domain would be appreciated.

Yeah, I fully agree that DIP links breaking when their status 
changes is a really big problem. I also wrote to Mike about this 
a while ago.

I guess the easiest/quickest option is to add redirects to 
dlang.org.
This can be done by adding "Redirect 301 /dips/1028 
https://github.com/.../"

https://github.com/dlang/dlang.org/blob/master/.htaccess

However, I think this will require quite a bit of manual 
maintenance and is easy to forget, so the best option is to 
render the Markdown into HTML automatically at the DIPs 
repository, which can then continuously be deployed to e.g. 
dips.dlang.org

If someone is interested in doing this little project, it can be 
done entirely with D, e.g.

https://vibed.org/api/vibe.textfilter.markdown/filterMarkdown

For deployment with Netlify + D, a netlify.sh and netlify.toml 
are required. Something like this:

cat > netlify.toml << EOF
[build]
   base    = ""
   publish = "out"
   command = "bash netlify.sh"
EOF

cat > netlify.sh << 'EOF'
#!/bin/bash

DMD_VERSION="2.092.0"
BUILD_DIR="out"

CURL_FLAGS=(-fsSL --retry 10 --retry-delay 30 --retry-max-time 
600 --connect-timeout 5 --speed-time 30 --speed-limit 1024)

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "${DIR}"

. "$(curl "${CURL_FLAGS[@]}" https://dlang.org/install.sh | bash 
-s install "dmd-${DMD_VERSION}" --activate)"

# Build and run project to generate HTML pages
dub
EOF




More information about the Digitalmars-d mailing list