Changeset 8593


Ignore:
Timestamp:
Feb 3, 2020, 7:58:05 PM (2 years ago)
Author:
Sven Rech
Message:

OnlineDocumentationGenerator: Use relative paths for linking to template files.

Location:
trunk/OnlineDocumentationGenerator
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/OnlineDocumentationGenerator/DocGenerator.cs

    r8109 r8593  
    1313using OnlineDocumentationGenerator.Generators;
    1414using Cryptool.PluginBase.Attributes;
     15using OnlineDocumentationGenerator.Generators.HtmlGenerator;
     16using OnlineDocumentationGenerator.Utils;
    1517
    1618namespace OnlineDocumentationGenerator
     
    105107            templateDir.SubDirectories.Sort(CompareTemplateDirectories);
    106108
     109            var templatePath = new DirectoryInfo(Path.Combine(generator.OutputDir, OnlineHelp.HelpDirectory, OnlineHelp.RelativeTemplateDocDirectory));
    107110            foreach (var file in directory.GetFiles().Where(x => (x.Extension.ToLower() == ".cwm")))
    108111            {
    109112                try
    110113                {
    111                     var templatePage = new TemplateDocumentationPage(file.FullName, subdir, templateDir);
     114                    var relTemplateFilePath = RelativePaths.GetRelativePath(file, templatePath);
     115                    var templatePage = new TemplateDocumentationPage(file.FullName, relTemplateFilePath, subdir, templateDir);
    112116                    if (templatePage.RelevantPlugins != null)
    113117                    {
  • trunk/OnlineDocumentationGenerator/DocInformations/TemplateDocumentationPage.cs

    r8109 r8593  
    4545        }
    4646
    47         public TemplateDocumentationPage(string templateFile, string relativeTemplateDirectory, TemplateDirectory templateDir)
     47        public TemplateDocumentationPage(
     48            string templateFilePath,
     49            string relativeTemplateFilePath,
     50            string relativeTemplateDirectory,
     51            TemplateDirectory templateDir)
    4852        {
    4953            _relativeTemplateDirectory = relativeTemplateDirectory;
    50             TemplateFile = templateFile;
     54            TemplateFile = relativeTemplateFilePath;
    5155            TemplateDir = templateDir;
    5256           
    53             string templateXMLFile = Path.Combine(Path.GetDirectoryName(templateFile), Path.GetFileNameWithoutExtension(templateFile) + ".xml");
     57            string templateXMLFile = Path.Combine(Path.GetDirectoryName(templateFilePath), Path.GetFileNameWithoutExtension(templateFilePath) + ".xml");
    5458            if (!File.Exists(templateXMLFile))
    55                 throw new Exception(string.Format("Missing meta infos for template {0}!", templateFile));
     59                throw new Exception(string.Format("Missing meta infos for template {0}!", templateFilePath));
    5660
    5761            TemplateXML = XElement.Load(templateXMLFile);
     
    6064            if (TemplateXML.Element("icon") != null && TemplateXML.Element("icon").Attribute("file") != null)
    6165            {
    62                 var iconFile = Path.Combine(Path.GetDirectoryName(templateFile), TemplateXML.Element("icon").Attribute("file").Value);
     66                var iconFile = Path.Combine(Path.GetDirectoryName(templateFilePath), TemplateXML.Element("icon").Attribute("file").Value);
    6367                if (iconFile == null || !File.Exists(iconFile))
    6468                {
    65                     iconFile = Path.Combine(Path.GetDirectoryName(templateFile), Path.GetFileNameWithoutExtension(templateFile) + ".png");
     69                    iconFile = Path.Combine(Path.GetDirectoryName(templateFilePath), Path.GetFileNameWithoutExtension(templateFilePath) + ".png");
    6670                }
    6771                if (File.Exists(iconFile))
  • trunk/OnlineDocumentationGenerator/OnlineDocumentationGenerator.csproj

    r8308 r8593  
    136136    <Compile Include="Reference\ReferenceList.cs" />
    137137    <Compile Include="TemplateDirectory.cs" />
     138    <Compile Include="Utils\RelativePaths.cs" />
    138139  </ItemGroup>
    139140  <ItemGroup>
Note: See TracChangeset for help on using the changeset viewer.