Compare commits
3 Commits
v0.3.3
...
cleanupfea
Author | SHA1 | Date | |
---|---|---|---|
1b2f9deed1 | |||
136d9c72b6 | |||
f3553e9dfd |
@ -66,6 +66,7 @@ class MkdocsWithConfluence(BasePlugin):
|
|||||||
self.repo_url = None
|
self.repo_url = None
|
||||||
self.header_message = None
|
self.header_message = None
|
||||||
self.upstream_url = None
|
self.upstream_url = None
|
||||||
|
self.page_ids = []
|
||||||
|
|
||||||
|
|
||||||
def on_config(self, config):
|
def on_config(self, config):
|
||||||
@ -139,6 +140,13 @@ class MkdocsWithConfluence(BasePlugin):
|
|||||||
for path in page.url.rsplit("/", 2)[0].split("/"):
|
for path in page.url.rsplit("/", 2)[0].split("/"):
|
||||||
logger.debug(f"path is {path}")
|
logger.debug(f"path is {path}")
|
||||||
parent_id = self.find_page_id(parent_page)
|
parent_id = self.find_page_id(parent_page)
|
||||||
|
if not parent_id:
|
||||||
|
self.add_page(parent_page, None, SECTION_PAGE_CONTENT)
|
||||||
|
parent_id = self.find_page_id(parent_page)
|
||||||
|
# --------------------------------------------------------
|
||||||
|
# -- Add it to the list only if it was created by plugin
|
||||||
|
# --------------------------------------------------------
|
||||||
|
self.page_ids.append(parent_id)
|
||||||
if path:
|
if path:
|
||||||
if page_name:
|
if page_name:
|
||||||
page_name = page_name + " " + path
|
page_name = page_name + " " + path
|
||||||
@ -148,6 +156,8 @@ class MkdocsWithConfluence(BasePlugin):
|
|||||||
self.add_page(page_name, parent_id, SECTION_PAGE_CONTENT)
|
self.add_page(page_name, parent_id, SECTION_PAGE_CONTENT)
|
||||||
parent_page = page_name
|
parent_page = page_name
|
||||||
parent_id = self.find_page_id(parent_page)
|
parent_id = self.find_page_id(parent_page)
|
||||||
|
self.page_ids.append(parent_id)
|
||||||
|
|
||||||
confluence_page_name = parent_page + " " + page.title
|
confluence_page_name = parent_page + " " + page.title
|
||||||
new_markdown = markdown
|
new_markdown = markdown
|
||||||
# -- Adding an upstream url
|
# -- Adding an upstream url
|
||||||
@ -182,6 +192,7 @@ class MkdocsWithConfluence(BasePlugin):
|
|||||||
logger.debug(f"attachments: {attachments}")
|
logger.debug(f"attachments: {attachments}")
|
||||||
confluence_body = self.confluence_mistune(new_markdown)
|
confluence_body = self.confluence_mistune(new_markdown)
|
||||||
self.add_page(confluence_page_name, parent_id, confluence_body)
|
self.add_page(confluence_page_name, parent_id, confluence_body)
|
||||||
|
self.page_ids.append(self.find_page_id(confluence_page_name))
|
||||||
logger.info(f"page url = {page.url}")
|
logger.info(f"page url = {page.url}")
|
||||||
if not page.url and self.config["set_homepage"]:
|
if not page.url and self.config["set_homepage"]:
|
||||||
self.set_homepage(confluence_page_name)
|
self.set_homepage(confluence_page_name)
|
||||||
@ -204,6 +215,9 @@ class MkdocsWithConfluence(BasePlugin):
|
|||||||
if self.enabled:
|
if self.enabled:
|
||||||
logger.info("The author was uploading images here, maybe there was a reason for that")
|
logger.info("The author was uploading images here, maybe there was a reason for that")
|
||||||
|
|
||||||
|
def on_post_build(self, config):
|
||||||
|
logger.warning(self.page_ids)
|
||||||
|
|
||||||
def on_page_content(self, html, page, config, files):
|
def on_page_content(self, html, page, config, files):
|
||||||
return html
|
return html
|
||||||
|
|
||||||
@ -357,9 +371,10 @@ class MkdocsWithConfluence(BasePlugin):
|
|||||||
"type": "page",
|
"type": "page",
|
||||||
"title": page_name,
|
"title": page_name,
|
||||||
"space": {"key": space},
|
"space": {"key": space},
|
||||||
"ancestors": [{"id": parent_page_id}],
|
|
||||||
"body": {"storage": {"value": page_content_in_storage_format, "representation": "storage"}},
|
"body": {"storage": {"value": page_content_in_storage_format, "representation": "storage"}},
|
||||||
}
|
}
|
||||||
|
if parent_page_id:
|
||||||
|
data["ancestors"] = [{"id": parent_page_id}]
|
||||||
logger.debug(f"DATA: {data}")
|
logger.debug(f"DATA: {data}")
|
||||||
if not self.dryrun:
|
if not self.dryrun:
|
||||||
try:
|
try:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "mkdocs-with-confluence"
|
name = "mkdocs-with-confluence"
|
||||||
version = "0.3.3"
|
version = "0.3.4"
|
||||||
description = "MkDocs plugin for uploading markdown documentation to Confluence via Confluence REST API"
|
description = "MkDocs plugin for uploading markdown documentation to Confluence via Confluence REST API"
|
||||||
authors = ["Nikolai Rodionov <allanger@zohomail.com>"]
|
authors = ["Nikolai Rodionov <allanger@zohomail.com>"]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
Reference in New Issue
Block a user