Update a table in confluence page with a JIRA link

J S S S Bharath February 20, 2024

Hello 

We have a python script which has dependencies outside JIRA (viz. an internal regression report, email, a user, and user decided JIRA)

This script updates a table in a confluence page, and we want the JIRA link to be visible in the table-cell.

for e.g.

If we try and paste a JIRA link manually, copy the link and paste in the cell, it gets formatted differently. Viz

If I paste this url "https://jira.<other_address>.com/browse/<jira_number>" by ctrl-c, ctrl-v It get's auto-formatted as follows:

JIRA_Formatting.jpg

When I try the same and update the table using a python script, it's visible as the URL itself "https://jira.<other_address>.com/browse/<jira_number>"

I tried both the below methods

jJira_task_URL = f"https://jira.<other_address>.com/browse/{jJira_task} "
jJira_task_link = f'<a href="{jJira_task_URL}" target="_blank"{jJira_task_URL}></a>'

Is there any formatting detail, I'm missing when updating confluence page using python script?

Warm Regards

Bharath

1 answer

1 accepted

1 vote
Answer accepted
Andrii Maliuta
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 26, 2024

Hello @J S S S Bharath ,

The Confluence renders the link to Jira you paste into the Jira macro automatically using the rendering api if you have integration with Jira.

If you want to add the link to Jira as a macro in the Confluence page, you can specify the corresponding Storage format:

<ac:structured-macro ac:name="jira" ac:schema-version="1" >
<ac:parameter ac:name="server">JIRA</ac:parameter>
<ac:parameter ac:name="serverId">x</ac:parameter>
<ac:parameter ac:name="key">JIRA-ISSUE-KEY</ac:parameter>
</ac:structured-macro>

 

J S S S Bharath February 27, 2024

Hello @Andrii Maliuta ,

Thank you very much for the reply, I will try and let you know.

In the meanwhile can you also help in the following?

  1. HTML link to text in a cell of a table in confluence page.
    • This is similar to the JIRA key, excepting that the HTML link is not a jira
  2. How to insert a new line while printing text into a cell in confluence table
    • \n seems to be not wroking
    • table.cell = "text1 \n text2" 
    • This doesn't work.

Warm Regards

@J S S S Bharath 

Andrii Maliuta
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 27, 2024

@J S S S Bharath ,

Answering your questions:

1. This is not technically possible, as you can set links to just Headings on the page with the format of "https://yourconfluence.com/SPACE/PAGE#Heading"

2. You should use HTML (in this case <br> tag)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events