1
1
using Documenter
2
2
using Hedgehog
3
3
4
- # Function to generate ADR pages that display raw YAML
5
- function generate_raw_adr_pages ()
6
- adr_dir = joinpath (@__DIR__ , " adr" )
7
- output_dir = joinpath (@__DIR__ , " src" , " adr" )
8
-
9
- # Create output directory if it doesn't exist
10
- isdir (output_dir) || mkdir (output_dir)
11
-
12
- # Read the index file to get list of ADRs
13
- index_path = joinpath (adr_dir, " index.yaml" )
14
- index_content = read (index_path, String)
15
-
16
- # Extract file names from index content
17
- adr_files = []
18
- for line in split (index_content, ' \n ' )
19
- if occursin (" .yaml" , line)
20
- # Extract filename from the line using regex
21
- m = match (r" \" ([^\" ]+)\" " , line)
22
- if m != = nothing
23
- push! (adr_files, m. captures[1 ])
24
- end
25
- end
26
- end
27
-
28
- # Create individual markdown pages for each ADR
29
- adr_pages = []
30
- for adr_file in adr_files
31
- adr_path = joinpath (adr_dir, adr_file)
32
-
33
- # Read the raw YAML content
34
- yaml_content = read (adr_path, String)
35
-
36
- # Extract ADR ID and title using regex
37
- adr_id = match (r" adr_id:\s *(\d +)" , yaml_content). captures[1 ]
38
- title = match (r" title:\s *\" ([^\" ]+)\" " , yaml_content). captures[1 ]
39
-
40
- # Generate a markdown file for this ADR
41
- md_filename = replace (adr_file, " .yaml" => " .md" )
42
- md_path = joinpath (output_dir, md_filename)
43
-
44
- open (md_path, " w" ) do io
45
- write (io, " # ADR-$(adr_id) : $(title) \n\n " )
46
- write (io, " ```yaml\n " )
47
- write (io, yaml_content)
48
- write (io, " ```\n " )
49
- end
50
-
51
- # Add to the list of pages
52
- push! (adr_pages, " ADR-$(adr_id) : $(title) " => " adr/$(md_filename) " )
53
- end
54
-
55
- # Create an index page for ADRs
56
- open (joinpath (output_dir, " index.md" ), " w" ) do io
57
- write (io, " # Architecture Decision Records\n\n " )
58
- write (io, " This section contains the Architecture Decision Records (ADRs) for Hedgehog.jl.\n\n " )
59
- write (io, " ## Index\n\n " )
60
-
61
- for (i, adr_file) in enumerate (adr_files)
62
- # Extract ID and title using regex from filename
63
- md_content = read (joinpath (adr_dir, adr_file), String)
64
- adr_id = match (r" adr_id:\s *(\d +)" , md_content). captures[1 ]
65
- title = match (r" title:\s *\" ([^\" ]+)\" " , md_content). captures[1 ]
66
-
67
- md_filename = replace (adr_file, " .yaml" => " .html" )
68
- write (io, " $(i) . [ADR-$(adr_id) : $(title) ](adr/$(md_filename) )\n " )
69
- end
70
-
71
- # Display the index file itself
72
- write (io, " \n ## Raw Index File\n\n " )
73
- write (io, " ```yaml\n " )
74
- write (io, index_content)
75
- write (io, " ```\n " )
76
- end
77
-
78
- return [
79
- " Overview" => " adr/index.md" ,
80
- adr_pages...
81
- ]
82
- end
83
-
84
- # Run the ADR generation function
85
- adr_pages = generate_raw_adr_pages ()
86
-
87
- # Create a simple wrapper for the roadmap
88
- roadmap_path = joinpath (@__DIR__ , " src" , " derivatives_pricing_roadmap.md" )
89
- roadmap_content = read (joinpath (@__DIR__ , " derivatives_pricing_roadmap.md" ), String)
90
- open (roadmap_path, " w" ) do io
91
- write (io, " # Derivatives Pricing Roadmap\n\n " )
92
- write (io, roadmap_content)
93
- end
94
-
95
4
makedocs (
96
5
sitename = " Hedgehog.jl" ,
97
6
modules = [Hedgehog],
@@ -106,7 +15,6 @@ makedocs(
106
15
pages = [
107
16
" Home" => " index.md" ,
108
17
" Pricing Methods" => " pricing_methods.md" ,
109
- " Architecture Decisions" => adr_pages,
110
18
" Roadmap" => " derivatives_pricing_roadmap.md" ,
111
19
" API Reference" => " api.md"
112
20
]
0 commit comments