Esempio n. 1
0
 private void Preprocess()
 {
     PreExportProcess preProcessor = new PreExportProcess(_projInfo);
     preProcessor.GetReferenceList(_projInfo.DefaultXhtmlFileWithPath, _sourceList, _targetList);
     preProcessor.GetGlossaryList(_projInfo.DefaultXhtmlFileWithPath, _glossaryList);
     //TD-2912
     if (_projInfo.ProjectInputType.ToLower() == "dictionary")
     {
         _entryIdList = preProcessor.GetMultiPictureEntryId(_projInfo.DefaultXhtmlFileWithPath);
         _headwordVariable = preProcessor.PrepareCurrentNextHeadwordPair();
     }
 }
Esempio n. 2
0
        private void FixRelativeHyperlinks(string contentFolder)
        {
            string[] files = Directory.GetFiles(contentFolder, "PartFile*.xhtml");
            string[] revFiles = Directory.GetFiles(contentFolder, "RevIndex*.xhtml");
            //inProcess.AddToMaximum(files.Length);
            var preExport = new PreExportProcess();
            var dictHyperlinks = new Dictionary<string, string>();
            var sourceList = new List<string>();
            var targetList = new List<string>();
            var targettempList = new List<string>();
            var fileDict = new Dictionary<string, string>();

            foreach (string targetFile in files)
            {
                preExport.GetReferenceList(targetFile, sourceList, targettempList);

                targetList.AddRange(targettempList);
                foreach (string target in targettempList)
                {
                    fileDict[target] = Path.GetFileName(targetFile);
                }
                targettempList.Clear();
            }

            foreach (string target in targetList)
            {
                if (sourceList.Contains(target) && !dictHyperlinks.ContainsKey(target))
                {
                    dictHyperlinks.Add(target, fileDict[target] + "#" + target);
                }
            }

            if (dictHyperlinks.Count > 0)
            {
                foreach (string targetFile in files)
                {
                    RemoveSpanVerseNumberNodeInXhtmlFile(targetFile);
                    ReplaceAllBrokenHrefs(targetFile, dictHyperlinks);
                }
                foreach (string targetFile in revFiles)
                {
                    RemoveSpanVerseNumberNodeInXhtmlFile(targetFile);
                    ReplaceAllBrokenHrefs(targetFile, dictHyperlinks);
                }
            }
            else
            {
                if (files.Length > 0)
                {
                    foreach (string targetFile in files)
                    {
                        RemoveSpanVerseNumberNodeInXhtmlFile(targetFile);
                    }
                }
                if (revFiles.Length > 0)
                {
                    foreach (string targetFile in revFiles)
                    {
                        RemoveSpanVerseNumberNodeInXhtmlFile(targetFile);
                    }
                }
            }
        }