@@ -502,7 +502,19 @@ def publish_doc(self, docname, output):
502502
503503 data = self ._prepare_page_data (docname , output )
504504
505- if conf .confluence_publish_root and is_root_doc :
505+ metadata = self .metadata .get (docname , {})
506+ docguid = metadata .get ('guid' )
507+
508+ forced_page_id = self .app .emit_firstresult (
509+ 'confluence-publish-override-pageid' , docname , {
510+ 'guid' : docguid ,
511+ 'title' : title ,
512+ })
513+
514+ if forced_page_id :
515+ uploaded_id = self .publisher .store_page_by_id (title ,
516+ forced_page_id , data )
517+ elif conf .confluence_publish_root and is_root_doc :
506518 uploaded_id = self .publisher .store_page_by_id (title ,
507519 conf .confluence_publish_root , data )
508520 else :
@@ -590,6 +602,12 @@ def publish_doc(self, docname, output):
590602 if uploaded_id in self .legacy_pages :
591603 self .legacy_pages .remove (uploaded_id )
592604
605+ if uploaded_id :
606+ self .app .emit ('confluence-publish-page' , docname , uploaded_id , {
607+ 'guid' : docguid ,
608+ 'title' : title ,
609+ })
610+
593611 def _prepare_page_data (self , docname , output ):
594612 data = {
595613 'content' : output ,
@@ -664,6 +682,13 @@ def publish_asset(self, key, docname, output, type_, hash_):
664682 if attachment_id in legacy_asset_info :
665683 legacy_asset_info .pop (attachment_id , None )
666684
685+ if attachment_id :
686+ self .app .emit ('confluence-publish-attachment' ,
687+ docname , key , attachment_id , {
688+ 'hash' : hash_ ,
689+ 'type' : type_ ,
690+ })
691+
667692 def publish_finalize (self ):
668693 if self .root_doc_page_id :
669694 if self .config .confluence_root_homepage is True :
0 commit comments