Skip to content

Commit

Permalink
add test and fix base64 encoded image handling for DocxConverter
Browse files Browse the repository at this point in the history
  • Loading branch information
vsch committed Apr 10, 2020
1 parent 40bee0d commit 9c77bd7
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 1 deletion.
1 change: 1 addition & 0 deletions VERSION-TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ Please give feedback on the upcoming changes if you have concerns about breaking

* [ ] Fix: wiki links should not be wrapped during formatting.
* Fix: merge [#397, PR: Add base64 image support with docx rendering] thanks to [@Xaelis]
* Add: test for base64 encoded docx conversion

## 0.61.2

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public ResolvedLink resolveLink(@NotNull Node node, @NotNull LinkResolverBasicCo
// should be prefixed with http://, we will just add it
return link.withStatus(LinkStatus.INVALID)
.withUrl("http://" + url);
} else if (!url.matches("^(?:[a-z]+:|#|\\?)")) {
} else if (!url.startsWith("data:") && !url.matches("^(?:[a-z]+:|#|\\?)")) {
// relative, we will process it as a relative path to the docRelativeURL
String pageRef = url;
String suffix = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2375,6 +2375,69 @@ with some text
````````````````````````````````


Base64 encoded

```````````````````````````````` example Images: 5
![[email protected]](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAIgklEQVR4Xu2bCWwVRRjHFw+87xOjiMEQjyjF1zf7Wlo5RAVEqBwFEQQPilTRt7u9LJQ+LkWOtmKBAmKxClEUROUyXo0HKihWTDyiMUaId7SJR6Ii43z7dsr6zb7d2X3b10D4kl8KeXN8/9k5vpmdVZTDdtgOGotGo1mxWKyvHZzmkLKsrKxTmeiJhJBmBnWhRVXVOKTHZRy0xkQlGK0OYt2A9AW4rI630kh3RYsWKjpJMB5XNHUL+9vM2KEY6svs7wb2e52iR6d0KYxOYk99t4M4aTp+aIwadaRikOsVXV2haGQPE0hlOH4yoZFcURCj1Rr/3di/Wx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GfnZPdiy85U0xnm1NGlOeYNjRnPVgui7cDwwOJSAeu7trmKdn9wyIGnDlGe79ddAc0Sn+p6eqvZG+6LdGVOrWX8Cw52uVnF6dqA0BiLdAIuZcAlabiDbBP+I5uDijM63on45P8HfKvTljg5Qa7Jyif7cTogJz+XVmyoMsU1fLDEBPYYC95eRMtfStBb12m0z7Lx5i1Um2iY5Paw9T2uFEWOt7mWGcMiHGi2p7c+csJpTE6bYBPlzS8KLG1adGBGnzg2LMKB5DBQkpMk+//XDmno+cPJJiZoI3uaHynJ0yYQ2Mr4nvElE/q6+QoLnrShRjpUtN1AIBbjwEZGAUnxPQ/0ClzuQWNE4vMUF1o7/guuEIwJWe0gzg3oNYlD7UNG6OLQ1bFYDoz9jdDdDynhTsYjQotu+PfDdhDZf9dzZEKVGA9OAAAAAElFTkSuQmCC)
with some text
.
<w:body>
<w:p>
<w:pPr>
<w:pStyle w:val="ParagraphTextBody"/>
</w:pPr>
<w:r>
<w:drawing>
<wp:inline distB="0" distL="0" distR="0" distT="0" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing">
<wp:extent cx="609600" cy="609600"/>
<wp:effectExtent b="0" l="0" r="0" t="0"/>
<wp:docPr descr="[email protected]"
id="100000" name="Image100000"/>
<wp:cNvGraphicFramePr>
<a:graphicFrameLocks noChangeAspect="true" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"/>
</wp:cNvGraphicFramePr>
<a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
<a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture">
<pic:pic xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture">
<pic:nvPicPr>
<pic:cNvPr id="100001" name="Image100000"/>
<pic:cNvPicPr/>
</pic:nvPicPr>
<pic:blipFill>
<a:blip r:embed="rId3" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"/>
<a:stretch>
<a:fillRect/>
</a:stretch>
</pic:blipFill>
<pic:spPr>
<a:xfrm>
<a:off x="0" y="0"/>
<a:ext cx="609600" cy="609600"/>
</a:xfrm>
<a:prstGeom prst="rect">
<a:avLst/>
</a:prstGeom>
</pic:spPr>
</pic:pic>
</a:graphicData>
</a:graphic>
</wp:inline>
</w:drawing>
</w:r>
</w:p>
<w:p>
<w:pPr>
<w:pStyle w:val="ParagraphTextBody"/>
</w:pPr>
<w:r>
<w:t>with some text</w:t>
</w:r>
</w:p>
</w:body>
````````````````````````````````


## Block Quotes

lazy continuation
Expand Down

0 comments on commit 9c77bd7

Please sign in to comment.