Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confluence respond with error "the macro 'page.title' is unknown" when trying to create child page with attachment reference and and ignore-variables="true" setting #208

Closed
qwazer opened this issue Oct 25, 2019 · 7 comments
Assignees
Labels
Milestone

Comments

@qwazer
Copy link
Contributor

qwazer commented Oct 25, 2019

Use case:

create page via XML-RPC
with next confluence-site-description.xml

<?xml version="1.0" encoding="UTF-8"?>
<bsc:site
        xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
        xmlns:bsc='https://github.com/bsorrentino/maven-confluence-plugin'
        xsi:schemaLocation='https://github.com/bsorrentino/maven-confluence-plugin https://raw.githubusercontent.com/bsorrentino/maven-confluence-plugin/master/schemas/site-schema-6.0.xsd'>
    <home name="Test"
          uri="./markdown/00_parent.md" ignore-variables="true">
        <child name="Test-child" uri="./markdown/test.md" ignore-variables="true">
            <attachment uri="markdown/Monitoring.png" name="Monitoring.png"/>
        </child>
    </home>
</bsc:site>

test.md has next line

![Monitoring.png](Monitoring.png)

When trying to post to a Confluence got error

Caused by: java.lang.Exception: java.lang.Exception: com.atlassian.confluence.rpc.RemoteException: com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'page.title' is unknown.
    at org.bsc.confluence.xmlrpc.Confluence.call (Confluence.java:937)
    at org.bsc.confluence.xmlrpc.Confluence.storePage (Confluence.java:324)
    at org.bsc.confluence.xmlrpc.XMLRPCConfluenceServiceImpl.storePage (XMLRPCConfluenceServiceImpl.java:248)
    at org.bsc.confluence.ConfluenceServiceFactory$MixedConfluenceService.storePage (ConfluenceServiceFactory.java:96)
    at org.bsc.maven.confluence.plugin.AbstractConfluenceMojo.lambda$updatePageContent$0 (AbstractConfluenceMojo.java:332)
    at org.bsc.confluence.model.SiteProcessor.processPageUri (SiteProcessor.java:150)

because generate content has value

!${page.title}^Monitoring.png|Monitoring.png!

Affected versions
6.1 to 6.5-beta2

Not reproduced in 6.0-rc2

@qwazer
Copy link
Contributor Author

qwazer commented Oct 25, 2019

Is it possible to generate attachment links without ${page.title} macro?

@bsorrentino bsorrentino self-assigned this Oct 25, 2019
@bsorrentino bsorrentino added this to the 6.5 milestone Oct 25, 2019
@bsorrentino
Copy link
Owner

hi @qwazer

The issue is related to ignore-variables=true that skip all variables

Unfortunately, to fix issue #189 I've added ${page.title} variable concerning markdown image processing, now I've to take a decision

  • if ignore-variables=true then remove ${page.title} in markdown image processing ?
  • remove ${page.title} from ignored variablles

What are your thoughts ?

thanks in advance

@qwazer
Copy link
Contributor Author

qwazer commented Oct 25, 2019

Hi @bsorrentino

  • First option "if ignore-variables=true then remove ${page.title} in markdown image processing"
    • Proc: do not use variables
    • Cons: break feature with Markdown portable image?
  • Second option "Remove ${page.title} from ignored variables".
    Can be implemented as a special processing rule for markdown->Confluence wiki format that depends on page context (title)
    • Proc: don't break existing features
    • Cons: complex logic.

From this point of view, the second option is preferable.

@bsorrentino
Copy link
Owner

hi @qwazer

Thanks for feedback ... I'm going to fix it using 2nd solution

bsorrentino added a commit that referenced this issue Oct 26, 2019
add user driven test to verify correct behaviour
bsorrentino added a commit that referenced this issue Oct 26, 2019
update Site unit test
bsorrentino added a commit that referenced this issue Oct 26, 2019
add current Site.Page in processing markdown to understand if
ignore-variables has been set
@bsorrentino
Copy link
Owner

hi @qwazer

i've deployed version 6.5-SNAPSHOT with the fix, could you check it and let me know ?

Thanks in advance

@qwazer
Copy link
Contributor Author

qwazer commented Oct 28, 2019

hi @bsorrentino
Yes it works

@bsorrentino
Copy link
Owner

fix released in version 6.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants