Exemple #1
0
 protected virtual void WriteFooter(TextWriter writer)
 {
     writer.WriteLine("<div id=\"pageFooter\">");
     writer.WriteLine("<span class=\"newline linkto\"><a href=\"javascript:void(0)\" onclick=\"AWSHelpObj.displayLink('{0}/{1}', '{2}')\">Link to this page</a></span>",
                      this.GenerateFilepath(),
                      FilenameGenerator.Escape(this.GenerateFilename()),
                      FilenameGenerator.Escape(this.GetTOCID()));
     writer.WriteLine("<span class=\"divider\">&nbsp;</span>");
     writer.WriteLine(FeedbackSection, GenerateFeedbackHTML());
     writer.WriteLine("<div id=\"awsdocs-legal-zone-copyright\"></div>");
     writer.WriteLine("</div>");
     WriteScriptFiles(writer);
 }
Exemple #2
0
        private string GenerateFeedbackHTML()
        {
            var          filename    = FilenameGenerator.Escape(Path.GetFileNameWithoutExtension(GenerateFilename()));
            const string baseUrl     = "https://docs.aws.amazon.com/forms/aws-doc-feedback";
            var          queryString = string.Format("?service_name={0}&amp;file_name={1}",
                                                     "NET-Ref-V3", // service_name
                                                     filename      // guide_name
                                                     );
            var fullUrl = baseUrl + queryString;

            const string feedbackContentFormat = "<span id=\"feedback\">" +
                                                 "<!-- BEGIN-FEEDBACK-SECTION -->" +
                                                 "Did this page help you?&nbsp;&nbsp;" +
                                                 "<a href=\"http://docs.aws.amazon.com/sdkfornet/latest/apidocs/feedbackyes.html?topic_id={0}\" target=\"_blank\">Yes</a>&nbsp;&nbsp;" +
                                                 "<a href=\"http://docs.aws.amazon.com/sdkfornet/latest/apidocs/feedbackno.html?topic_id={0}\" target=\"_blank\">No</a>&nbsp;&nbsp;&nbsp;" +
                                                 "<a href=\"{1}\" target=\"_blank\">Tell us about it...</a>" +
                                                 "</span>" +
                                                 "<!-- END-FEEDBACK-SECTION -->";
            string feedbackContent = string.Format(feedbackContentFormat, filename, fullUrl);

            return(feedbackContent);
        }
Exemple #3
0
        public void Write()
        {
            var filename = Path.Combine(Artifacts.OutputFolder, GenerateFilepath(), GenerateFilename());

            try
            {
                RootRelativePath = ComputeRelativePathToRoot(filename);
            }
            catch (PathTooLongException)
            {
                Console.WriteLine("Path is too long for file : {0}", filename);
                throw;
            }

            var directory = new FileInfo(filename).Directory.FullName;

            if (!Directory.Exists(directory))
            {
                Console.WriteLine("\t\tcreating directory: {0}", directory);
                Directory.CreateDirectory(directory);
            }

            using (var writer = new StringWriter())
            {
                writer.WriteLine("<html>");
                writer.WriteLine("<head>");
                writer.WriteLine("<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"/>");

                writer.WriteLine("<link rel=\"stylesheet\" type=\"text/css\" href=\"{0}/resources/style.css\"/>", RootRelativePath);
                writer.WriteLine("<link rel=\"stylesheet\" type=\"text/css\" href=\"{0}/resources/syntaxhighlighter/shCore.css\">", RootRelativePath);
                writer.WriteLine("<link rel=\"stylesheet\" type=\"text/css\" href=\"{0}/resources/syntaxhighlighter/shThemeDefault.css\">", RootRelativePath);
                writer.WriteLine("<link rel=\"stylesheet\" type=\"text/css\" href=\"{0}/resources/sdkstyle.css\"/>", RootRelativePath);

                // every page needs a title, meta description and canonical url to satisfy indexing. The summary/synopsis
                // text for an element has proven unreliable as a useful source for info the search results so stay with
                // the page title for now
                writer.WriteLine("<meta name=\"description\" content=\"{0}\">", GetTitle());
                writer.WriteLine("<title>{0} | AWS SDK for .NET V3</title>", GetTitle());
                writer.WriteLine("<script type=\"text/javascript\" src=\"/assets/js/awsdocs-boot.js\"></script>");
                writer.WriteLine("<link rel=\"canonical\" href=\"http://docs.aws.amazon.com/sdkfornet/v3/apidocs/index.html?page={0}&tocid={1}\"/>",
                                 FilenameGenerator.Escape(this.GenerateFilename()),
                                 FilenameGenerator.Escape(this.GetTOCID()));

                writer.WriteLine("</head>");

                writer.WriteLine("<body>");

                // every page needs two hidden divs giving the search indexer the product title and guide name
                writer.WriteLine("<div id=\"product_name\">AWS SDK Version 3 for .NET</div>");
                writer.WriteLine("<div id=\"guide_name\">API Reference</div>");

                WriteRegionDisclaimer(writer);

                this.WriteHeader(writer);
                this.WriteToolbar(writer);

                writer.WriteLine("<div id=\"pageContent\">");
                this.WriteContent(writer);
                writer.WriteLine("</div>");

                this.WriteFooter(writer);

                writer.WriteLine("</body>");
                writer.WriteLine("</html>");

                // normalize all line endings so any docs committed into Git present a consistent
                // set of line terminators for core.autocrlf to work with
                var content = new StringBuilder(writer.ToString());
                content.Replace("\r\n", "\n").Replace("\n", "\r\n");

                using (var fileWriter = new StreamWriter(filename))
                {
                    fileWriter.Write(content);
                }
            }
        }