示例#1
0
        private void UpdateHref(HostService hostService, IDocumentProcessor processor, DocumentBuildContext context)
        {
            Func <string, string, string> updater = (originalPathToFile, filePathToRoot) =>
            {
                string href;
                if (string.IsNullOrEmpty(originalPathToFile) || !context.FileMap.TryGetValue(originalPathToFile, out href))
                {
                    return(originalPathToFile);
                }
                var relativePath = ((RelativePath)href).MakeRelativeTo(((RelativePath)filePathToRoot).GetPathFromWorkingFolder());
                return(relativePath);
            };

            hostService.Models.RunAll(
                m =>
            {
                using (new LoggerFileScope(m.OriginalFileAndType.File))
                {
                    Logger.LogVerbose($"Plug-in {processor.Name}: Updating href...");
                    processor.UpdateHref(m, updater);
                }
            });
        }
示例#2
0
 private void UpdateHref(HostService hostService, IDocumentProcessor processor, DocumentBuildContext context)
 {
     Func<string, string, string> updater = (originalPathToFile, filePathToRoot) =>
     {
         string href;
         if (string.IsNullOrEmpty(originalPathToFile) || !context.FileMap.TryGetValue(originalPathToFile, out href))
         {
             return originalPathToFile;
         }
         var relativePath = ((RelativePath)href).MakeRelativeTo(((RelativePath)filePathToRoot).GetPathFromWorkingFolder());
         return relativePath;
     };
     hostService.Models.RunAll(
         m =>
         {
             using (new LoggerFileScope(m.OriginalFileAndType.File))
             {
                 Logger.LogVerbose($"Plug-in {processor.Name}: Updating href...");
                 processor.UpdateHref(m, updater);
             }
         });
 }
示例#3
0
 private void UpdateHref(HostService hostService, IDocumentProcessor processor, DocumentBuildContext context)
 {
     hostService.Models.RunAll(
         m =>
         {
             using (new LoggerFileScope(m.OriginalFileAndType.File))
             {
                 Logger.LogVerbose($"Plug-in {processor.Name}: Updating href...");
                 processor.UpdateHref(m, context);
             }
         });
 }