Fix rendering for unresolvable value sets

This commit is contained in:
Grahame Grieve 2023-06-20 07:02:26 +10:00
parent 2b8e61e2cb
commit ec7b79bc1e
2 changed files with 21 additions and 1 deletions

View File

@ -399,7 +399,7 @@ public class AdditionalBindingsRenderer {
return; // what should happen?
}
BindingResolution br = pkp.resolveBinding(profile, b.getValueSet(), corePath);
XhtmlNode a = children.ah(br.url == null ? null : Utilities.isAbsoluteUrl(br.url) || !context.getPkp().prependLinks() ? br.url : corePath+br.url, b.hasDocumentation() ? b.getDocumentation() : null);
XhtmlNode a = children.ahOrCode(br.url == null ? null : Utilities.isAbsoluteUrl(br.url) || !context.getPkp().prependLinks() ? br.url : corePath+br.url, b.hasDocumentation() ? b.getDocumentation() : null);
if (b.hasDocumentation()) {
a.attribute("title", b.getDocumentation());
}

View File

@ -121,6 +121,26 @@ public abstract class XhtmlFluent {
return x;
}
/**
* make it a code if it's not a link
* @param href
* @param title
* @return
*/
public XhtmlNode ahOrCode(String href, String title) {
if (href != null) {
return ah(href, title);
} else if (title != null) {
return code().setAttribute("title", title);
} else {
return code();
}
}
public XhtmlNode ahOrCode(String href) {
return ahOrCode(href, null);
}
public XhtmlNode img(String src, String alt) {
return addTag("img").attribute("src", src).attribute("alt", alt);
}