Esempio n. 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);
                }
            });
        }
Esempio n. 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);
             }
         });
 }
Esempio n. 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);
             }
         });
 }