private string GetPluginUrl(PluginDescription description) { // Template Parameters // Example: [{Name}](https://github.com/csuzw/TreeBeard/wiki/{Type}-{Name}) // 0: Type // 1: Name return string.Format("[{1}]({2}{0}-{1})", description.Type, description.Name, Constants.WikiUrl); }
private string Build(PluginDescription description, string templatesPath) { string templateText = File.ReadAllText(Path.Combine(templatesPath, Constants.MarkdownTemplates.PluginPageTemplate)); // Template Parameters // 0: Description // 1: Arguments (Table body: Name, Required, Description, Example) // 2: Dependencies (List) // 3: Type // 4: Name var arguments = GetArgumentsTable(description.Arguments); var dependencies = GetDependenciesList(description.Dependencies); return string.Format(templateText, description.Description, arguments, dependencies, description.Type, description.Name); }
private PluginDescription GetPlugin(XmlNode node) { var nameMatch = GetNameMatch(node); if (nameMatch == null || nameMatch.Groups.Count == 0) return null; var description = new PluginDescription { Type = (PluginType)Enum.Parse(typeof(PluginType), nameMatch.Groups["type"].Value), Name = nameMatch.Groups["name"].Value, Description = GetDescription(node), Arguments = GetArguments(node), Dependencies = GetDependencies(node) }; return description; }
public PluginPageBuilder(PluginDescription description, string templatesPath) { _fileName = new Lazy<string>(() => string.Format("{0}-{1}.md", description.Type, description.Name)); _text = new Lazy<string>(() => Build(description, templatesPath)); }