Highly undesirable "Spaces"/lines

I am facing an issue with unwanted text spaces/lines.
For this Model:

I put a description inside LC1, LC3, and LC5.
LC2 and LC4 have no “description”.

The M2DOC queries are:
m:for comp|self.eAllContents(la::LogicalComponent)
m:if comp.description.trim().size() <> 0
m: comp.description.trim().fromHTMLBodyString().replaceLink(comp)
The result would contain UNDESIRABLE spaces:

Eventhough, there is a condition “if”, it should not allow the template to generate a new line for LC2 and LC4.

This problem is even more exasperated when using the black dots, as illustrated here:

The Generated document:

This is quite inconvenient.
How to get rid of this problem?

I added a new experiment (adding a green text area that shall not appear for LC2 and LC4 lines), to be sure that the test “IF” is working correctly:

As you can see LC2 and CL4, do not possess any green text area, if the “IF” condition was not respected then we would have gotten a green area containing the number 0. The problem is that EVENTHOUGH “IF” is repected, hence the M2DOC querry not being called for LC2/LC4, the (word space/Black Dot) IS GENERATED nonetheless, which generate unwanted spaces and unwanted black dots lines. Is there a way to bypass this problem?

That might comes from various things. Looking at the code the of your template I don’t think it comes from the code. My guess is it comes from the description producing two paragraphs per description. But it can also be an issue with M2Doc itself.

Can you add an highlight expression before your description expression ? If it appears just after the first bullet, it means that the description produce two paragraphs (might be even one). You can also check the HTML code saved in the description. You can use the property view and the expert tab to get the HTML content.

And if you are not using M2Doc 3.2.1, I would suggest to upgrade since a lot of improvements have been done to the HTML export in this version.

1 Like

I am using 3.1.0 indeed, i just switched to the latest M2DOC version. However the problem remained.
I added highlights as you have requested, here are the three experiments i run:

There is no unwanted space/line whenever there are extra sentences between, the “black dots”.

Same result if there is any extra element before the black dot.

Extra unwanted space, whenever the red highlight is gone.
4) Finally, no highlight:

Interesting, you might be right. How do you think this could be resolved?

Can you provide the HTML of your description ?

The difference between example 2 and 3 make me think something might be wrong with M2Doc. I will try to reproduce this issue…

Yes it’s the last image in my first post (on the left), is that enough? (It’s the same for LC3 and L5, except the number that is changed)

Here is it:

Could the “tree” /structure of Capella Logical Components, which includes the System containing these components, have anything to do with he problem somehow? Not sure.

Thank you, I’ll try to reproduce this issue.

1 Like

I actually faced this issue in another number of instances.
While parsing ( The Tokenize function/ limitation - Document Generation - Eclipse Capella Forum (mbse-capella.org)) and using index of “FOR loop” to choose to display the info or not (IF condition). I had the same problem aswell. It seems to be related to HTML+IF+FOR, but could be just HTML… .

Glad to hear more if you find anything.

I don’t exactly reproduce your bug. see the following issue. As a workaround you can probably remove the first <p> and the last </p> tags. With something like:

description.substring(description.index('<p>', 0) + 3, description.lastIndex('</p>', 0))

You might need to tweak the expression.

1 Like

Here is the project, maybe you can reproduce it way more easily ?

.project (279 Bytes)
NoMoreSpacesProject.afm (347 Bytes)
NoMoreSpacesProject.aird (20.9 KB)
NoMoreSpacesProject.capella (23.5 KB)
(The tamplate contains the queries i showed above).
(as for the genconf file, i will let you make it)

You solution would work only if i have one single paragraph on my description though, but it is highly interesting! I could tweak it a bit and see if I can’t something that could suit all the description forms i am seeking. Thank you for your answer.

More Tests:
I was inspecting another example while I noticed this, look in the left you can see the HTML code, and in the right the result (generated document). We can see clearly an extra space/line aboce the text (White square).


The word Debug0 is located directly before the M2DOC query, such as:
Hope this helps.

Extra test:

Nothing new on this matter?

What about a WORD FIELD that would “eat”/“erase” the following line or first line, or maybe an M2DOC that would do it? It could be used whenever we can predict for sure that an extra line is going to be added.

Something such as:

{m: var.html… /eraseNextLine}

The first empty line (whether it is empty or not by the way), is deleted.

M2Doc is in maintenance mode so unless someone pays to fix this, I will not try to fix that soon. An other workaround would be to change MElement produced by the HTML service.

Totally understandable, i figured it is time i create my own services maybe. I will recheck the related links for creating a service (shared on another topic), re read about EMF elements (MElement for instance) and how to interact with them, then how to insert the service in the template. If I succeed then i could do anything with M2DOC. (Second clue would be python maybe).

Thank you for the answers, again.
Paid service decisions are out of my hands unfortunately, however I hope that my feedback/experiments could prove useful/valuable sometimes.

Yes you can check the Capella extension itself has it provide services. See the github project.

1 Like