diff --git a/.JuliaFormatter.toml b/.JuliaFormatter.toml index 6bd59fd..323237b 100644 --- a/.JuliaFormatter.toml +++ b/.JuliaFormatter.toml @@ -1,3 +1 @@ -style = "sciml" -format_docstrings = true -margin = 80 +style = "blue" diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..10e19a4 --- /dev/null +++ b/Makefile @@ -0,0 +1,15 @@ +JULIA=$(shell which julia) +TEST_PROCEDURE="import Pkg;Pkg.test()" + +format: + $(JULIA) format_project.jl + +test%: + $(JULIA) $* --project -e $(TEST_PROCEDURE) 2&> test-$*.log + +testall: test+lts test+beta test+release + +clean: + rm test*.log + +.PHONY: format, test, testall, clean diff --git a/Project.toml b/Project.toml index 0ec622c..f60090e 100644 --- a/Project.toml +++ b/Project.toml @@ -7,21 +7,31 @@ version = "0.3.0" AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c" Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" HypertextLiteral = "ac1192a8-f4b3-4bfe-ba22-af5b92cd3ab2" -OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" SnoopPrecompile = "66db9d55-30c0-4569-8b51-7e840670fc0c" TimeZones = "f269a46b-ccf7-5d73-abea-4c690281aa53" +[weakdeps] +TimeZones = "f269a46b-ccf7-5d73-abea-4c690281aa53" + +[extensions] +TimeZonesExt = "TimeZones" + [compat] AbstractTrees = "0.4" -OrderedCollections = "1" -SnoopPrecompile = "1" HypertextLiteral = "0.9" +SnoopPrecompile = "1" TimeZones = "1" julia = "1" [extras] +AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c" +Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" +Gumbo = "708ec375-b3d6-5a57-a7ce-8257bf98657a" +JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" +JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" +pandoc_jll = "c5432543-76ad-5c9d-82bf-db097047a5e2" [targets] -test = ["Test"] +test = ["AbstractTrees", "Aqua", "Gumbo", "JET", "JSON", "Test", "pandoc_jll"] diff --git a/README.md b/README.md index b6547fb..72af198 100644 --- a/README.md +++ b/README.md @@ -173,3 +173,7 @@ There are three main steps for turning Norg files into HTML (since it's the only 3. Code generation (turning the AST into HTML) Earlier Norg.jl would rely on Julia's type system, but that made the code type-unstable. That's why I refactored it using a kind of enumeration to label each token and node of the AST. I did not invent anything here, it comes straight from [JuliaSyntax.jl](https://github.com/JuliaLang/JuliaSyntax.jl/) super cool ideas. + +## Projects using Norg.jl + +- [neorg-dashboard](https://github.com/isentropic/neorg-dashboard), a simple filewatcher and renderer of norg in julia. diff --git a/docs/make.jl b/docs/make.jl index 9a914f1..290a7a4 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -10,18 +10,19 @@ end; md_path = joinpath(@__DIR__, "src", "1.0-specification.md") ast = norg(s) function mk_toc(ast) - toc_tree = filter(!isnothing, [mk_toc(ast, c) for c in children(ast.root)]) + return toc_tree = filter(!isnothing, [mk_toc(ast, c) for c in children(ast.root)]) end function mk_toc(ast, node) c = children(node) if !Norg.AST.is_heading(node) nothing - else - h, node_children... = c + else + h, node_children... = c level = Norg.AST.heading_level(node) - (title=Norg.Codegen.textify(ast, h), - level = level, - children=filter([mk_toc(ast, c) for c in node_children]) do c + ( + title=Norg.Codegen.textify(ast, h), + level=level, + children=filter([mk_toc(ast, c) for c in node_children]) do c if isnothing(c) false elseif c.level >= 3 @@ -31,16 +32,14 @@ function mk_toc(ast, node) else true end - end + end, ) end end toc = mk_toc(ast) function mk_html_toc(toc_elem) - href = "#"*"h$(toc_elem.level)-"*Norg.Codegen.idify(toc_elem.title) - lis = [ - @htl("
  • $(mk_html_toc(t))
  • ") for t in toc_elem.children - ] + href = "#" * "h$(toc_elem.level)-" * Norg.Codegen.idify(toc_elem.title) + lis = [@htl("
  • $(mk_html_toc(t))
  • ") for t in toc_elem.children] @htl """$(toc_elem.title)