Required? | {FormatIsRequired(isRequiredForParameterSets)} |
Position? | {position} |
Default value | {0} |
Accept pipeline input? | {pipelineInput} |
Accept wildcard characters? | {0} |
Aliases | {string.Join(", ", aliases)} |
");
var code = example.SelectSingleNode("code");
if (code == null)
Logger.LogError("Unable to find examples tag for cmdlet " + cmdletName);
var codeSample = code.InnerText.Trim('\r', '\n');
codeSample = codeSample.Replace("\r\n", "
").Replace("\n", "
");
sb.AppendFormat("{0}", codeSample);
var description = example.SelectSingleNode("description");
if (description == null)
Logger.LogError("Unable to find examples tag for cmdlet " + cmdletName);
// use InnerXml here to allow for
and other layout format tags, these get stripped
// if we use InnerText
var innerXml = description.InnerXml;
// convert link elements to anchors (pshelp strips the tags to leave the link)
/*if (innerXml.Contains(""))
{
}*/
sb.AppendFormat("{0}", innerXml);
sb.Append("
");
exampleIndex++;
}
writer.AddPageElement(CmdletPageWriter.ExamplesElementKey, sb.ToString());
}
private void WriteRelatedLinks(CmdletPageWriter writer, string serviceAbbreviation, string cmdletName)
{
var sb = new StringBuilder();
// putting common credential and region parameters into a related link is the simplest
// approach, but only do it for service cmdlets
if (!serviceAbbreviation.Equals("Common", StringComparison.Ordinal))
{
XmlDocument document;
if (LinksCache.TryGetValue(serviceAbbreviation, out document))
{
ConstructLinks(sb, document, "*");
ConstructLinks(sb, document, cmdletName);
}
}
// Add link for User Guide to all cmdlets
AppendLink(sb, "AWS Tools for PowerShell User Guide", "http://docs.aws.amazon.com/powershell/latest/userguide/");
writer.AddPageElement(CmdletPageWriter.RelatedLinksElementKey, sb.ToString());
}
public void ConstructLinks(StringBuilder sb, XmlDocument document, string target)
{
var links = GetRelatedLinks(document, target);
if (links != null)
{
foreach (XmlNode link in links)
{
string displayname = null;
try { displayname = link.Attributes["name"].InnerText; } catch { }
if (string.IsNullOrEmpty(displayname) || string.IsNullOrEmpty(link.InnerText))
{
Logger.LogError("Malformed link {0}, skipping" + link.OuterXml.ToString());
}
AppendLink(sb, displayname, link.InnerText);
}
}
}
private void AppendLink(StringBuilder sb, string linkText, string linkAddress)
{
sb.Append(" ");
}
/// Alias | Cmdlet |
{0} | {1} |