Skip to content

Commit c8bbf37

Browse files
committed
docs: generate index within Julia
1 parent 43458a9 commit c8bbf37

File tree

2 files changed

+26
-7
lines changed

2 files changed

+26
-7
lines changed

docs/make.jl

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,32 @@ using Documenter
22
using DynamicExpressions
33
using Random: AbstractRNG
44

5+
readme = joinpath(@__DIR__, "..", "README.md")
6+
7+
index_content = let r=read(readme, String)
8+
# Clean img tags:
9+
r2 = replace(r, r"""<img src="([^"]+)"[^>]*>""" => "![](\1)")
10+
# Remove div tags:
11+
r3 = replace(r2, r"<div[^>]*>" => "")
12+
# Remove end div tags:
13+
r4 = replace(r3, r"</div>" => "")
14+
15+
top_part = """
16+
# Contents
17+
18+
```@contents
19+
Pages = ["utils.md", "api.md", "eval.md"]
20+
```
21+
"""
22+
23+
join((top_part, r4), "\n")
24+
end
25+
26+
index_md = joinpath(@__DIR__, "src", "index.md")
27+
open(index_md, "w") do f
28+
write(f, index_content)
29+
end
30+
531
makedocs(;
632
sitename="DynamicExpressions.jl",
733
authors="Miles Cranmer",
@@ -12,7 +38,6 @@ makedocs(;
1238
)
1339

1440
# Forward links from old docs:
15-
1641
redirect_page = """
1742
<!DOCTYPE html>
1843
<html lang="en">

docs/src/index.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)