Пример #1
0
        /* Function: Build
         *
         * Builds the JavaScript metadata for the <Topic> and appends it to the passed StringBuilder.
         *
         * Parameters:
         *
         *		topics - The <Topics> that appear in this file.
         *		links - A list of <Links> that includes everything that appears in the topic bodies.
         *		fileTitle - The title of the file.
         *		fileHashPath - The hash path of the file.
         *		summaryPath - A path to the summary metadata file to build.
         *		summaryToolTipsPath - A path to the summary tooltips metadata file to build.
         */
        public void Build(IList <Topic> topics, IList <Link> links, string fileTitle, string fileHashPath, Path summaryPath, Path summaryToolTipsPath)
        {
            this.output       = new StringBuilder();
            this.fileTitle    = fileTitle;
            this.fileHashPath = fileHashPath;
            this.topics       = topics;
            this.links        = links;

            usedLanguages.Clear();
            usedCommentTypes.Clear();


            // Summary.js

            output.Append(
                "NDFramePage.OnPageTitleLoaded(\"" + fileHashPath.StringEscape() + "\",\"" + fileTitle.StringEscape() + "\");"
                );

            if (!EngineInstance.Config.ShrinkFiles)
            {
                output.AppendLine();
                output.AppendLine();
            }

            output.Append("NDSummary.OnSummaryLoaded(\"" + fileHashPath.StringEscape() + "\",");

            BuildLanguageList();
            output.Append(',');

            if (!EngineInstance.Config.ShrinkFiles)
            {
                output.AppendLine();
            }

            BuildCommentTypeList();
            output.Append(',');

            if (!EngineInstance.Config.ShrinkFiles)
            {
                output.AppendLine();
            }

            BuildSummaryEntries();

            if (!EngineInstance.Config.ShrinkFiles)
            {
                output.AppendLine();
                output.Append("   ");
            }

            output.Append(");");


            System.IO.StreamWriter summaryFile = HTMLBuilder.CreateTextFileAndPath(summaryPath);

            try
            { summaryFile.Write(output.ToString()); }
            finally
            { summaryFile.Dispose(); }


            // SummaryToolTips.js

            output.Remove(0, output.Length);

            output.Append(
                "NDSummary.OnToolTipsLoaded(\"" + fileHashPath.StringEscape() + "\",{"
                );

            BuildSummaryToolTips();

            if (!EngineInstance.Config.ShrinkFiles)
            {
                output.AppendLine();
                output.Append("   ");
            }

            output.Append("});");

            System.IO.StreamWriter summaryToolTipsFile = HTMLBuilder.CreateTextFileAndPath(summaryToolTipsPath);

            try
            { summaryToolTipsFile.Write(output.ToString()); }
            finally
            { summaryToolTipsFile.Dispose(); }
        }