/// <summary> /// Initializes a new instance of the <see cref="BuildStyle"/> class with /// the specified style type. /// </summary> /// <param name="type"> /// An enumeration of the type <see cref="BuildStyleType"/> specifying the type /// of the transformation and presentation style. /// </param> public BuildStyle(BuildStyleType type) { _styleType = type; _scripts = new ScriptContent("CommonScripts"); _styleSheets = new StyleSheetContent("CommonStyleSheets"); _snippets = new SnippetContent("CommonSnippets"); _mathPackages = new MathPackageContent(); _mathCommands = new MathCommandContent(); string sandAssistDir = Path.GetDirectoryName( Assembly.GetExecutingAssembly().Location); string codeStyleFile = Path.Combine(sandAssistDir, @"Styles\IrisModifiedVS.css"); string assistStyleFile = Path.Combine(sandAssistDir, String.Format(@"Styles\{0}\SandAssist.css", BuildStyle.StyleFolder(type))); StyleSheetItem codeStyle = new StyleSheetItem("CodeStyle", codeStyleFile); codeStyle.Condition = "CodeHighlight"; _styleSheets.Add(codeStyle); StyleSheetItem assistStyle = new StyleSheetItem("AssistStyle", assistStyleFile); _styleSheets.Add(assistStyle); string assistScriptFile = Path.Combine(sandAssistDir, String.Format(@"Scripts\{0}\SandAssist.js", BuildStyle.StyleFolder(type))); ScriptItem assistScript = new ScriptItem("AssistScripts", assistScriptFile); _scripts.Add(assistScript); }
/// <summary> /// The creates the configuration information or settings required by the /// target component for the build process. /// </summary> /// <param name="group"> /// A build group, <see cref="BuildGroup"/>, representing the documentation /// target for configuration. /// </param> /// <param name="writer"> /// An <see cref="XmlWriter"/> object used to create one or more new /// child nodes at the end of the list of child nodes of the current node. /// </param> /// <returns> /// Returns <see langword="true"/> for a successful configuration; /// otherwise, it returns <see langword="false"/>. /// </returns> /// <remarks> /// The <see cref="XmlWriter"/> writer passed to this configuration object /// may be passed on to other configuration objects, so do not close or /// dispose it. /// </remarks> public override bool Configure(BuildGroup group, XmlWriter writer) { BuildExceptions.NotNull(group, "group"); BuildExceptions.NotNull(writer, "writer"); if (!this.Enabled || !this.IsInitialized) { return(false); } Debug.Assert(_settings != null, "The settings object is required."); if (_settings == null || _context == null) { return(false); } BuildGroupContext groupContext = _context.GroupContexts[group.Id]; if (groupContext == null) { throw new BuildException( "The group context is not provided, and it is required by the build system."); } //<component type="Sandcastle.Components.ReferencePostTransComponent" assembly="$(SandAssistComponent)"> // <paths outputPath=".\Output\"/> // <attributes> // <attribute name="DocSet" value="NETFramework" /> // <attribute name="DocSet" value="NETCompactFramework"/> // </attributes> // <scripts> // <IncludeItem item="assistScripts" /> // </scripts> // <styles> // <!-- Include the various styles used by the Sandcastle Assist --> // <IncludeItem item="codeStyle" /> // <IncludeItem item="assistStyle" /> // </styles> // <header> // <!-- Include the logo image support --> // <IncludeItem item="logoImage" /> // <!--<tables> // <table name="" operation="" /> // </tables>--> // </header> //</component> BuildFeedback feeback = _settings.Feedback; Debug.Assert(feeback != null, "Feedback object cannot be null (or Nothing)."); if (feeback == null) { return(false); } BuildStyle buildStyle = _settings.Style; Debug.Assert(buildStyle != null, "The style object cannot be null (or Nothing)."); if (buildStyle == null) { return(false); } writer.WriteStartElement("paths"); //start: paths writer.WriteAttributeString("outputPath", @".\Output\"); writer.WriteEndElement(); //end: paths AttributeContent attributes = _settings.Attributes; if (attributes != null && attributes.Count != 0) { writer.WriteStartElement("attributes"); //start: attributes for (int i = 0; i < attributes.Count; i++) { AttributeItem attribute = attributes[i]; if (attribute.IsEmpty) { continue; } writer.WriteStartElement("attribute"); //start: attribute writer.WriteAttributeString("name", attribute.Name); writer.WriteAttributeString("value", attribute.Value); writer.WriteEndElement(); //end: attribute } writer.WriteEndElement(); //end: attributes } writer.WriteStartElement("scripts"); //start: scripts ScriptContent scriptContent = buildStyle.Scripts; if (scriptContent != null && !scriptContent.IsEmpty) { for (int i = 0; i < scriptContent.Count; i++) { ScriptItem scriptItem = scriptContent[i]; // a. Empty item is no use. // b. Overriding scripts are added to the documentation // by the transform. if (scriptItem.IsEmpty || scriptItem.Overrides) { continue; } writer.WriteStartElement("script"); //start: script writer.WriteAttributeString("file", scriptItem.ScriptFile); writer.WriteAttributeString("condition", scriptItem.Condition); writer.WriteEndElement(); //end: script } } writer.WriteEndElement(); //end: scripts writer.WriteStartElement("styles"); //start: styles StyleSheetContent styleContent = buildStyle.StyleSheets; if (styleContent != null && !styleContent.IsEmpty) { for (int i = 0; i < styleContent.Count; i++) { StyleSheetItem styleItem = styleContent[i]; // a. Empty item is no use. // b. Overriding styles are added to the documentation // by the transform. if (styleItem.IsEmpty || styleItem.Overrides) { continue; } writer.WriteStartElement("style"); //start: style writer.WriteAttributeString("file", styleItem.StyleFile); writer.WriteAttributeString("condition", styleItem.Condition); writer.WriteEndElement(); //end: style } } writer.WriteEndElement(); //end: styles // Let the Feedback option object configure itself... feeback.Configure(group, writer); // Write roots to namespaces conversion handler... writer.WriteStartElement("rootNamespaces"); // start: rootNamespaces writer.WriteAttributeString("id", group.Id); string rootNamespacesFile = Path.Combine(_context.WorkingDirectory, groupContext["$RootNamespaces"]); if (File.Exists(rootNamespacesFile)) { writer.WriteAttributeString("source", rootNamespacesFile); } writer.WriteEndElement(); //end: rootNamespaces return(true); }