about summary refs log tree commit diff homepage
path: root/utils.jl
blob: 0569335a52240452c78c833896adae5c774595f4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
using Printf

function hfun_abslink(args)
  path = args[1]
  return @sprintf("<a href=/%s>%s</a>", path, pagevar(path, "title"))
end

function hfun_pep(args)
  postfix = length(args) < 2 ? "" : '#' * args[2]
  return @sprintf(
    "<a href=https://www.python.org/dev/peps/pep-%04d%s>PEP %s%s</a>",
    Meta.parse(args[1]), postfix, args[1], postfix)
end

function hfun_github(args)
  return @sprintf("<a href=https://github.com/%s>@%s</a>",
                  args[1], args[1])
end

function hfun_pip(args)
  content = length(args) < 2 ? "GH-" * args[1] : args[2]
  return @sprintf("<a href=https://github.com/pypa/pip/pull/%s>%s</a>",
                  args[1], content)
end