mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-09-30 01:53:43 +08:00
pivot
This commit is contained in:
@@ -48,7 +48,7 @@ jobs:
|
||||
|
||||
# Append sync footer
|
||||
gh_url = f'https://github.com/sunnypilot/sunnypilot/blob/{GITHUB_BRANCH}/docs_sp/{DOC_PATH}'
|
||||
body = body.rstrip('\n') + f'\n\n---\n<small>This document is version-controlled. Suggest changes [on GitHub]({gh_url}).</small>\n\n<!-- docs-sync-id: {DOC_PATH} -->\n'
|
||||
body = body.rstrip('\n') + f'\n\n---\n<small>This document is version-controlled. Suggest changes [on GitHub]({gh_url}).</small>\n<small>docs-sync-id: {DOC_PATH}</small>\n'
|
||||
|
||||
# Extract title from front matter or first heading
|
||||
title = None
|
||||
|
||||
@@ -98,9 +98,11 @@ class DiscourseClient:
|
||||
# ----- Public API -----
|
||||
|
||||
def find_topic_by_sync_id(self, sync_id: str) -> dict[str, Any] | None:
|
||||
"""Find an existing topic by its embedded sync ID comment.
|
||||
"""Find an existing topic by its embedded sync ID marker.
|
||||
|
||||
Searches for topics containing <!-- docs-sync-id: {sync_id} -->.
|
||||
Searches for topics containing the visible sync ID text
|
||||
``docs-sync-id: {sync_id}``. The marker must be visible (not an
|
||||
HTML comment) so that Discourse indexes it.
|
||||
|
||||
Args:
|
||||
sync_id: The doc path used as sync identifier.
|
||||
@@ -108,7 +110,7 @@ class DiscourseClient:
|
||||
Returns:
|
||||
Topic dict with at least 'id' key, or None if not found.
|
||||
"""
|
||||
query = f"<!-- docs-sync-id: {sync_id} -->"
|
||||
query = f'"docs-sync-id: {sync_id}"'
|
||||
encoded = urllib.parse.urlencode({"q": query})
|
||||
data = self._get(f"/search.json?{encoded}")
|
||||
if data is None:
|
||||
|
||||
Reference in New Issue
Block a user