|
1 |
| -# advanced-codeblocks-cloud-migration-helper |
| 1 | +<img src="https://user-images.githubusercontent.com/12599965/56864901-501d8b80-69c8-11e9-9e87-c7e687615a0a.png" align="right" /> |
| 2 | + |
| 3 | +# Advanced Codeblocks for Confluence |
| 4 | + |
| 5 | +## :rocket: Cloud Migration Helper |
| 6 | + |
| 7 | +This migration helper transforms a Server/DataCenter Confluence page in <a href="https://confluence.atlassian.com/doc/confluence-storage-format-790796544.html">Storage Format</a> to |
| 8 | +Cloud Confluence Storage Format. It will convert the <a href="https://marketplace.atlassian.com/apps/1211159/advanced-codeblocks-for-confluence?hosting=datacenter&tab=overview">Advanced Codeblocks for Confluence</a> macros to their Cloud forge app equivalent. |
| 9 | + |
| 10 | +- :book: **[Read the complete migration guide here](https://codeclou.github.io/advanced-codeblocks-cloud-migration-helper)** |
| 11 | + |
| 12 | +For example a Data Center Confluence page containing the Advanced Codeblocks Single Macro will look like this: |
| 13 | + |
| 14 | +``` |
| 15 | +<p>some text</p> |
| 16 | +<ac:structured-macro ac:name="advanced-single-codeblock-macro" ac:schema-version="1" ac:macro-id="0a76fb27-ee70-41a4-bead-063a0908804d"> |
| 17 | + <ac:parameter ac:name="enableddl">true</ac:parameter> |
| 18 | + <ac:parameter ac:name="theme">light-mono</ac:parameter> |
| 19 | + <ac:parameter ac:name="lang">Bash</ac:parameter> |
| 20 | + <ac:parameter ac:name="globaltitle">test</ac:parameter> |
| 21 | + <ac:plain-text-body><![CDATA[echo "foo"]]></ac:plain-text-body> |
| 22 | +</ac:structured-macro> |
| 23 | +``` |
| 24 | + |
| 25 | +The Cloud App equivalent will look like this: |
| 26 | + |
| 27 | +``` |
| 28 | +<p>some text</p> |
| 29 | +<ac:adf-extension> |
| 30 | + <ac:adf-node type="extension"> |
| 31 | + <ac:adf-attribute key="extension-type">com.atlassian.ecosystem</ac:adf-attribute> |
| 32 | + <ac:adf-attribute key="extension-key">9a81c16f-31e6-4be7-be6e-dfc872fe4155/35d2082a-431b-46b7-90da-75a526882f2f/static/advancedsinglecodeblockmacro</ac:adf-attribute> |
| 33 | + <ac:adf-attribute key="parameters"> |
| 34 | + <ac:adf-parameter key="local-id">0658e817-aaf6-7e1d-8000-36a917095fd3</ac:adf-parameter> |
| 35 | + <ac:adf-parameter key="extension-id">ari:cloud:ecosystem::extension/9a81c16f-31e6-4be7-be6e-dfc872fe4155/35d2082a-431b-46b7-90da-75a526882f2f/static/advancedsinglecodeblockmacro</ac:adf-parameter> |
| 36 | + <ac:adf-parameter key="extension-title">Advanced Codeblocks Single</ac:adf-parameter> |
| 37 | + <ac:adf-parameter key="guest-params"> |
| 38 | + <ac:adf-parameter key="globaltitle">test</ac:adf-parameter> |
| 39 | + <ac:adf-parameter key="code">echo "foo"</ac:adf-parameter> |
| 40 | + <ac:adf-parameter key="enableddl"> |
| 41 | + <ac:adf-parameter-value>true</ac:adf-parameter-value> |
| 42 | + </ac:adf-parameter> |
| 43 | + <ac:adf-parameter key="theme">light-mono</ac:adf-parameter> |
| 44 | + <ac:adf-parameter key="lang">Bash</ac:adf-parameter> |
| 45 | + </ac:adf-parameter> |
| 46 | + </ac:adf-attribute> |
| 47 | + <ac:adf-attribute key="text">Advanced Codeblocks Single</ac:adf-attribute> |
| 48 | + <ac:adf-attribute key="layout">default</ac:adf-attribute> |
| 49 | + <ac:adf-attribute key="local-id">0658e817-aaf6-7d86-8000-4dd60f28b018</ac:adf-attribute> |
| 50 | + </ac:adf-node> |
| 51 | + <ac:adf-fallback> |
| 52 | + <!-- shortened ... --> |
| 53 | + </ac:adf-fallback> |
| 54 | +</ac:adf-extension> |
| 55 | +``` |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | +--- |
| 60 | + |
| 61 | + |
| 62 | + |
| 63 | +### Installation |
| 64 | + |
| 65 | +``` |
| 66 | +git clone https://github.com/codeclou/advanced-codeblocks-cloud-migration-helper.git |
| 67 | +cd advanced-codeblocks-cloud-migration-helper |
| 68 | +pip3 install -r requirements.txt |
| 69 | +``` |
| 70 | + |
| 71 | + |
| 72 | + |
| 73 | +--- |
| 74 | + |
| 75 | + |
| 76 | + |
| 77 | +### Disclaimer |
| 78 | + |
| 79 | +**:bangbang: Please check the output storage file for errors before submitting it into your Confluence page. codeclou GmbH is not responsible for damages to your Confluence installation and/or content. Please test the output on a test instance first. This tool is provided as an example on how to transform your storage format from server to cloud. It might need further adaption to your specific needs.** |
| 80 | + |
| 81 | + |
| 82 | + |
| 83 | +--- |
| 84 | + |
| 85 | + |
| 86 | + |
| 87 | +### Run transformer |
| 88 | + |
| 89 | +The extension key must be extracted from the cloud page, see the documentation for details. |
| 90 | + |
| 91 | +``` |
| 92 | +# single macro |
| 93 | +python3 index.py -ek 9a81c16f-31e6-4be7-be6e-dfc872fe4155/35d2082a-431b-46b7-90da-75a526882f2f \ |
| 94 | + -if ./lib/input/ac-single-test1.input.storage \ |
| 95 | + -of ./lib/output/ac-single-test1.output.storage |
| 96 | +
|
| 97 | +# multi macro |
| 98 | +python3 index.py -ek 9a81c16f-31e6-4be7-be6e-dfc872fe4155/35d2082a-431b-46b7-90da-75a526882f2f \ |
| 99 | + -if ./lib/input/ac-multi-test1.input.storage \ |
| 100 | + -of ./lib/output/ac-multi-test1.output.storage |
| 101 | +
|
| 102 | +# multi remote macro |
| 103 | +python3 index.py -ek 9a81c16f-31e6-4be7-be6e-dfc872fe4155/35d2082a-431b-46b7-90da-75a526882f2f \ |
| 104 | + -if ./lib/input/ac-remote-test1.input.storage \ |
| 105 | + -of ./lib/output/ac-remote-test1.output.storage |
| 106 | +``` |
| 107 | + |
| 108 | +Will produce an output like this: |
| 109 | + |
| 110 | +``` |
| 111 | +====================================== |
| 112 | + ADVANCED CODEBLOCKS MIGRATION HELPER |
| 113 | +====================================== |
| 114 | +
|
| 115 | +extension key part: 9a81c16f-31e6-4be7-be6e-dfc872fe4155/35d2082a-431b-46b7-90da-75a526882f2f |
| 116 | +
|
| 117 | +START > reading storage format file from: ./lib/input/ac-single-test1.input.storage |
| 118 | +
|
| 119 | +>> advanced-single-codeblock-macro |
| 120 | + macro param lang : Bash |
| 121 | + macro param enableddl : true |
| 122 | + macro param globaltitle : test |
| 123 | + macro param theme : light-mono |
| 124 | + macro body (shortened) : echo "foo" |
| 125 | + macro attr local id : 0658e829-ab6b-7f11-8000-c612fa7cbd38 |
| 126 | + macro param local id : 0658e829-ab6b-7fa8-8000-1b5180ffb326 |
| 127 | +
|
| 128 | +DONE > written transformed storage format to: ./lib/output/ac-single-test1.output.storage |
| 129 | +``` |
| 130 | + |
| 131 | +The local ids will be auto generated using uuid v7. The classic server/DC macro-id is not used in Cloud and will be discarded. |
| 132 | + |
| 133 | + |
| 134 | + |
| 135 | +--- |
| 136 | + |
| 137 | + |
| 138 | + |
| 139 | +### Run tests |
| 140 | + |
| 141 | +you might need to add pytest to $PATH first, then: |
| 142 | + |
| 143 | +``` |
| 144 | +pytest |
| 145 | +``` |
| 146 | + |
| 147 | +--- |
| 148 | + |
| 149 | + |
| 150 | + |
| 151 | +### License |
| 152 | + |
| 153 | +[MIT](./LICENSE) © [codeclou GmbH](https://github.com/codeclou) |
0 commit comments