Skip to content

Commit c3d5f1f

Browse files
committed
Links directly to controls on screen page from control overview
1 parent c6d402a commit c3d5f1f

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

PowerDocu.AppDocumenter/AppHtmlBuilder.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,9 +386,10 @@ private string CreateControlListHtml(ControlEntity control)
386386
bitmap?.Save(content.folderPath + @"resources\" + control.Type + ".png");
387387
}
388388
string screenFile = screenFileNames.GetValueOrDefault(control.Screen()?.Name, "#");
389+
string controlAnchor = SanitizeAnchorId(control.Name);
389390
StringBuilder sb = new StringBuilder("<ul>");
390391
sb.Append("<li>");
391-
sb.Append($"<a href=\"{Encode(screenFile)}\">");
392+
sb.Append($"<a href=\"{Encode(screenFile)}#{controlAnchor}\">");
392393
sb.Append(ImageWithClass(control.Type, "resources/" + control.Type + ".png", "icon-inline"));
393394
sb.Append($" {Encode(control.Name)}</a>");
394395
foreach (ControlEntity child in control.Children.OrderBy(o => o.Name).ToList())

PowerDocu.AppDocumenter/AppMarkdownBuilder.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -286,13 +286,14 @@ private MdBulletList CreateControlList(ControlEntity control)
286286
{
287287
bitmap?.Save(content.folderPath + @"resources\" + control.Type + ".png");
288288
}
289-
//link to the screen instead of the control directly for the moment, as the directly generated anchor link (#" + control.Name.ToLower()) doesn't work the same way in DevOps and GitHub
289+
string screenFileName = ("screen " + control.Screen().Name + " " + content.filename + ".md").Replace(" ", "-");
290+
string controlAnchor = control.Name.ToLowerInvariant().Replace(" ", "-");
290291
MdBulletList list = new MdBulletList(){
291292
new MdListItem(new MdLinkSpan(
292293
new MdCompositeSpan(
293294
new MdImageSpan(control.Type, "resources/"+control.Type+".png"),
294295
new MdTextSpan(" "+control.Name))
295-
,("screen " + control.Screen().Name + " " + content.filename + ".md").Replace(" ", "-")))};
296+
, screenFileName + "#" + controlAnchor))};
296297

297298
foreach (ControlEntity child in control.Children.OrderBy(o => o.Name).ToList())
298299
{
@@ -385,7 +386,7 @@ private void addAppControlsTable(ControlEntity control, MdDocument screenDoc)
385386
}
386387
else
387388
{
388-
tableRows.Add(new MdTableRow(rule.Property, getCodeBlock(rule.InvariantScript)));
389+
tableRows.Add(new MdTableRow(rule.Property, new MdRawMarkdownSpan(getCodeBlock(rule.InvariantScript))));
389390
}
390391
}
391392
}
@@ -459,7 +460,7 @@ private MdTableRow CreateRowForControlProperty(Rule rule, string defaultValue)
459460
.Append("<td style=\"background-color:#ffcccc; width:50%;\">").Append(defaultValue).Append("</td></tr></table>");
460461
return new MdTableRow(rule.Property, new MdRawMarkdownSpan(table.ToString()));
461462
}
462-
return new MdTableRow(rule.Property, getCodeBlock(rule.InvariantScript));
463+
return new MdTableRow(rule.Property, new MdRawMarkdownSpan(getCodeBlock(rule.InvariantScript)));
463464
}
464465

465466
private void addAppDataSources()

0 commit comments

Comments
 (0)