Skip to content

Commit

Permalink
Merge pull request #109 from Herb-AI/documentation-tutorials-md
Browse files Browse the repository at this point in the history
Automatically build md from Pluto notebooks using PlutoStaticHTML.
  • Loading branch information
ReubenJ authored Oct 4, 2024
2 parents 09120fe + 250f5c2 commit fd0a9d4
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 127 deletions.
41 changes: 19 additions & 22 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
using Documenter
using Documenter:
HTML,
deploydocs,
makedocs

using Pluto, PlutoSliderServer
using PlutoStaticHTML
using Pkg: Pkg

using Herb

Expand All @@ -11,27 +15,20 @@ using HerbInterpret
using HerbCore
using HerbSpecification

# Create md file for tutorial that embeds html file
basedir = joinpath(@__DIR__, "src", "tutorials")
html_files = filter!(f -> occursin(r"\.html$", f), readdir(basedir)) # assumes all html file in directory are tutorials
tutorials_dir = joinpath(dirname(@__DIR__), "docs", "src", "tutorials")

for f in html_files
html_path = joinpath(basedir, f)
filename = replace(f, ".html" => "")
md_path = joinpath(basedir, "$filename.md")
content = """
# Tutorial $filename
<iframe src="$html_path" width="100%" height="600px"></iframe>
"""
open(md_path, "w") do file
write(
file,
content
)
end
function build()
println("Building notebooks in $tutorials_dir")
use_distributed = false
output_format = documenter_output
bopts = BuildOptions(tutorials_dir; use_distributed, output_format)
build_notebooks(bopts)
Pkg.activate(@__DIR__)
return nothing
end

build()


makedocs(
modules=[HerbConstraints, HerbSearch, HerbGrammar, HerbSpecification, HerbInterpret, HerbCore],
Expand Down Expand Up @@ -62,9 +59,9 @@ makedocs(
"HerbSearch.jl" => "HerbSearch/index.md",
],
],
format=Documenter.HTML(
format=HTML(
sidebar_sitename=false,
size_threshold=512000,
size_threshold=2^20,
),
warnonly=[:missing_docs, :cross_references, :doctest]
)
Expand Down
18 changes: 0 additions & 18 deletions docs/src/tutorials/abstract_syntax_trees.html

This file was deleted.

17 changes: 0 additions & 17 deletions docs/src/tutorials/advanced_search.html

This file was deleted.

9 changes: 7 additions & 2 deletions docs/src/tutorials/advanced_search.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ using PlutoUI
using HerbGrammar, HerbSpecification, HerbSearch, HerbInterpret, HerbConstraints, HerbCore


# ╔═╡ e0b2bfe8-bad3-47a3-803f-04b4a9deb232
using Test

# ╔═╡ dddca175-3d88-45ce-90da-575c0ba38175
md"""
# Advanced Search Procedures in Herb.jl
Expand Down Expand Up @@ -139,7 +142,7 @@ problem_2 = Problem([IOExample(Dict(), x) for x ∈ 1:5])
iterator_3 = BFSIterator(g_2, :Index, max_depth=2)

# ╔═╡ 4821fd3a-ff2d-4991-99ad-76608d11b1da
solution_3 = synth(problem_2, iterator_3)
Test.@test_throws HerbSearch.EvaluationError synth(problem_2, iterator_3)

# ╔═╡ b2eb08d7-3e53-46c5-84b1-e1fa0e07e291
md"""
Expand Down Expand Up @@ -470,6 +473,7 @@ HerbInterpret = "5bbddadd-02c5-4713-84b8-97364418cca7"
HerbSearch = "3008d8e8-f9aa-438a-92ed-26e9c7b4829f"
HerbSpecification = "6d54aada-062f-46d8-85cf-a1ceaf058a06"
PlutoUI = "7f904dfe-b85e-4ff6-b463-dae2292396a8"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
[compat]
HerbConstraints = "~0.2.2"
Expand All @@ -487,7 +491,7 @@ PLUTO_MANIFEST_TOML_CONTENTS = """
julia_version = "1.10.4"
manifest_format = "2.0"
project_hash = "e8df13c29bfd5a0060b6c72e678efa3df418b0d7"
project_hash = "0ffb99b60bda019fda3cc31f30ebdb78c9cca62d"
[[deps.AbstractPlutoDingetjes]]
deps = ["Pkg"]
Expand Down Expand Up @@ -1235,6 +1239,7 @@ version = "0.13.1+0"
# ╠═9fb40ceb-8d41-491b-8941-20a8b240eb82
# ╠═94e0d676-a9c7-4291-8696-15301e541c30
# ╠═a4a7daed-f89b-44ad-8787-9199c05bf046
# ╠═e0b2bfe8-bad3-47a3-803f-04b4a9deb232
# ╠═4821fd3a-ff2d-4991-99ad-76608d11b1da
# ╟─b2eb08d7-3e53-46c5-84b1-e1fa0e07e291
# ╠═606070e1-83a7-4cca-a716-4fa459f78772
Expand Down
17 changes: 0 additions & 17 deletions docs/src/tutorials/defining_grammars.html

This file was deleted.

17 changes: 0 additions & 17 deletions docs/src/tutorials/getting_started_with_constraints.html

This file was deleted.

17 changes: 0 additions & 17 deletions docs/src/tutorials/getting_started_with_herb.html

This file was deleted.

17 changes: 0 additions & 17 deletions docs/src/tutorials/working_with_interpreters.html

This file was deleted.

0 comments on commit fd0a9d4

Please sign in to comment.