From 8d1c7f5333b3076ad923a8ff894544ab5a7704d1 Mon Sep 17 00:00:00 2001 From: Mark Pitblado Date: Mon, 16 Dec 2024 06:01:07 -0800 Subject: [PATCH 01/11] feat: add codeberg as possible repository --- terminal/partials/page-content/revision.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/terminal/partials/page-content/revision.html b/terminal/partials/page-content/revision.html index 1f195aa7..822013d6 100644 --- a/terminal/partials/page-content/revision.html +++ b/terminal/partials/page-content/revision.html @@ -31,6 +31,8 @@ {%- if config.repo_name == "Bitbucket" -%} See revision history on {{ config.repo_name }}. {%- endif -%} + {%- if config.repo_name == "Codeberg" -%} + See revision history on {{ config.repo_name }}. {%- endif -%} @@ -38,4 +40,4 @@ {%- endif -%} -{%- endif -%} \ No newline at end of file +{%- endif -%} From 89b92a853b7d61199ee8e427a299c0edc7fb8ff6 Mon Sep 17 00:00:00 2001 From: Mark Pitblado Date: Mon, 16 Dec 2024 06:03:35 -0800 Subject: [PATCH 02/11] fix: align style to match bitbucket --- terminal/partials/page-content/revision.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terminal/partials/page-content/revision.html b/terminal/partials/page-content/revision.html index 822013d6..58f1d8ae 100644 --- a/terminal/partials/page-content/revision.html +++ b/terminal/partials/page-content/revision.html @@ -32,7 +32,7 @@ See revision history on {{ config.repo_name }}. {%- endif -%} {%- if config.repo_name == "Codeberg" -%} - See revision history on {{ config.repo_name }}. + See revision history on {{ config.repo_name }}. {%- endif -%} From 280d56bd76d1f5d05a25d9cd9ace2c9f08abcec9 Mon Sep 17 00:00:00 2001 From: Mark Pitblado Date: Mon, 16 Dec 2024 06:20:51 -0800 Subject: [PATCH 03/11] fix: add missing endif --- terminal/partials/page-content/revision.html | 1 + 1 file changed, 1 insertion(+) diff --git a/terminal/partials/page-content/revision.html b/terminal/partials/page-content/revision.html index 58f1d8ae..36b04cb2 100644 --- a/terminal/partials/page-content/revision.html +++ b/terminal/partials/page-content/revision.html @@ -34,6 +34,7 @@ {%- if config.repo_name == "Codeberg" -%} See revision history on {{ config.repo_name }}. {%- endif -%} + {%- endif -%}
From bdd3d1fbca526d82dab4d17a3ea63361c1baeddf Mon Sep 17 00:00:00 2001 From: Mark Pitblado Date: Mon, 16 Dec 2024 06:25:54 -0800 Subject: [PATCH 04/11] feat: add codeberg revision link test --- tests/test_revision.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/test_revision.py b/tests/test_revision.py index acb80626..b296a890 100644 --- a/tests/test_revision.py +++ b/tests/test_revision.py @@ -138,6 +138,17 @@ def test_bitbucket_history_link(self, revision_partial, enabled_context): assert "Bitbucket" in rendered_revision assert_valid_html(rendered_revision) + def test_codeberg_history_link(self, revision_partial, enabled_context): + expected_page_source_url = "https://codeberg.org/myUsername/myRepository/commits/main/docs/index.md" + enabled_context["page"]["meta"]["revision_date"] = "2023/03/04" + enabled_context["page"]["edit_url"] = "https://codeberg.org/myUsername/myRepository/_edit/main/docs/index.md" + enabled_context["config"]["repo_name"] = "Codeberg" + context_data = enabled_context + rendered_revision = revision_partial.render(context_data) + assert "Page last updated 2023/03/04. See revision history on" in rendered_revision + assert "Codeberg" in rendered_revision + assert_valid_html(rendered_revision) + def test_last_updated_text_hidden_when_date_disabled_on_page(self, revision_partial, enabled_context): enabled_context["page"]["meta"]["hide"] = [page_features.HIDE_REVISION_DATE_ON_PAGE] context_data = enabled_context From 7d1c42be48b04e3cbd82b3c981bfde6e9d44f5a9 Mon Sep 17 00:00:00 2001 From: Mark Pitblado Date: Mon, 16 Dec 2024 06:29:50 -0800 Subject: [PATCH 05/11] docs: outline configuration for codeberg --- .../docs/configuration/plugins/git-revision.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/documentation/docs/configuration/plugins/git-revision.md b/documentation/docs/configuration/plugins/git-revision.md index 35f8fbb6..39332a49 100644 --- a/documentation/docs/configuration/plugins/git-revision.md +++ b/documentation/docs/configuration/plugins/git-revision.md @@ -122,7 +122,21 @@ theme: - revision.history ``` +## Codeberg +### MkDocs projet in root directory +```yaml +repo_url: https://codeberg.org/exampleUser/exampleRepository +edit_url_template: _edit/main/docs/{path} +plugins: + - git-revision-date + +theme: + name: terminal + features: + - revision.date + - revision.history +``` ## Adding Repository Hosts If your repository is not stored on GitHub or Bitbucket and you would like to use this feature please [submit a feature request] on GitHub. @@ -130,4 +144,4 @@ If your repository is not stored on GitHub or Bitbucket and you would like to us You can further customize what revision information is included on the page by implementing your own `revision` template block. See [Blocks] for more information. [submit a feature request]: https://github.com/ntno/mkdocs-terminal/issues/new/choose -[Blocks]: ../../blocks \ No newline at end of file +[Blocks]: ../../blocks From 93a1ab998df70996408136aa2fa87d3696397ac5 Mon Sep 17 00:00:00 2001 From: Mark Pitblado Date: Mon, 16 Dec 2024 06:37:32 -0800 Subject: [PATCH 06/11] docs: add codeberg to list of already implemented --- documentation/docs/configuration/plugins/git-revision.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/docs/configuration/plugins/git-revision.md b/documentation/docs/configuration/plugins/git-revision.md index 39332a49..d30b1abc 100644 --- a/documentation/docs/configuration/plugins/git-revision.md +++ b/documentation/docs/configuration/plugins/git-revision.md @@ -139,7 +139,7 @@ theme: ``` ## Adding Repository Hosts -If your repository is not stored on GitHub or Bitbucket and you would like to use this feature please [submit a feature request] on GitHub. +If your repository is not stored on GitHub, Bitbucket or Codeberg and you would like to use this feature please [submit a feature request] on GitHub. You can further customize what revision information is included on the page by implementing your own `revision` template block. See [Blocks] for more information. From a81f4a7bfaf5b4ff0889edac8599ccd100c95280 Mon Sep 17 00:00:00 2001 From: Mark Pitblado Date: Mon, 16 Dec 2024 16:50:25 -0800 Subject: [PATCH 07/11] docs: add oxford comma --- documentation/docs/configuration/plugins/git-revision.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/docs/configuration/plugins/git-revision.md b/documentation/docs/configuration/plugins/git-revision.md index d30b1abc..fba025f9 100644 --- a/documentation/docs/configuration/plugins/git-revision.md +++ b/documentation/docs/configuration/plugins/git-revision.md @@ -139,7 +139,7 @@ theme: ``` ## Adding Repository Hosts -If your repository is not stored on GitHub, Bitbucket or Codeberg and you would like to use this feature please [submit a feature request] on GitHub. +If your repository is not stored on GitHub, Bitbucket, or Codeberg and you would like to use this feature please [submit a feature request] on GitHub. You can further customize what revision information is included on the page by implementing your own `revision` template block. See [Blocks] for more information. From c8b5fff345fdde2ab1f2db8cb70d902a9f7f7484 Mon Sep 17 00:00:00 2001 From: Mark Pitblado Date: Mon, 16 Dec 2024 16:56:24 -0800 Subject: [PATCH 08/11] fix: add `branch` to revision url Codeberg will automatically redirect if not included, but best to be precise --- terminal/partials/page-content/revision.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terminal/partials/page-content/revision.html b/terminal/partials/page-content/revision.html index 36b04cb2..ab5b1782 100644 --- a/terminal/partials/page-content/revision.html +++ b/terminal/partials/page-content/revision.html @@ -32,7 +32,7 @@ See revision history on {{ config.repo_name }}. {%- endif -%} {%- if config.repo_name == "Codeberg" -%} - See revision history on {{ config.repo_name }}. + See revision history on {{ config.repo_name }}. {%- endif -%} {%- endif -%} From 4062dd29d0928100826514969e58732ae00ac121 Mon Sep 17 00:00:00 2001 From: Mark Pitblado Date: Mon, 16 Dec 2024 18:35:52 -0800 Subject: [PATCH 09/11] fix: update test with `branch` --- tests/test_revision.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_revision.py b/tests/test_revision.py index b296a890..a57fad67 100644 --- a/tests/test_revision.py +++ b/tests/test_revision.py @@ -139,14 +139,14 @@ def test_bitbucket_history_link(self, revision_partial, enabled_context): assert_valid_html(rendered_revision) def test_codeberg_history_link(self, revision_partial, enabled_context): - expected_page_source_url = "https://codeberg.org/myUsername/myRepository/commits/main/docs/index.md" + expected_page_history_url = "https://codeberg.org/myUsername/myRepository/commits/branch/main/docs/index.md" enabled_context["page"]["meta"]["revision_date"] = "2023/03/04" enabled_context["page"]["edit_url"] = "https://codeberg.org/myUsername/myRepository/_edit/main/docs/index.md" enabled_context["config"]["repo_name"] = "Codeberg" context_data = enabled_context rendered_revision = revision_partial.render(context_data) assert "Page last updated 2023/03/04. See revision history on" in rendered_revision - assert "Codeberg" in rendered_revision + assert "Codeberg" in rendered_revision assert_valid_html(rendered_revision) def test_last_updated_text_hidden_when_date_disabled_on_page(self, revision_partial, enabled_context): From 756779854a5db698c94b17a9a802a5815babefbe Mon Sep 17 00:00:00 2001 From: Mark Pitblado Date: Mon, 16 Dec 2024 18:37:15 -0800 Subject: [PATCH 10/11] fix: bump theme version --- package.json | 2 +- terminal/theme_version.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 6c4fdfb3..0334c651 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mkdocs-terminal", - "version": "4.6.0", + "version": "4.7.0", "description": "Terminal.css theme for MkDocs", "keywords": [ "mkdocs", diff --git a/terminal/theme_version.html b/terminal/theme_version.html index dac69815..a76bff4a 100644 --- a/terminal/theme_version.html +++ b/terminal/theme_version.html @@ -1 +1 @@ - \ No newline at end of file + From 67bb0ce16f4a3ca35dcc87918970f89f5ac2dbf8 Mon Sep 17 00:00:00 2001 From: Mark Pitblado Date: Mon, 16 Dec 2024 20:58:06 -0800 Subject: [PATCH 11/11] fix: edge case with trailing slashes this prevents a file with the name `_edit` from causing an error --- terminal/partials/page-content/revision.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terminal/partials/page-content/revision.html b/terminal/partials/page-content/revision.html index ab5b1782..6938f803 100644 --- a/terminal/partials/page-content/revision.html +++ b/terminal/partials/page-content/revision.html @@ -32,7 +32,7 @@ See revision history on {{ config.repo_name }}. {%- endif -%} {%- if config.repo_name == "Codeberg" -%} - See revision history on {{ config.repo_name }}. + See revision history on {{ config.repo_name }}. {%- endif -%} {%- endif -%}