diff --git a/documentation/docs/configuration/plugins/git-revision.md b/documentation/docs/configuration/plugins/git-revision.md index 35f8fbb6..fba025f9 100644 --- a/documentation/docs/configuration/plugins/git-revision.md +++ b/documentation/docs/configuration/plugins/git-revision.md @@ -122,12 +122,26 @@ 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. +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. [submit a feature request]: https://github.com/ntno/mkdocs-terminal/issues/new/choose -[Blocks]: ../../blocks \ No newline at end of file +[Blocks]: ../../blocks diff --git a/package.json b/package.json index 2b28de67..209ea9fa 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mkdocs-terminal", - "version": "4.6.1", + "version": "4.7.0", "description": "Terminal.css theme for MkDocs", "keywords": [ "mkdocs", diff --git a/terminal/partials/page-content/revision.html b/terminal/partials/page-content/revision.html index 1f195aa7..6938f803 100644 --- a/terminal/partials/page-content/revision.html +++ b/terminal/partials/page-content/revision.html @@ -31,6 +31,9 @@ {%- 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 -%} {%- endif -%} @@ -38,4 +41,4 @@ {%- endif -%} -{%- endif -%} \ No newline at end of file +{%- endif -%} diff --git a/terminal/theme_version.html b/terminal/theme_version.html index 1c01420c..8f276524 100644 --- a/terminal/theme_version.html +++ b/terminal/theme_version.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/tests/test_revision.py b/tests/test_revision.py index acb80626..a57fad67 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_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_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