From fe7e5cb78cee7c1069a00bd35d8090fb94e835fe Mon Sep 17 00:00:00 2001 From: odow Date: Mon, 11 Sep 2023 17:17:19 +1200 Subject: [PATCH 1/5] [docs] move literate footer to header --- docs/make.jl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/make.jl b/docs/make.jl index 3ac1508a811..b286be69b76 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -43,8 +43,14 @@ function _link_example(content) "" => "https://github.com/jump-dev/JuMP.jl/tree/master", ) end - return content * - "---\n\n!!! tip\n This tutorial was generated using [Literate.jl](https://github.com/fredrikekre/Literate.jl). [View the source `.jl` file on GitHub]($(edit_url)).\n" + title = match(r"\n\# (.+?)\n", content) + new_title = string( + "$(title[1])\n", + "\n", + "_This tutorial was generated using [Literate.jl](https://github.com/fredrikekre/Literate.jl)._\n", + "_[Download the source as a `.jl` file]($(edit_url))_.", + ) + return replace(content, title[1] => new_title) end function _file_list(full_dir, relative_dir, extension) From 4f83284bbaef524727b20c58573a065453e599d2 Mon Sep 17 00:00:00 2001 From: odow Date: Mon, 11 Sep 2023 18:46:52 +1200 Subject: [PATCH 2/5] Update --- docs/make.jl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/make.jl b/docs/make.jl index b286be69b76..2d3119e9158 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -43,14 +43,15 @@ function _link_example(content) "" => "https://github.com/jump-dev/JuMP.jl/tree/master", ) end - title = match(r"\n\# (.+?)\n", content) + title_line = findfirst(r"\n# # .+?\n", content) + line = content[title_line] new_title = string( - "$(title[1])\n", + line, "\n", - "_This tutorial was generated using [Literate.jl](https://github.com/fredrikekre/Literate.jl)._\n", - "_[Download the source as a `.jl` file]($(edit_url))_.", + "# _This tutorial was generated using [Literate.jl](https://github.com/fredrikekre/Literate.jl)._\n", + "# _[Download the source as a `.jl` file]($(edit_url))_.\n", ) - return replace(content, title[1] => new_title) + return replace(content, line => new_title) end function _file_list(full_dir, relative_dir, extension) From 65fb174df54cdd41554199392235057320a855f3 Mon Sep 17 00:00:00 2001 From: odow Date: Mon, 11 Sep 2023 19:03:10 +1200 Subject: [PATCH 3/5] Update --- docs/make.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/make.jl b/docs/make.jl index 2d3119e9158..9715efc966d 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -43,13 +43,13 @@ function _link_example(content) "" => "https://github.com/jump-dev/JuMP.jl/tree/master", ) end - title_line = findfirst(r"\n# # .+?\n", content) + title_line = findfirst(r"\n# .+?\n", content) line = content[title_line] new_title = string( line, "\n", - "# _This tutorial was generated using [Literate.jl](https://github.com/fredrikekre/Literate.jl)._\n", - "# _[Download the source as a `.jl` file]($(edit_url))_.\n", + "_This tutorial was generated using [Literate.jl](https://github.com/fredrikekre/Literate.jl)._\n", + "_[Download the source as a `.jl` file]($(edit_url))_.\n", ) return replace(content, line => new_title) end From 62f7d28a92064818145ec7f6d5016944c46f9e87 Mon Sep 17 00:00:00 2001 From: Oscar Dowson Date: Tue, 12 Sep 2023 08:26:25 +1200 Subject: [PATCH 4/5] Update docs/make.jl --- docs/make.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/make.jl b/docs/make.jl index 9715efc966d..5f74be2844f 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -49,7 +49,7 @@ function _link_example(content) line, "\n", "_This tutorial was generated using [Literate.jl](https://github.com/fredrikekre/Literate.jl)._\n", - "_[Download the source as a `.jl` file]($(edit_url))_.\n", + "_[Download the source as a `.jl` file]($(replace(edit_url, "_" => "\\_")))_.\n", ) return replace(content, line => new_title) end From bf32e95ef5b213046db9f2c075e1eb35ad04ace0 Mon Sep 17 00:00:00 2001 From: Oscar Dowson Date: Tue, 12 Sep 2023 10:17:06 +1200 Subject: [PATCH 5/5] Update docs/make.jl --- docs/make.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/make.jl b/docs/make.jl index 5f74be2844f..730936c546c 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -49,7 +49,7 @@ function _link_example(content) line, "\n", "_This tutorial was generated using [Literate.jl](https://github.com/fredrikekre/Literate.jl)._\n", - "_[Download the source as a `.jl` file]($(replace(edit_url, "_" => "\\_")))_.\n", + "[_Download the source as a `.jl` file_]($edit_url).\n", ) return replace(content, line => new_title) end