Fix narrative generator generating duplicate anchors (prefix 'hc')
This commit is contained in:
parent
635ac6f109
commit
045718d582
|
@ -110,6 +110,7 @@ public class ProfileDrivenRenderer extends ResourceRenderer {
|
||||||
p.b().tx("Generated Narrative: "+r.fhirType()+(context.isContained() ? " #"+r.getId() : ""));
|
p.b().tx("Generated Narrative: "+r.fhirType()+(context.isContained() ? " #"+r.getId() : ""));
|
||||||
if (!Utilities.noString(r.getId())) {
|
if (!Utilities.noString(r.getId())) {
|
||||||
p.an(r.getId());
|
p.an(r.getId());
|
||||||
|
p.an("hc"+r.getId());
|
||||||
}
|
}
|
||||||
idDone = true;
|
idDone = true;
|
||||||
}
|
}
|
||||||
|
@ -119,6 +120,7 @@ public class ProfileDrivenRenderer extends ResourceRenderer {
|
||||||
}
|
}
|
||||||
if (!Utilities.noString(r.getId()) && !idDone) {
|
if (!Utilities.noString(r.getId()) && !idDone) {
|
||||||
x.para().an(r.getId());
|
x.para().an(r.getId());
|
||||||
|
x.para().an("hc"+r.getId());
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
StructureDefinition sd = r.getDefinition();
|
StructureDefinition sd = r.getDefinition();
|
||||||
|
@ -479,7 +481,7 @@ public class ProfileDrivenRenderer extends ResourceRenderer {
|
||||||
Reference r = (Reference) e;
|
Reference r = (Reference) e;
|
||||||
if (r.getReference() != null && r.getReference().contains("#")) {
|
if (r.getReference() != null && r.getReference().contains("#")) {
|
||||||
if (containedIds.contains(r.getReference().substring(1))) {
|
if (containedIds.contains(r.getReference().substring(1))) {
|
||||||
x.ah(r.getReference()).tx("See "+r.getReference());
|
x.ah("#hc"+r.getReference().substring(1)).tx("See "+r.getReference());
|
||||||
} else {
|
} else {
|
||||||
// in this case, we render the resource in line
|
// in this case, we render the resource in line
|
||||||
ResourceWrapper rw = null;
|
ResourceWrapper rw = null;
|
||||||
|
@ -493,7 +495,7 @@ public class ProfileDrivenRenderer extends ResourceRenderer {
|
||||||
} else {
|
} else {
|
||||||
String ref = context.getResolver() != null ?context.getResolver().urlForContained(context, res.fhirType(), res.getId(), rw.fhirType(), rw.getId()) : null;
|
String ref = context.getResolver() != null ?context.getResolver().urlForContained(context, res.fhirType(), res.getId(), rw.fhirType(), rw.getId()) : null;
|
||||||
if (ref == null) {
|
if (ref == null) {
|
||||||
x.an(rw.getId());
|
x.an("hc"+rw.getId());
|
||||||
RenderingContext ctxtc = context.copy();
|
RenderingContext ctxtc = context.copy();
|
||||||
ctxtc.setAddGeneratedNarrativeHeader(false);
|
ctxtc.setAddGeneratedNarrativeHeader(false);
|
||||||
ctxtc.setContained(true);
|
ctxtc.setContained(true);
|
||||||
|
|
|
@ -361,8 +361,10 @@ public abstract class ResourceRenderer extends DataRenderer {
|
||||||
} else {
|
} else {
|
||||||
c = x.ah(r.getReference());
|
c = x.ah(r.getReference());
|
||||||
}
|
}
|
||||||
|
} else if ("#".equals(r.getReference())) {
|
||||||
|
c = x.ah("#");
|
||||||
} else {
|
} else {
|
||||||
c = x.ah(r.getReference());
|
c = x.ah("#hc"+r.getReference().substring(1));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
c = x.span(null, null);
|
c = x.span(null, null);
|
||||||
|
@ -610,7 +612,7 @@ public abstract class ResourceRenderer extends DataRenderer {
|
||||||
|
|
||||||
String id = getPrimitiveValue(r, "id");
|
String id = getPrimitiveValue(r, "id");
|
||||||
if (doId) {
|
if (doId) {
|
||||||
div.an(id);
|
div.an("hc"+id);
|
||||||
}
|
}
|
||||||
|
|
||||||
String lang = getPrimitiveValue(r, "language");
|
String lang = getPrimitiveValue(r, "language");
|
||||||
|
|
|
@ -198,6 +198,14 @@ public abstract class XhtmlFluent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public XhtmlNode imgT(String src, String alt) {
|
||||||
|
if (alt == null) {
|
||||||
|
return addTag("img").attribute("src", src).attribute("alt", ".");
|
||||||
|
} else {
|
||||||
|
return addTag("img").attribute("src", src).attribute("alt", alt).attribute("title", alt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public XhtmlNode img(String src, String alt, String title) {
|
public XhtmlNode img(String src, String alt, String title) {
|
||||||
return addTag("img").attribute("src", src).attribute("alt", alt).attribute("title", title);
|
return addTag("img").attribute("src", src).attribute("alt", alt).attribute("title", title);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue