-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Frankdoc/210 note blocks #216
Conversation
<xs:documentation>First line of documentation. | ||
Second line of documentation.<br><b>INFO</b><p>First line | ||
Second line | ||
Third line</p><br><b>INFO</b><p>First line | ||
<pre><code>&lt;Element&gt; | ||
&lt;Param /&gt; | ||
&lt;/Element</code></pre></p><br><b>TIP</b><p>First line</p><br><b>WARNING</b><p>First line | ||
Second line</p><br><b>DANGER</b><p>First line</p></xs:documentation> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Poeh, ik ga er van uit dat jij gecontrolleerd hebt dat dit er mooi/leesbaar uit ziet?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Waarschijnlijk kan jij er niets aan doen, maar waarom heet dit ding DocWriterNew? Ik zie nergens *Old ..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ik las daar net toevallig een stukje over in de code:
Quote:
* This package contains a set of model classes that is used by {@link org.frankframework.frankdoc.DocWriterNew} to generate the
* XML configuration schema used by Frank developers. Please note that {@link org.frankframework.frankdoc.DocWriterNew} is
* presently not used; this class is under development.
Dit is nu natuurlijk niet het geval meer. Er zijn een aantal classes die zo gek heten dus ik zal er een issue voor aanmaken.
private void addDocumentationFrom(XmlBuilder element, FrankElement frankElement) { | ||
if(version == XsdVersion.STRICT) { | ||
String elementDescription = frankElement.getDescription(); | ||
if(! StringUtils.isBlank(elementDescription)) { | ||
addDocumentation(element, elementDescription); | ||
if (!StringUtils.isBlank(frankElement.getDescription())) { | ||
StringBuilder description = new StringBuilder(frankElement.getDescription()); | ||
|
||
if (!frankElement.getNotes().isEmpty()) { | ||
description.append("<br>"); | ||
} | ||
for (Note note : frankElement.getNotes()) { | ||
description.append("<br><b>") | ||
.append(note.type().name()) | ||
.append("</b>") | ||
.append("<p>") | ||
.append(note.value()) | ||
.append("</p>"); | ||
} | ||
|
||
addDocumentation(element, description.toString()); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ik moest echt even drie keer kijken wat hier nou gebeurt. Doordat description
afhanekelijk van parameters wordt gemuteerd wordt dit denk ik voor mij wat onduidelijk. Ik zou denk ik op zoiets uitkomen:
private void addDocumentationFrom(XmlBuilder element, FrankElement frankElement) {
String elementDescription = frankElement.getDescription();
if (version == XsdVersion.STRICT && !StringUtils.isBlank(elementDescription)) {
if (frankElement.getNotes().isEmpty()) {
addDocumentation(element, elementDescription);
} else {
StringBuilder description = new StringBuilder(elementDescription);
description.append("<br>");
frankElement.getNotes()
.forEach(note -> description.append(formatNote(note)));
addDocumentation(element, description.toString());
}
}
}
private String formatNote(Note note) {
return String.format("<br><b>%s<b/><p>%s</p>", note.type().name(), note.value());
}
Hiermee return je wanneer je niets te doen hebt hier en is door de else branch en formatNote wmb duidelijk wat er gebeurt.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Goeie suggestie, maar het issue is al gemerged, dus ik kan die wijzingen hier nu niet doorvoeren..
Closes #210
Built upon #209, so that must be merged before this one.
Files:
frankdoc.json