GetTocInfo() public method

public GetTocInfo ( ) : IImmutableList
return IImmutableList
Esempio n. 1
0
 private static List <HomepageInfo> GetHomepages(DocumentBuildContext context)
 {
     return((from s in context.GetTocInfo()
             where !string.IsNullOrEmpty(s.Homepage)
             select new HomepageInfo
     {
         Homepage = RelativePath.GetPathWithoutWorkingFolderChar(s.Homepage),
         TocPath = RelativePath.GetPathWithoutWorkingFolderChar(context.GetFilePath(s.TocFileKey))
     }).ToList());
 }
Esempio n. 2
0
 private static List <HomepageInfo> GetHomepages(DocumentBuildContext context)
 {
     return(context.GetTocInfo()
            .Where(s => !string.IsNullOrEmpty(s.Homepage))
            .Select(s => new HomepageInfo
     {
         Homepage = TypeForwardedToRelativePath.GetPathWithoutWorkingFolderChar(s.Homepage),
         TocPath = TypeForwardedToRelativePath.GetPathWithoutWorkingFolderChar(context.GetFilePath(s.TocFileKey))
     }).ToList());
 }
Esempio n. 3
0
        public static List <TemplateManifestItem> Transform(TemplateProcessor processor, List <ManifestItem> manifest, DocumentBuildContext context, ApplyTemplateSettings settings)
        {
            if (settings.Options == ApplyTemplateOptions.ExportRawModel || processor == null)
            {
                ExportRawModel(manifest, settings);
                return(null);
            }

            using (new LoggerPhaseScope("Apply Templates"))
            {
                Logger.LogInfo($"Applying templates to {manifest.Count} model(s)...");

                processor.ProcessDependencies(settings.OutputFolder);
                if (processor.IsEmpty)
                {
                    Logger.LogWarning("No template is found.");
                    ExportRawModel(manifest, settings);
                    return(null);
                }

                Logger.LogVerbose("Start applying template...");

                var outputDirectory = context.BuildOutputFolder;

                var templateManifest = processor.Transform(manifest, context, settings);

                if (!settings.Options.HasFlag(ApplyTemplateOptions.TransformDocument))
                {
                    Logger.LogInfo("Dryrun, no template will be applied to the documents.");
                }

                if (templateManifest.Count > 0)
                {
                    // Save manifest from template
                    // TODO: Keep .manifest for backward-compatability, will remove next sprint
                    var manifestPath = Path.Combine(outputDirectory ?? string.Empty, Constants.ObsoleteManifestFileName);
                    JsonUtility.Serialize(manifestPath, templateManifest);
                    // Logger.LogInfo($"Manifest file saved to {manifestPath}. NOTE: This file is out-of-date and will be removed in version 1.8, if you rely on this file, please change to use {Constants.ManifestFileName} instead.");

                    var manifestJsonPath = Path.Combine(outputDirectory ?? string.Empty, Constants.ManifestFileName);

                    var toc            = context.GetTocInfo();
                    var manifestObject = GenerateManifest(context, templateManifest);
                    JsonUtility.Serialize(manifestJsonPath, manifestObject);
                    Logger.LogInfo($"Manifest file saved to {manifestJsonPath}.");
                }
                return(templateManifest);
            }
        }
Esempio n. 4
0
 private static List<HomepageInfo> GetHomepages(DocumentBuildContext context)
 {
     return context.GetTocInfo()
         .Where(s => !string.IsNullOrEmpty(s.Homepage))
         .Select(s => new HomepageInfo
         {
             Homepage = RelativePath.GetPathWithoutWorkingFolderChar(s.Homepage),
             TocPath = RelativePath.GetPathWithoutWorkingFolderChar(context.GetFilePath(s.TocFileKey))
         }).ToList();
 }