Ejemplo n.º 1
0
 /// <summary>
 /// This method is used to execute the plug-in during the build process
 /// </summary>
 /// <param name="context">The current execution context</param>
 public void Execute(ExecutionContext context)
 {
     if (context.BuildStep == BuildStep.CompilingHelpFile)
     {
         // Merge the additional reference links information
         if (builder.CurrentFormat == HelpFileFormats.HtmlHelp1)
         {
             builder.ReportProgress("Adjusting generated help topics for X# Functions and procedures for local help");
             XSharpDocChanger.Convert(builder, builder.CurrentFormat);
         }
         if (builder.CurrentFormat == HelpFileFormats.MSHelpViewer)
         {
             builder.ReportProgress("Adjusting generated help topics for X# Functions and procedures for local help");
             XSharpDocChanger.Convert(builder, builder.CurrentFormat);
         }
         return;
     }
     if (context.BuildStep == BuildStep.CopyingWebsiteFiles)
     {
         // Merge the additional reference links information
         builder.ReportProgress("Adjusting generated help topics for X# Functions and procedures for website");
         XSharpDocChanger.Convert(builder, builder.CurrentFormat);
         return;
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// This method is used to execute the plug-in during the build process
 /// </summary>
 /// <param name="context">The current execution context</param>
 public void Execute(ExecutionContext context)
 {
     if (context.BuildStep == BuildStep.CompilingHelpFile)
     {
         // Merge the additional reference links information
         if (builder.CurrentFormat == HelpFileFormats.HtmlHelp1)
         {
             builder.ReportProgress("Adjusting generated help topics for X# Functions and procedures for local help");
             XSharpDocChanger.Convert(builder, builder.CurrentFormat);
         }
         if (builder.CurrentFormat == HelpFileFormats.MSHelpViewer)
         {
             builder.ReportProgress("Adjusting generated help topics for X# Functions and procedures for local help");
             XSharpDocChanger.Convert(builder, builder.CurrentFormat);
         }
         return;
     }
     if (context.BuildStep == BuildStep.GenerateHelpFormatTableOfContents)
     {
         ;
     }
     if (context.BuildStep == BuildStep.GenerateFullTextIndex)
     {
         // Merge the additional reference links information
         XSharpDocChanger.Convert(builder, builder.CurrentFormat);
         builder.ReportProgress("Adjusting web TOC for X# Functions and procedures for website");
         // Load the web TOC generated by SandcastleHtmlExtract
         string    file        = Path.Combine(builder.WorkingFolder, "WebTOC.xml");
         XDocument webtoc      = XDocument.Load(file);
         var       elements    = webtoc.XPathSelectElements("//*");
         var       websitePath = builder.WorkingFolder + "Output\\Website";
         foreach (var element in elements)
         {
             var attr = element.Attribute("Url");
             if (attr != null)
             {
                 var url  = attr.Value;
                 var path = Path.Combine(websitePath, url);
                 if (System.IO.File.Exists(path))
                 {
                     // Load the title from the topic page
                     XDocument topic        = XDocument.Load(path);
                     var       titleElement = topic.XPathSelectElement("//title");
                     attr = element.Attribute("Title");
                     if (attr != null)
                     {
                         element.SetAttributeValue("Title", titleElement.Value);
                     }
                 }
             }
         }
         webtoc.Save(file);
         return;
     }
 }