Skip to content

Commit 4d2fc32

Browse files
committed
Fixed #554 Fix support of internal links for generation from html data.
1 parent 6450aff commit 4d2fc32

File tree

9 files changed

+31
-2
lines changed

9 files changed

+31
-2
lines changed

plugins/org.obeonetwork.m2doc.html/src/org/obeonetwork/m2doc/html/services/M2DocHTMLParser.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2019, 2025 Obeo.
2+
* Copyright (c) 2019, 2026 Obeo.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v2.0
55
* which accompanies this distribution, and is available at
@@ -1874,7 +1874,12 @@ private URI toURI(URI baseURI, String uri) {
18741874
if (file.isAbsolute()) {
18751875
res = URI.createFileURI(uri);
18761876
} else {
1877-
res = URI.createURI(uri.replace('\\', '/')).resolve(baseURI);
1877+
final URI targetURI = URI.createURI(uri.replace('\\', '/'));
1878+
if (targetURI.isCurrentDocumentReference()) {
1879+
res = targetURI;
1880+
} else {
1881+
res = targetURI.resolve(baseURI);
1882+
}
18781883
}
18791884

18801885
return res;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
=== HEADER ===
3+
4+
=== BODY ===
5+
6+
A simple demonstration of a query :
7+
[query: .asBookmark('Bookmark ID1', 'ID1')]
8+
***************************
9+
[query: .fromHTMLURI('doc.html')]
10+
End of demonstration.
11+
=== FOOTER ===
12+
13+
=== TEMPLATES ===

tests/org.obeonetwork.m2doc.html.tests/resources/html/aInternalLink/aInternalLink-expected-generation-messages.txt

Whitespace-only changes.

tests/org.obeonetwork.m2doc.html.tests/resources/html/aInternalLink/aInternalLink-expected-validation.docx

Whitespace-only changes.
Binary file not shown.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<genconf:Generation xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:genconf="http://www.obeonetwork.org/m2doc/genconf/1.0" name="a" templateFileName="a-template.docx" resultFileName="a-actual-generation.docx" validationFileName="a-actual-validation.docx"/>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<html>
2+
<head>
3+
</head>
4+
<body>
5+
<a href="#ID1">Reference to ID1</a>
6+
</body>
7+
</html>
8+
9+

0 commit comments

Comments
 (0)