Created
          February 26, 2024 10:38 
        
      - 
      
 - 
        
Save tdalon/59ec4e0f7aa5da6b8634f56f21d502b8 to your computer and use it in GitHub Desktop.  
    Confluence: Get Version Information
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | Confluence_GetVerLink(url:="") { ; @fun_Confluence_GetVerLink@ | |
| ; Get Link information from current page Url | |
| ; sHtml := Confluence_GetVerLink(url:="") | |
| If (url="") | |
| url := Browser_GetUrl() | |
| If (url="") | |
| return | |
| ; Get current pageId | |
| pageId := Confluence_GetPageId(url) | |
| rootUrl := Confluence_GetRootUrl() | |
| pageInfo := Confluence_GetPageInfo(pageId,rootUrl) | |
| ; If Confluence Document History page, get parentId | |
| If RegExMatch(pageInfo["title"],"i)^(Document|Work Product) History") { | |
| pageId := pageInfo["parentId"] | |
| pageInfo := Confluence_GetPageInfo(pageId,rootUrl) | |
| } | |
| ;MsgBox % Jxon_Dump(pageInfo) ; DBG | |
| version := pageInfo["version"] | |
| sText := version["createdAt"] . " (v." . version["number"] . ")" | |
| sLink := rootUrl . "/pages/viewpage.action?pageId=" . pageId . "&pageVersion=" . version["number"] | |
| sHtml := "<a href=""" . sLink . """>" . sText . "</a>" | |
| return sHtml | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #If Confluence_IsWinActive() | |
| ::,ver:: ; Page version info | |
| sHtml := Confluence_GetVerLink(url:="") | |
| Clip_PasteHtml(sHtml) | |
| return | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment