Skip to content

Commit c2aaeaf

Browse files
committed
2025.2.0
1 parent 695a4dc commit c2aaeaf

File tree

163 files changed

+5966
-5941
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

163 files changed

+5966
-5941
lines changed

cli/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<parent>
55
<groupId>org.nasdanika.models.app</groupId>
6-
<version>2025.1.0</version>
6+
<version>2025.2.0</version>
77
<artifactId>parent</artifactId>
88
<relativePath>..</relativePath>
99
</parent>

cli/src/main/java/org/nasdanika/models/app/cli/ActionHelpMixIn.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ public static Action createCommandLineAction(
449449

450450
if (optAction != null) {
451451
optAction.setText(StringEscapeUtils.escapeHtml4(String.join(", ", opt.names())));
452-
optAction.setName("opt_" + StringEscapeUtils.escapeHtml4(opt.shortestName()));
452+
optAction.setName("opt" + StringEscapeUtils.escapeHtml4(opt.shortestName()));
453453
if (optionsSection == null) {
454454
optionsSection = createAction();
455455
optionsSection.setText("Options");
@@ -502,7 +502,8 @@ protected static boolean generateDocumentation(
502502
if (dStream != null) {
503503
Collection<EObject> docObjs = docFactory.createDocumentation(
504504
docContext,
505-
URI.createURI(resName).resolve(baseURI),
505+
URI.createURI(resName).resolve(baseURI),
506+
null,
506507
progressMonitor);
507508
action.getContent().addAll(docObjs);
508509
return true;
@@ -517,6 +518,7 @@ protected static boolean generateDocumentation(
517518
Collection<EObject> docObjs = docFactory.createDocumentation(
518519
docContext,
519520
resourceURI,
521+
null,
520522
progressMonitor);
521523
action.getContent().addAll(docObjs);
522524
return true;
@@ -534,7 +536,8 @@ protected static boolean generateDocumentation(
534536
docContext,
535537
doc,
536538
format,
537-
Util.createClassURI(clazz),
539+
Util.createClassURI(clazz),
540+
null,
538541
progressMonitor);
539542

540543
action.getContent().addAll(docObjs);

cli/src/main/java/org/nasdanika/models/app/cli/DrawioHtmlAppGeneratorCommand.java

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
import java.util.Collection;
66
import java.util.List;
77
import java.util.Map;
8+
import java.util.UUID;
89
import java.util.function.Consumer;
910

1011
import org.eclipse.emf.common.util.URI;
1112
import org.nasdanika.capability.CapabilityLoader;
1213
import org.nasdanika.capability.ServiceCapabilityFactory;
1314
import org.nasdanika.cli.Description;
1415
import org.nasdanika.cli.ParentCommands;
16+
import org.nasdanika.common.Context;
1517
import org.nasdanika.common.Diagnostic;
1618
import org.nasdanika.common.Invocable;
1719
import org.nasdanika.common.ProgressMonitor;
@@ -49,22 +51,14 @@ public DrawioHtmlAppGeneratorCommand(CapabilityLoader capabilityLoader) {
4951
protected Consumer<Diagnostic> createDiagnosticConsumer(ProgressMonitor progressMonitor) {
5052
return d -> progressMonitor.worked(d.getStatus(), 1, "Diagnostic: " + d.getMessage(), d);
5153
}
54+
5255

53-
protected DrawioHtmlAppGenerator createDrawioActionGenerator(Collection<RepresentationElementFilter> representationElementFilters) {
56+
protected DrawioHtmlAppGenerator createDrawioActionGenerator(URI baseURI, Collection<RepresentationElementFilter> representationElementFilters) {
5457
return new DrawioHtmlAppGenerator() {
5558

5659
@Override
5760
protected URI getBaseURI() {
58-
URI baseURI = super.getBaseURI();
59-
if (Util.isBlank(base)) {
60-
return baseURI;
61-
}
62-
63-
URI bURI = URI.createURI(base);
64-
if (bURI.isRelative()) {
65-
bURI = bURI.resolve(baseURI);
66-
}
67-
return bURI;
61+
return baseURI;
6862
}
6963

7064
@Override
@@ -106,8 +100,7 @@ public void filterRepresentationElement(
106100
"and prototype references. Resolved",
107101
"relative to the document URI"
108102
})
109-
private String refBase;
110-
103+
private String refBase;
111104

112105
@Option(
113106
names = {"-x", "--index"},
@@ -149,7 +142,21 @@ You may change the file extension if you need to generate server pages (PHP, JSP
149142

150143
@Override
151144
protected Collection<Label> getLabels(ProgressMonitor progressMonitor) {
152-
Document document = documentSupplier.getDocument(progressMonitor);
145+
URI actionGeneratorBaseURI = URI.createURI("tmp://" + UUID.randomUUID() + "/" + UUID.randomUUID() + "/");
146+
if (!Util.isBlank(base)) {
147+
URI bURI = URI.createURI(base);
148+
if (bURI.isRelative()) {
149+
bURI = bURI.resolve(actionGeneratorBaseURI);
150+
}
151+
actionGeneratorBaseURI = bURI;
152+
}
153+
154+
Map<String,String> properties = Map.of(Context.BASE_URI_PROPERTY, actionGeneratorBaseURI.toString());
155+
156+
Document document = documentSupplier.getDocument(
157+
null,
158+
properties::get,
159+
progressMonitor);
153160
Collection<RepresentationElementFilter> refs = new ArrayList<>();
154161
File currentDir = new File(".");
155162
URI baseURI = URI.createFileURI(currentDir.getAbsolutePath()).appendSegment("");
@@ -162,7 +169,7 @@ protected Collection<Label> getLabels(ProgressMonitor progressMonitor) {
162169
refs.add(ref);
163170
}
164171

165-
DrawioHtmlAppGenerator actionGenerator = createDrawioActionGenerator(refs);
172+
DrawioHtmlAppGenerator actionGenerator = createDrawioActionGenerator(actionGeneratorBaseURI, refs);
166173
Supplier<Collection<Label>> labelSupplier = actionGenerator.createLabelsSupplier(document, progressMonitor);
167174
Consumer<Diagnostic> diagnosticConsumer = createDiagnosticConsumer(progressMonitor);
168175
return labelSupplier.call(progressMonitor, diagnosticConsumer);

cli/src/main/resources/org/nasdanika/models/app/cli/DrawioHtmlAppGeneratorCommand.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,29 @@
99
* Adds the generated labels to the root action
1010
* Passes the resulting model to the [site](site/index.html) sub-command to generate a documentation site
1111

12-
## Diagram element configuration
12+
## Diagram element configuration
1313

1414
Diagram elements can be configured with the following properties:
1515

16-
* ``documentation`` documentation text in documentation format
17-
* ``doc-format`` explicitly specified documentation format for ``documentation`` and ``doc-ref`. Out of the box:
16+
* ``documentation`` - documentation text in documentation format
17+
* ``doc-format`` - explicitly specified documentation format for ``documentation`` and ``doc-ref`. Out of the box:
1818
* ``markdown`` (default),
1919
* ``html``
2020
* ``text``
21-
* ``doc-ref`` URI of a documentation resource resolved relative to the URI of the diagram file. Documentation format is derived from the URI extension, defaulting to ``markdown``. Use ``doc-format`` to override.
22-
* ``icon`` diagram element icon URL resolved relative to the diagram file. If there is no slash (``/``) in the icon name then it is treated as a CSS style, e.g. ``fas fa-user``.
21+
* ``doc-ref`` - URI of a documentation resource resolved relative to the URI of the diagram file. Documentation format is derived from the URI extension, defaulting to ``markdown``. Use ``doc-format`` to override.
22+
* ``icon`` - diagram element icon URL resolved relative to the diagram file. If there is no slash (``/``) in the icon name then it is treated as a CSS style, e.g. ``fas fa-user``.
2323
For image diagram elements icons are derived from element images. It is recommended to use SVG 20x20 OR 18x18 pixels for icons because they are also used in page titles and PNG images get blurry when scaled up.
24-
* ``parent`` Connection property with values ``source`` or ``target``. Use to generate documentation from mind maps where parent/child relationship is defined by connections, not by containment.
24+
* ``parent`` - Connection property with values ``source`` or ``target``. Use to generate documentation from mind maps where parent/child relationship is defined by connections, not by containment.
2525
* ``prototype`` & ``proto-ref`` – YAML specification of [html application](https://html-app.models.nasdanika.org/index.html) [action](https://html-app.models.nasdanika.org/references/eClassifiers/Action/index.html), [link](https://html-app.models.nasdanika.org/references/eClassifiers/Link/index.html) or [label](https://html-app.models.nasdanika.org/references/eClassifiers/Label/index.html). See load specifications of respective model elements for supported configuration keys. If both properties are specified, ``prototype`` takes precedence over ``proto-ref``. With prototypes you can:
26-
* Generate complex site pages (actions) with children, navigation, sections,
26+
* Generate complex site pages (actions) with children, navigation, sections, ...
2727
* Reuse action models. For example, generate an action model from one diagram and use it as a prototype for an element of another diagram. Or generate an action model for CLI or Ecore documentation.
28-
* ``role`` action/page role:
28+
* ``role`` - action/page role:
2929
* ``anonymous`` (default for connections)
3030
* ``child`` (default for nodes)
3131
* ``navigation``
3232
* ``section``
33-
* ``sort-key`` By default generated pages (actions) are sorted alphabetically by title. This property can be used to customize sorting. If it is set then pages are sorted first by the property value and then by page title.
34-
* ``title`` By default the element label is used as page title (action text). Use this property to explicitly set the page title. For example, for elements with long labels.
33+
* ``sort-key`` - By default generated pages (actions) are sorted alphabetically by title. This property can be used to customize sorting. If it is set then pages are sorted first by the property value and then by page title.
34+
* ``title`` - By default the element label is used as page title (action text). Use this property to explicitly set the page title. For example, for elements with long labels.
3535

3636
Site pages are generated only for elements with:
3737

0 commit comments

Comments
 (0)