diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2012-03-11 21:16:19 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2012-03-11 21:16:19 -0700 |
commit | 6c29eba4701e48222941981d499eb08686788a22 (patch) | |
tree | 5e8d9e3b9cc175d3b4e7f214e31d6b0e235467cb /tools/Sandcastle/Source/BuildAssembler | |
parent | 4cc2523e6f2c2f9975d3328ae983cc509c449315 (diff) | |
download | DotNetOpenAuth-6c29eba4701e48222941981d499eb08686788a22.zip DotNetOpenAuth-6c29eba4701e48222941981d499eb08686788a22.tar.gz DotNetOpenAuth-6c29eba4701e48222941981d499eb08686788a22.tar.bz2 |
Upgraded to Sandcastle June 2010 release (changeset 54478).
Diffstat (limited to 'tools/Sandcastle/Source/BuildAssembler')
22 files changed, 985 insertions, 419 deletions
diff --git a/tools/Sandcastle/Source/BuildAssembler/BuildAssembler/BuildAssemblerConsole.csproj b/tools/Sandcastle/Source/BuildAssembler/BuildAssembler/BuildAssemblerConsole.csproj new file mode 100644 index 0000000..7086f62 --- /dev/null +++ b/tools/Sandcastle/Source/BuildAssembler/BuildAssembler/BuildAssemblerConsole.csproj @@ -0,0 +1,65 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.50727</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{A44C178B-5384-4F5C-BB54-85C720796CE5}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>BuildAssemblerConsole</RootNamespace> + <AssemblyName>BuildAssembler</AssemblyName> + <SccProjectName>SAK</SccProjectName> + <SccLocalPath>SAK</SccLocalPath> + <SccAuxPath>SAK</SccAuxPath> + <SccProvider>SAK</SccProvider> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="BuildAssemblerConsole.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\CommandLine\CommandLine\CommandLine.csproj"> + <Project>{656CFBE1-958B-4781-947C-D9EE65D90494}</Project> + <Name>CommandLine</Name> + </ProjectReference> + <ProjectReference Include="..\BuildAssembler\BuildAssembler.csproj"> + <Project>{5B0B5372-3CEF-4263-A5DC-B541EF47F86C}</Project> + <Name>BuildAssembler</Name> + </ProjectReference> + <ProjectReference Include="..\BuildComponents\BuildComponents.csproj"> + <Project>{528BB3F4-05CD-4FB8-8CB2-8C404B6656FD}</Project> + <Name>BuildComponents</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project>
\ No newline at end of file diff --git a/tools/Sandcastle/Source/BuildAssembler/BuildAssembler/Properties/AssemblyInfo.cs b/tools/Sandcastle/Source/BuildAssembler/BuildAssembler/Properties/AssemblyInfo.cs index a5d12d9..a699644 100644 --- a/tools/Sandcastle/Source/BuildAssembler/BuildAssembler/Properties/AssemblyInfo.cs +++ b/tools/Sandcastle/Source/BuildAssembler/BuildAssembler/Properties/AssemblyInfo.cs @@ -34,5 +34,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("2.5.10626.00")] -[assembly: AssemblyFileVersion("2.5.10626.00")] +[assembly: AssemblyVersion("2.6.10621.1")] +[assembly: AssemblyFileVersion("2.6.10621.1")] diff --git a/tools/Sandcastle/Source/BuildAssembler/BuildAssemblerLibrary/Properties/AssemblyInfo.cs b/tools/Sandcastle/Source/BuildAssembler/BuildAssemblerLibrary/Properties/AssemblyInfo.cs index e87d8d5..4b5fcda 100644 --- a/tools/Sandcastle/Source/BuildAssembler/BuildAssemblerLibrary/Properties/AssemblyInfo.cs +++ b/tools/Sandcastle/Source/BuildAssembler/BuildAssemblerLibrary/Properties/AssemblyInfo.cs @@ -39,5 +39,5 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("2.5.10626.00")] -[assembly: AssemblyFileVersion("2.5.10626.00")] +[assembly: AssemblyVersion("2.6.10621.1")] +[assembly: AssemblyFileVersion("2.6.10621.1")] diff --git a/tools/Sandcastle/Source/BuildAssembler/BuildComponents/BuildComponents.csproj b/tools/Sandcastle/Source/BuildAssembler/BuildComponents/BuildComponents.csproj index 9e3932f..e844ba6 100644 --- a/tools/Sandcastle/Source/BuildAssembler/BuildComponents/BuildComponents.csproj +++ b/tools/Sandcastle/Source/BuildAssembler/BuildComponents/BuildComponents.csproj @@ -89,6 +89,7 @@ <Compile Include="GlobalSuppressions.cs" /> <Compile Include="HxfGeneratorComponent.cs" /> <Compile Include="IntellisenseComponent2.cs" /> + <Compile Include="MSHCComponent.cs" /> <Compile Include="MsdnResolver.cs" /> <Compile Include="References.cs" /> <Compile Include="ResolveReferenceLinksComponent2.cs" /> diff --git a/tools/Sandcastle/Source/BuildAssembler/BuildComponents/GlobalSuppressions.cs b/tools/Sandcastle/Source/BuildAssembler/BuildComponents/GlobalSuppressions.cs index 3fd693e..65a3f01 100644 --- a/tools/Sandcastle/Source/BuildAssembler/BuildComponents/GlobalSuppressions.cs +++ b/tools/Sandcastle/Source/BuildAssembler/BuildComponents/GlobalSuppressions.cs @@ -317,3 +317,41 @@ [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields", Scope = "member", Target = "Microsoft.Ddue.Tools.Specialization.#arguments")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly", Scope = "member", Target = "Microsoft.Ddue.Tools.XmlTargetCollectionUtilities.#CreateTypeReference(System.Xml.XPath.XPathNavigator)")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member", Target = "Microsoft.Ddue.Tools.LinkTextResolver.#WriteConversionOperator(Microsoft.Ddue.Tools.ProcedureTarget,System.Xml.XmlWriter)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "MHS", Scope = "type", Target = "Microsoft.Ddue.Tools.MHSComponent")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.String.Format(System.String,System.Object)", Scope = "member", Target = "Microsoft.Ddue.Tools.MHSComponent.#AddMHSMeta(System.String,System.String,System.Boolean)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1304:SpecifyCultureInfo", MessageId = "System.String.ToLower", Scope = "member", Target = "Microsoft.Ddue.Tools.MHSComponent.#Apply(System.Xml.XmlDocument,System.String)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.Int32.ToString", Scope = "member", Target = "Microsoft.Ddue.Tools.MHSComponent.#Apply(System.Xml.XmlDocument,System.String)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.String.Format(System.String,System.Object)", Scope = "member", Target = "Microsoft.Ddue.Tools.MHSComponent.#Apply(System.Xml.XmlDocument,System.String)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.String.Format(System.String,System.Object)", Scope = "member", Target = "Microsoft.Ddue.Tools.MHSComponent.#FixHeaderBottomBackground(System.String,System.String)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.String.Format(System.String,System.Object,System.Object)", Scope = "member", Target = "Microsoft.Ddue.Tools.MHSComponent.#ModifyAttribute(System.String,System.String)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "Microsoft.Ddue.Tools.MHSComponent+ConfigurationAttr")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "Microsoft.Ddue.Tools.MHSComponent+ConfigurationTag")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "Microsoft.Ddue.Tools.MHSComponent+Help2Attr")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "Microsoft.Ddue.Tools.MHSComponent+Help2Namespace")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "Microsoft.Ddue.Tools.MHSComponent+Help2Value")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "Microsoft.Ddue.Tools.MHSComponent+Help2XPath")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "Microsoft.Ddue.Tools.MHSComponent+MHSDefault")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "Microsoft.Ddue.Tools.MHSComponent+MHSMetaAttr")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "Microsoft.Ddue.Tools.MHSComponent+MHSMetaName")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "Microsoft.Ddue.Tools.MHSComponent+MHSTag")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "Microsoft.Ddue.Tools.MHSComponent+TocAttr")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "Microsoft.Ddue.Tools.MHSComponent+TocXPath")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.String.Format(System.String,System.Object)", Scope = "member", Target = "Microsoft.Ddue.Tools.MSHCComponent.#AddMHSMeta(System.String,System.String,System.Boolean)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1304:SpecifyCultureInfo", MessageId = "System.String.ToLower", Scope = "member", Target = "Microsoft.Ddue.Tools.MSHCComponent.#Apply(System.Xml.XmlDocument,System.String)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.Int32.ToString", Scope = "member", Target = "Microsoft.Ddue.Tools.MSHCComponent.#Apply(System.Xml.XmlDocument,System.String)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.String.Format(System.String,System.Object)", Scope = "member", Target = "Microsoft.Ddue.Tools.MSHCComponent.#Apply(System.Xml.XmlDocument,System.String)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.String.Format(System.String,System.Object)", Scope = "member", Target = "Microsoft.Ddue.Tools.MSHCComponent.#FixHeaderBottomBackground(System.String,System.String)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.String.Format(System.String,System.Object,System.Object)", Scope = "member", Target = "Microsoft.Ddue.Tools.MSHCComponent.#ModifyAttribute(System.String,System.String)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "Microsoft.Ddue.Tools.MSHCComponent+ConfigurationAttr")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "Microsoft.Ddue.Tools.MSHCComponent+ConfigurationTag")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "Microsoft.Ddue.Tools.MSHCComponent+Help2Attr")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "Microsoft.Ddue.Tools.MSHCComponent+Help2Namespace")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "Microsoft.Ddue.Tools.MSHCComponent+Help2Value")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "Microsoft.Ddue.Tools.MSHCComponent+Help2XPath")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "Microsoft.Ddue.Tools.MSHCComponent+MHSDefault")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "Microsoft.Ddue.Tools.MSHCComponent+MHSMetaAttr")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "Microsoft.Ddue.Tools.MSHCComponent+MHSMetaName")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "Microsoft.Ddue.Tools.MSHCComponent+MHSTag")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "Microsoft.Ddue.Tools.MSHCComponent+TocAttr")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "Microsoft.Ddue.Tools.MSHCComponent+TocXPath")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "MSHC", Scope = "type", Target = "Microsoft.Ddue.Tools.MSHCComponent")] diff --git a/tools/Sandcastle/Source/BuildAssembler/BuildComponents/MSHCComponent.cs b/tools/Sandcastle/Source/BuildAssembler/BuildComponents/MSHCComponent.cs new file mode 100644 index 0000000..3fe5458 --- /dev/null +++ b/tools/Sandcastle/Source/BuildAssembler/BuildComponents/MSHCComponent.cs @@ -0,0 +1,368 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; +using System.Xml; +using System.Xml.XPath; +using Microsoft.Ddue.Tools; + +namespace Microsoft.Ddue.Tools +{ + /// <summary> + /// Sandcastle component converting Microsoft Help 2.0 output to Microsoft Help System output. + /// </summary> + public class MSHCComponent : BuildComponent + { + // component tag names in the configuration file + private class ConfigurationTag + { + public const string Data = "data"; + } + + // component attribute names in the configuration file + private class ConfigurationAttr + { + public const string Locale = "locale"; + public const string SelfBranded = "self-branded"; + public const string TopicVersion = "topic-version"; + public const string TocFile = "toc-file"; + public const string TocParent = "toc-parent"; + public const string TocParentVersion = "toc-parent-version"; + } + + // XPath expressions to navigate the TOC file + private class TocXPath + { + public const string Topics = "/topics"; + public const string Topic = "topic"; + } + + // attribute names in the TOC file + private class TocAttr + { + public const string Id = "id"; + } + + // Microsoft Help 2.0 namespace info + private class Help2Namespace + { + public const string Prefix = "MSHelp"; + public const string Uri = "http://msdn.microsoft.com/mshelp"; + } + + // XPath expressions to navigate Microsoft Help 2.0 data in the document + private class Help2XPath + { + public const string Head = "head"; + public const string Xml = "xml"; + public const string TocTitle = "MSHelp:TOCTitle"; + public const string Attr = "MSHelp:Attr[@Name='{0}']"; + public const string Keyword = "MSHelp:Keyword[@Index='{0}']"; + } + + // Microsoft Help 2.0 tag attributes in the document + private class Help2Attr + { + public const string Value = "Value"; + public const string Term = "Term"; + public const string Title = "Title"; + } + + // Microsoft Help 2.0 attribute values in the document + private class Help2Value + { + public const string K = "K"; + public const string F = "F"; + public const string Locale = "Locale"; + public const string AssetID = "AssetID"; + public const string DevLang = "DevLang"; + public const string Abstract = "Abstract"; + } + + // Microsoft Help System tags + private class MHSTag + { + public const string Meta = "meta"; + } + + // Microsoft Help System meta tag attributes + private class MHSMetaAttr + { + public const string Name = "name"; + public const string Content = "content"; + } + + // Microsoft Help System meta names + private class MHSMetaName + { + public const string SelfBranded = "SelfBranded"; + public const string ContentType = "ContentType"; + public const string Locale = "Microsoft.Help.Locale"; + public const string TopicLocale = "Microsoft.Help.TopicLocale"; + public const string Id = "Microsoft.Help.Id"; + public const string TopicVersion = "Microsoft.Help.TopicVersion"; + public const string TocParent = "Microsoft.Help.TocParent"; + public const string TocParentVersion = "Microsoft.Help.TOCParentTopicVersion"; + public const string TocOrder = "Microsoft.Help.TocOrder"; + public const string Title = "Title"; + public const string Keywords = "Microsoft.Help.Keywords"; + public const string F1 = "Microsoft.Help.F1"; + public const string Category = "Microsoft.Help.Category"; + public const string Description = "Description"; + } + + // Microsoft Help System meta default values + private class MHSDefault + { + public const bool SelfBranded = true; + public const string Locale = "en-us"; + public const string Reference = "Reference"; + public const string TopicVersion = "100"; + public const string TocParent = "-1"; + public const string TocParentVersion = "100"; + public const string TocFile = "./toc.xml"; + public const string ShortName = "MHS"; + } + + // TOC information of a document + private class TocInfo + { + private string _parent; + private string _parentVersion; + private int _order; + + public TocInfo(string parent, string parentVersion, int order) + { + _parent = parent; + _parentVersion = parentVersion; + _order = order; + } + + public string Parent { get { return _parent; }} + public string ParentVersion { get { return _parentVersion; } } + public int Order { get { return _order; } } + } + + private XmlDocument _document; + private XmlNode _head; + private XmlNode _xml; + + private string _locale = string.Empty; + private bool _selfBranded = MHSDefault.SelfBranded; + private string _topicVersion = MHSDefault.TopicVersion; + private string _tocParent = MHSDefault.TocParent; + private string _tocParentVersion = MHSDefault.TocParentVersion; + private Dictionary<string, TocInfo> _toc = new Dictionary<string, TocInfo>(); + /// <summary> + /// Creates a new instance of the <see cref="MHSComponent"/> class. + /// </summary> + /// <param name="assembler">The active <see cref="BuildAssembler"/>.</param> + /// <param name="configuration">The current <see cref="XPathNavigator"/> of the configuration.</param> + public MSHCComponent(BuildAssembler assembler, XPathNavigator configuration) + : base(assembler, configuration) + { + string tocFile = MHSDefault.TocFile; + XPathNavigator data = configuration.SelectSingleNode(ConfigurationTag.Data); + if (data != null) + { + string value = data.GetAttribute(ConfigurationAttr.Locale, string.Empty); + if (!string.IsNullOrEmpty(value)) + _locale = value; + + value = data.GetAttribute(ConfigurationAttr.SelfBranded, string.Empty); + if (!string.IsNullOrEmpty(value)) + _selfBranded = bool.Parse(value); + + value = data.GetAttribute(ConfigurationAttr.TopicVersion, string.Empty); + if (!string.IsNullOrEmpty(value)) + _topicVersion = value; + + value = data.GetAttribute(ConfigurationAttr.TocParent, string.Empty); + if (!string.IsNullOrEmpty(value)) + _tocParent = value; + + value = data.GetAttribute(ConfigurationAttr.TocParentVersion, string.Empty); + if (!string.IsNullOrEmpty(value)) + _tocParentVersion = value; + + value = data.GetAttribute(ConfigurationAttr.TocFile, string.Empty); + if (!string.IsNullOrEmpty(value)) + tocFile = value; + } + LoadToc(Path.GetFullPath(Environment.ExpandEnvironmentVariables(tocFile))); + } + + #region Public + /// <summary> + /// Applies Microsoft Help System transformation to the output document. + /// </summary> + /// <param name="document">The <see cref="XmlDocument"/> to apply transformation to.</param> + /// <param name="key">Topic key of the output document.</param> + public override void Apply(XmlDocument document, string key) + { + _document = document; + + ModifyAttribute("id", "mainSection"); + ModifyAttribute("class", "members"); + FixHeaderBottomBackground("nsrBottom", "headerBottom"); + + XmlElement html = _document.DocumentElement; + _head = html.SelectSingleNode(Help2XPath.Head); + if (_head == null) + { + _head = document.CreateElement(Help2XPath.Head); + if (!html.HasChildNodes) + html.AppendChild(_head); + else + html.InsertBefore(_head, html.FirstChild); + } + + AddMHSMeta(MHSMetaName.SelfBranded, _selfBranded.ToString().ToLower()); + AddMHSMeta(MHSMetaName.ContentType, MHSDefault.Reference); + AddMHSMeta(MHSMetaName.TopicVersion, _topicVersion); + + string locale = _locale; + string id = Guid.NewGuid().ToString(); + _xml = _head.SelectSingleNode(Help2XPath.Xml); + if (_xml != null) + { + XmlNamespaceManager nsmgr = new XmlNamespaceManager(_document.NameTable); + if (!nsmgr.HasNamespace(Help2Namespace.Prefix)) + nsmgr.AddNamespace(Help2Namespace.Prefix, Help2Namespace.Uri); + + XmlElement elem = _xml.SelectSingleNode(Help2XPath.TocTitle, nsmgr) as XmlElement; + if (elem != null) + AddMHSMeta(MHSMetaName.Title, elem.GetAttribute(Help2Attr.Title)); + + foreach (XmlElement keyword in _xml.SelectNodes(string.Format(Help2XPath.Keyword, Help2Value.K), nsmgr)) + AddMHSMeta(MHSMetaName.Keywords, keyword.GetAttribute(Help2Attr.Term), true); + + foreach (XmlElement keyword in _xml.SelectNodes(string.Format(Help2XPath.Keyword, Help2Value.F), nsmgr)) + AddMHSMeta(MHSMetaName.F1, keyword.GetAttribute(Help2Attr.Term), true); + + foreach (XmlElement lang in _xml.SelectNodes(string.Format(Help2XPath.Attr, Help2Value.DevLang), nsmgr)) + AddMHSMeta(MHSMetaName.Category, Help2Value.DevLang + ":" + lang.GetAttribute(Help2Attr.Value), true); + + elem = _xml.SelectSingleNode(string.Format(Help2XPath.Attr, Help2Value.Abstract), nsmgr) as XmlElement; + if (elem != null) + AddMHSMeta(MHSMetaName.Description, elem.GetAttribute(Help2Attr.Value)); + + elem = _xml.SelectSingleNode(string.Format(Help2XPath.Attr, Help2Value.AssetID), nsmgr) as XmlElement; + if (elem != null) + id = elem.GetAttribute(Help2Attr.Value); + + if (string.IsNullOrEmpty(locale)) + { + elem = _xml.SelectSingleNode(string.Format(Help2XPath.Attr, Help2Value.Locale), nsmgr) as XmlElement; + if (elem != null) + locale = elem.GetAttribute(Help2Attr.Value); + } + } + + if (string.IsNullOrEmpty(locale)) + locale = MHSDefault.Locale; + + AddMHSMeta(MHSMetaName.Locale, locale); + AddMHSMeta(MHSMetaName.TopicLocale, locale); + AddMHSMeta(MHSMetaName.Id, id); + + if (_toc.ContainsKey(id)) + { + TocInfo tocInfo = _toc[id]; + AddMHSMeta(MHSMetaName.TocParent, tocInfo.Parent); + if (tocInfo.Parent != MHSDefault.TocParent) + AddMHSMeta(MHSMetaName.TocParentVersion, tocInfo.ParentVersion); + AddMHSMeta(MHSMetaName.TocOrder, tocInfo.Order.ToString()); + } + + } + + #endregion + + #region Private + // loads TOC structure from a file + private void LoadToc(string path) + { + _toc.Clear(); + using (Stream stream = File.OpenRead(path)) + { + XPathDocument document = new XPathDocument(stream); + XPathNavigator navigator = document.CreateNavigator(); + LoadToc(navigator.SelectSingleNode(TocXPath.Topics), _tocParent, _tocParentVersion); + } + } + // loads TOC structure from an XPathNavigator + private void LoadToc(XPathNavigator navigator, string parent, string parentVersion) + { + int i = -1; + XPathNodeIterator interator = navigator.SelectChildren(TocXPath.Topic, string.Empty); + while (interator.MoveNext()) + { + XPathNavigator current = interator.Current; + string id = current.GetAttribute(TocAttr.Id, string.Empty); + if (!string.IsNullOrEmpty(id)) + { + TocInfo info = new TocInfo(parent, parentVersion, ++i); + _toc.Add(id, info); + LoadToc(current, id, _topicVersion); + } + } + } + + // Adds Microsoft Help System meta data to the output document + private XmlElement AddMHSMeta(string name, string content) + { + return AddMHSMeta(name, content, false); + } + + // Adds Microsoft Help System meta data to the output document + private XmlElement AddMHSMeta(string name, string content, bool multiple) + { + if (string.IsNullOrEmpty(content)) + return null; + XmlElement elem = null; + if (!multiple) + elem = _document.SelectSingleNode(string.Format(@"//meta[@{0}]", name)) as XmlElement; + if (elem == null) + { + elem = _document.CreateElement(MHSTag.Meta); + elem.SetAttribute(MHSMetaAttr.Name, name); + elem.SetAttribute(MHSMetaAttr.Content, content); + _head.AppendChild(elem); + } + return elem; + } + + // Modifies an attribute value to prevent conflicts with Microsoft Help System branding + private void ModifyAttribute(string name, string value) + { + XmlNodeList list = _document.SelectNodes(string.Format(@"//*[@{0}='{1}']", name, value)); + foreach (XmlElement elem in list) + elem.SetAttribute(name, value + MHSDefault.ShortName); + } + + // Works around a Microsoft Help System issue ('background' attribute isn't supported): + // adds a hidden image so that its path will be transformed by MHS runtime handler, + // sets the 'background' attribute to the transformed path on page load + private void FixHeaderBottomBackground(string className, string newId) + { + XmlElement elem = _document.SelectSingleNode(string.Format(@"//*[@class='{0}']", className)) as XmlElement; + if (elem == null) + return; + + string src = elem.GetAttribute("background"); + if (string.IsNullOrEmpty(src)) + return; + elem.SetAttribute("id", newId); + + XmlElement img = _document.CreateElement("img"); + img.SetAttribute("src", src); + img.SetAttribute("id", newId + "Image"); + img.SetAttribute("style", "display: none"); + + elem.AppendChild(img); + } + + #endregion + } +} diff --git a/tools/Sandcastle/Source/BuildAssembler/BuildComponents/Properties/AssemblyInfo.cs b/tools/Sandcastle/Source/BuildAssembler/BuildComponents/Properties/AssemblyInfo.cs index 41965fc..c15c5d6 100644 --- a/tools/Sandcastle/Source/BuildAssembler/BuildComponents/Properties/AssemblyInfo.cs +++ b/tools/Sandcastle/Source/BuildAssembler/BuildComponents/Properties/AssemblyInfo.cs @@ -38,5 +38,5 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("2.5.10626.00")] -[assembly: AssemblyFileVersion("2.5.10626.00")] +[assembly: AssemblyVersion("2.6.10621.1")] +[assembly: AssemblyFileVersion("2.6.10621.1")] diff --git a/tools/Sandcastle/Source/BuildAssembler/BuildComponents/ResolveConceptualLinksComponent.cs b/tools/Sandcastle/Source/BuildAssembler/BuildComponents/ResolveConceptualLinksComponent.cs index 2531e23..c830fef 100644 --- a/tools/Sandcastle/Source/BuildAssembler/BuildComponents/ResolveConceptualLinksComponent.cs +++ b/tools/Sandcastle/Source/BuildAssembler/BuildComponents/ResolveConceptualLinksComponent.cs @@ -168,6 +168,11 @@ namespace Microsoft.Ddue.Tools { writer.WriteAttributeString("keywords", link.Target.ToLower()); writer.WriteAttributeString("tabindex", "0"); break; + case LinkType.Id: + string xhelp = String.Format("ms-xhelp://?Id={0}", link.Target); + writer.WriteStartElement("a"); + writer.WriteAttributeString("href", xhelp); + break; } // write the link text @@ -215,7 +220,8 @@ namespace Microsoft.Ddue.Tools { internal enum LinkType { None, // not active Local, // a href - Index // mshelp:link keyword + Index, // mshelp:link keyword + Id // ms-xhelp link //Regex // regular expression with match/replace } diff --git a/tools/Sandcastle/Source/BuildAssembler/BuildComponents/ResolveReferenceLinksComponent2.cs b/tools/Sandcastle/Source/BuildAssembler/BuildComponents/ResolveReferenceLinksComponent2.cs index 22587ac..5ba0869 100644 --- a/tools/Sandcastle/Source/BuildAssembler/BuildComponents/ResolveReferenceLinksComponent2.cs +++ b/tools/Sandcastle/Source/BuildAssembler/BuildComponents/ResolveReferenceLinksComponent2.cs @@ -281,6 +281,12 @@ namespace Microsoft.Ddue.Tools { writer.WriteAttributeString("href", msdnUrl); writer.WriteAttributeString("target", linkTarget); break; + case LinkType2.Id: + string xhelp = String.Format("ms-xhelp://?Id={0}", targetId); + xhelp = xhelp.Replace("#", "%23"); + writer.WriteStartElement("a"); + writer.WriteAttributeString("href", xhelp); + break; } // write the link text diff --git a/tools/Sandcastle/Source/BuildAssembler/BuildComponents/SaveComponent.cs b/tools/Sandcastle/Source/BuildAssembler/BuildComponents/SaveComponent.cs index 8b8fea9..6c767ce 100644 --- a/tools/Sandcastle/Source/BuildAssembler/BuildComponents/SaveComponent.cs +++ b/tools/Sandcastle/Source/BuildAssembler/BuildComponents/SaveComponent.cs @@ -53,6 +53,12 @@ namespace Microsoft.Ddue.Tools { linkPath = save_node.GetAttribute("link", String.Empty); if (String.IsNullOrEmpty(linkPath)) linkPath = "../html"; + // add-xhtml-namespace adds a default namespace for xhtml. Required by Help3 documentation. + string addXhtmlDeclaration = save_node.GetAttribute("add-xhtml-namespace", String.Empty); + if (!String.IsNullOrEmpty(addXhtmlDeclaration)) + writeXhtmlNamespace = Convert.ToBoolean(addXhtmlDeclaration); + + // encoding settings.CloseOutput = true; @@ -63,6 +69,9 @@ namespace Microsoft.Ddue.Tools { private string linkPath = null; + private bool writeXhtmlNamespace = false; + + public override void Apply (XmlDocument document, string key) { // set the evaluation context @@ -95,6 +104,12 @@ namespace Microsoft.Ddue.Tools { string targetDirectory = Path.GetDirectoryName(path); if (!Directory.Exists(targetDirectory)) Directory.CreateDirectory(targetDirectory); + if (writeXhtmlNamespace) + { + document.DocumentElement.SetAttribute("xmlns", "http://www.w3.org/1999/xhtml"); + document.LoadXml(document.OuterXml); + } + // save the document // select_expression determines which nodes get saved. If there is no select_expression // we simply save the root node as before. If there is a select_expression, we evaluate the @@ -130,16 +145,16 @@ namespace Microsoft.Ddue.Tools { settings.ConformanceLevel = ConformanceLevel.Auto; using (StreamWriter output = File.CreateText(path)) { using (XmlWriter writer = XmlWriter.Create(output, settings)) { - XPathExpression select_xpath = select_expression.Clone(); - select_xpath.SetContext(context); - XPathNodeIterator ni = document.CreateNavigator().Select(select_expression); - while (ni.MoveNext()) { - if (ni.Current.NodeType == XPathNodeType.ProcessingInstruction && ni.Current.Name.Equals("literal-text")) { - writer.Flush(); - output.Write(ni.Current.Value); - } - else - ni.Current.WriteSubtree(writer); + XPathExpression select_xpath = select_expression.Clone(); + select_xpath.SetContext(context); + XPathNodeIterator ni = document.CreateNavigator().Select(select_expression); + while (ni.MoveNext()) { + if (ni.Current.NodeType == XPathNodeType.ProcessingInstruction && ni.Current.Name.Equals("literal-text")) { + writer.Flush(); + output.Write(ni.Current.Value); + } + else + ni.Current.WriteSubtree(writer); } } } diff --git a/tools/Sandcastle/Source/BuildAssembler/BuildComponents/SnippetComponent.cs b/tools/Sandcastle/Source/BuildAssembler/BuildComponents/SnippetComponent.cs index d4a3d68..a42e067 100644 --- a/tools/Sandcastle/Source/BuildAssembler/BuildComponents/SnippetComponent.cs +++ b/tools/Sandcastle/Source/BuildAssembler/BuildComponents/SnippetComponent.cs @@ -1135,9 +1135,6 @@ namespace Microsoft.Ddue.Tools string[] stringSeparators = new string[] { "\r\n" }; string[] lines = text.Split(stringSeparators, StringSplitOptions.None); - // no need to do this if there is only one line - if (lines.Length == 1) return (lines[0]); - // figure out how many leading spaces to delete int spaces = Int32.MaxValue; for (int i = 0; i < lines.Length; i++) diff --git a/tools/Sandcastle/Source/BuildAssembler/BuildComponents/TargetCollection.cs b/tools/Sandcastle/Source/BuildAssembler/BuildComponents/TargetCollection.cs index 188da53..c956b5e 100644 --- a/tools/Sandcastle/Source/BuildAssembler/BuildComponents/TargetCollection.cs +++ b/tools/Sandcastle/Source/BuildAssembler/BuildComponents/TargetCollection.cs @@ -2733,7 +2733,8 @@ namespace Microsoft.Ddue.Tools { Local, Index, LocalOrIndex, - Msdn + Msdn, + Id } }
\ No newline at end of file diff --git a/tools/Sandcastle/Source/BuildAssembler/CopyComponents/Properties/AssemblyInfo.cs b/tools/Sandcastle/Source/BuildAssembler/CopyComponents/Properties/AssemblyInfo.cs index c834f96..118b639 100644 --- a/tools/Sandcastle/Source/BuildAssembler/CopyComponents/Properties/AssemblyInfo.cs +++ b/tools/Sandcastle/Source/BuildAssembler/CopyComponents/Properties/AssemblyInfo.cs @@ -42,5 +42,5 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("2.5.10626.00")] -[assembly: AssemblyFileVersion("2.5.10626.00")] +[assembly: AssemblyVersion("2.6.10621.1")] +[assembly: AssemblyFileVersion("2.6.10621.1")] diff --git a/tools/Sandcastle/Source/BuildAssembler/SyntaxComponents/CPlusPlusDeclarationSyntax.cs b/tools/Sandcastle/Source/BuildAssembler/SyntaxComponents/CPlusPlusDeclarationSyntax.cs index 56c6316..98794c4 100644 --- a/tools/Sandcastle/Source/BuildAssembler/SyntaxComponents/CPlusPlusDeclarationSyntax.cs +++ b/tools/Sandcastle/Source/BuildAssembler/SyntaxComponents/CPlusPlusDeclarationSyntax.cs @@ -789,6 +789,7 @@ namespace Microsoft.Ddue.Tools { } private void WriteParameters (XPathNodeIterator parameters, bool multiline, SyntaxWriter writer) { + bool isVarargs = (bool)parameters.Current.Evaluate(apiIsVarargsExpression); while (parameters.MoveNext()) { XPathNavigator parameter = parameters.Current; @@ -815,9 +816,16 @@ namespace Microsoft.Ddue.Tools { writer.WriteString(" "); writer.WriteParameter(name); - if (parameters.CurrentPosition < parameters.Count) writer.WriteString(", "); + if (parameters.CurrentPosition < parameters.Count || isVarargs) writer.WriteString(", "); if (multiline) writer.WriteLine(); } + if (isVarargs) + { + if (multiline) writer.WriteString("\t"); + writer.WriteString("..."); + if (multiline) writer.WriteLine(); + } + } diff --git a/tools/Sandcastle/Source/BuildAssembler/SyntaxComponents/CSharpDeclarationSyntax.cs b/tools/Sandcastle/Source/BuildAssembler/SyntaxComponents/CSharpDeclarationSyntax.cs index 3b5922d..26ddcb3 100644 --- a/tools/Sandcastle/Source/BuildAssembler/SyntaxComponents/CSharpDeclarationSyntax.cs +++ b/tools/Sandcastle/Source/BuildAssembler/SyntaxComponents/CSharpDeclarationSyntax.cs @@ -153,6 +153,7 @@ namespace Microsoft.Ddue.Tools { // normal method: done public override void WriteNormalMethodSyntax (XPathNavigator reflection, SyntaxWriter writer) { + if (IsUnsupportedVarargs(reflection, writer)) return; string name = (string) reflection.Evaluate(apiNameExpression); @@ -185,91 +186,100 @@ namespace Microsoft.Ddue.Tools { public override void WriteOperatorSyntax (XPathNavigator reflection, SyntaxWriter writer) { string name = (string) reflection.Evaluate(apiNameExpression); - string identifier; - switch (name) { - // unary math operators - case "UnaryPlus": - identifier = "+"; - break; - case "UnaryNegation": - identifier = "-"; - break; - case "Increment": - identifier = "++"; - break; - case "Decrement": - identifier = "--"; - break; - // unary logical operators - case "LogicalNot": - identifier = "!"; - break; - case "True": - identifier = "true"; - break; - case "False": - identifier = "false"; - break; - // binary comparison operators - case "Equality": - identifier = "=="; - break; - case "Inequality": - identifier = "!="; - break; - case "LessThan": - identifier = "<"; - break; - case "GreaterThan": - identifier = ">"; - break; - case "LessThanOrEqual": - identifier = "<="; - break; - case "GreaterThanOrEqual": - identifier = ">="; - break; - // binary math operators - case "Addition": - identifier = "+"; - break; - case "Subtraction": - identifier = "-"; - break; - case "Multiply": - identifier = "*"; - break; - case "Division": - identifier = "/"; - break; - case "Modulus": - identifier = "%"; - break; - // binary logical operators - case "BitwiseAnd": - identifier = "&"; - break; - case "BitwiseOr": - identifier = "|"; - break; - case "ExclusiveOr": - identifier = "^"; - break; - // bit-array operators - case "OnesComplement": - identifier = "~"; - break; - case "LeftShift": - identifier = "<<"; - break; - case "RightShift": - identifier = ">>"; - break; - // unrecognized operator - default: - identifier = null; - break; - } + string identifier = null; + bool evalulate = (bool)reflection.Evaluate(apiIsUdtReturnExpression); + + if (!(bool)reflection.Evaluate(apiIsUdtReturnExpression)) + { + switch (name) + { + // unary math operators + case "UnaryPlus": + identifier = "+"; + break; + case "UnaryNegation": + identifier = "-"; + break; + case "Increment": + identifier = "++"; + break; + case "Decrement": + identifier = "--"; + break; + // unary logical operators + case "LogicalNot": + identifier = "!"; + break; + case "True": + identifier = "true"; + break; + case "False": + identifier = "false"; + break; + // binary comparison operators + case "Equality": + identifier = "=="; + break; + case "Inequality": + identifier = "!="; + break; + case "LessThan": + identifier = "<"; + break; + case "GreaterThan": + identifier = ">"; + break; + case "LessThanOrEqual": + identifier = "<="; + break; + case "GreaterThanOrEqual": + identifier = ">="; + break; + // binary math operators + case "Addition": + identifier = "+"; + break; + case "Subtraction": + identifier = "-"; + break; + case "Multiply": + identifier = "*"; + break; + case "Division": + identifier = "/"; + break; + case "Modulus": + identifier = "%"; + break; + // binary logical operators + case "BitwiseAnd": + identifier = "&"; + break; + case "BitwiseOr": + identifier = "|"; + break; + case "ExclusiveOr": + identifier = "^"; + break; + // bit-array operators + case "OnesComplement": + identifier = "~"; + break; + case "LeftShift": + identifier = "<<"; + break; + case "RightShift": + identifier = ">>"; + break; + case "Assign": + identifier = "="; + break; + // unrecognized operator + default: + identifier = null; + break; + } + } if (identifier == null) { writer.WriteMessage("UnsupportedOperator_" + Language); } else { diff --git a/tools/Sandcastle/Source/BuildAssembler/SyntaxComponents/FSharpDeclarationSyntax.cs b/tools/Sandcastle/Source/BuildAssembler/SyntaxComponents/FSharpDeclarationSyntax.cs index 7f10807..5b173e9 100644 --- a/tools/Sandcastle/Source/BuildAssembler/SyntaxComponents/FSharpDeclarationSyntax.cs +++ b/tools/Sandcastle/Source/BuildAssembler/SyntaxComponents/FSharpDeclarationSyntax.cs @@ -111,6 +111,7 @@ namespace Microsoft.Ddue.Tools public override void WriteNormalMethodSyntax(XPathNavigator reflection, SyntaxWriter writer) { + if (IsUnsupportedVarargs(reflection, writer)) return; string name = (string)reflection.Evaluate(apiNameExpression); bool isOverride = (bool)reflection.Evaluate(apiIsOverrideExpression); @@ -164,94 +165,100 @@ namespace Microsoft.Ddue.Tools public override void WriteOperatorSyntax(XPathNavigator reflection, SyntaxWriter writer) { string name = (string)reflection.Evaluate(apiNameExpression); - string identifier; + string identifier = null; bool isStatic = (bool)reflection.Evaluate(apiIsStaticExpression); - switch (name) + if (!(bool)reflection.Evaluate(apiIsUdtReturnExpression)) { - // unary math operators - case "UnaryPlus": - identifier = "+"; - break; - case "UnaryNegation": - identifier = "-"; - break; - case "Increment": - identifier = "++"; - break; - case "Decrement": - identifier = "--"; - break; - // unary logical operators - case "LogicalNot": - identifier = "not"; - break; - case "True": - identifier = "true"; - break; - case "False": - identifier = "false"; - break; - // binary comparison operators - case "Equality": - identifier = "="; - break; - case "Inequality": - identifier = "<>"; - break; - case "LessThan": - identifier = "<"; - break; - case "GreaterThan": - identifier = ">"; - break; - case "LessThanOrEqual": - identifier = "<="; - break; - case "GreaterThanOrEqual": - identifier = ">="; - break; - // binary math operators - case "Addition": - identifier = "+"; - break; - case "Subtraction": - identifier = "-"; - break; - case "Multiply": - identifier = "*"; - break; - case "Division": - identifier = "/"; - break; - case "Modulus": - identifier = "%"; - break; - // binary logical operators - case "BitwiseAnd": - identifier = "&&&"; - break; - case "BitwiseOr": - identifier = "|||"; - break; - case "ExclusiveOr": - identifier = "^^^"; - break; - // bit-array operators - case "OnesComplement": - identifier = null; // No F# equiv. - break; - case "LeftShift": - identifier = "<<<"; - break; - case "RightShift": - identifier = ">>>"; - break; - // unrecognized operator - default: - identifier = null; - break; + switch (name) + { + // unary math operators + case "UnaryPlus": + identifier = "+"; + break; + case "UnaryNegation": + identifier = "-"; + break; + case "Increment": + identifier = "++"; + break; + case "Decrement": + identifier = "--"; + break; + // unary logical operators + case "LogicalNot": + identifier = "not"; + break; + case "True": + identifier = "true"; + break; + case "False": + identifier = "false"; + break; + // binary comparison operators + case "Equality": + identifier = "="; + break; + case "Inequality": + identifier = "<>"; + break; + case "LessThan": + identifier = "<"; + break; + case "GreaterThan": + identifier = ">"; + break; + case "LessThanOrEqual": + identifier = "<="; + break; + case "GreaterThanOrEqual": + identifier = ">="; + break; + // binary math operators + case "Addition": + identifier = "+"; + break; + case "Subtraction": + identifier = "-"; + break; + case "Multiply": + identifier = "*"; + break; + case "Division": + identifier = "/"; + break; + case "Modulus": + identifier = "%"; + break; + // binary logical operators + case "BitwiseAnd": + identifier = "&&&"; + break; + case "BitwiseOr": + identifier = "|||"; + break; + case "ExclusiveOr": + identifier = "^^^"; + break; + // bit-array operators + case "OnesComplement": + identifier = null; // No F# equiv. + break; + case "LeftShift": + identifier = "<<<"; + break; + case "RightShift": + identifier = ">>>"; + break; + case "Assign": + identifier = "="; + break; + // unrecognized operator + default: + identifier = null; + break; + } } if (identifier == null) { diff --git a/tools/Sandcastle/Source/BuildAssembler/SyntaxComponents/GlobalSuppressions.cs b/tools/Sandcastle/Source/BuildAssembler/SyntaxComponents/GlobalSuppressions.cs index e8a0676..0bf635c 100644 --- a/tools/Sandcastle/Source/BuildAssembler/SyntaxComponents/GlobalSuppressions.cs +++ b/tools/Sandcastle/Source/BuildAssembler/SyntaxComponents/GlobalSuppressions.cs @@ -299,3 +299,9 @@ [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Microsoft.Ddue.Tools.VisualBasicUsageSyntaxGenerator.#WriteGenericTemplates(System.Xml.XPath.XPathNavigator,Microsoft.Ddue.Tools.SyntaxWriter)")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member", Target = "Microsoft.Ddue.Tools.VisualBasicUsageSyntaxGenerator.#WriteGenericTemplates(System.Xml.XPath.XPathNavigator,Microsoft.Ddue.Tools.SyntaxWriter,System.Boolean)")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member", Target = "Microsoft.Ddue.Tools.JScriptDeclarationSyntaxGenerator.#WriteVisibility(System.String,Microsoft.Ddue.Tools.SyntaxWriter)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1804:RemoveUnusedLocals", MessageId = "evalulate", Scope = "member", Target = "Microsoft.Ddue.Tools.CSharpDeclarationSyntaxGenerator.#WriteOperatorSyntax(System.Xml.XPath.XPathNavigator,Microsoft.Ddue.Tools.SyntaxWriter)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Microsoft.Ddue.Tools.SyntaxGeneratorTemplate.#apiIsUdtReturnExpression")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Varargs", Scope = "member", Target = "Microsoft.Ddue.Tools.SyntaxGeneratorTemplate.#apiIsVarargsExpression")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Microsoft.Ddue.Tools.SyntaxGeneratorTemplate.#apiIsVarargsExpression")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Varargs", Scope = "member", Target = "Microsoft.Ddue.Tools.SyntaxGeneratorTemplate.#IsUnsupportedVarargs(System.Xml.XPath.XPathNavigator,Microsoft.Ddue.Tools.SyntaxWriter)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1307:SpecifyStringComparison", MessageId = "System.String.StartsWith(System.String)", Scope = "member", Target = "Microsoft.Ddue.Tools.SyntaxGeneratorTemplate.#WriteMethodSyntax(System.Xml.XPath.XPathNavigator,Microsoft.Ddue.Tools.SyntaxWriter)")] diff --git a/tools/Sandcastle/Source/BuildAssembler/SyntaxComponents/JScriptDeclarationSyntax.cs b/tools/Sandcastle/Source/BuildAssembler/SyntaxComponents/JScriptDeclarationSyntax.cs index 27ac11d..35c1cc6 100644 --- a/tools/Sandcastle/Source/BuildAssembler/SyntaxComponents/JScriptDeclarationSyntax.cs +++ b/tools/Sandcastle/Source/BuildAssembler/SyntaxComponents/JScriptDeclarationSyntax.cs @@ -101,6 +101,7 @@ namespace Microsoft.Ddue.Tools { if (IsUnsupportedUnsafe(reflection, writer)) return; if (IsUnsupportedGeneric(reflection, writer)) return; if (IsUnsupportedExplicit(reflection, writer)) return; + if (IsUnsupportedVarargs(reflection, writer)) return; string name = (string)reflection.Evaluate(apiNameExpression); XPathNavigator returnType = reflection.SelectSingleNode(apiReturnTypeExpression); diff --git a/tools/Sandcastle/Source/BuildAssembler/SyntaxComponents/Properties/AssemblyInfo.cs b/tools/Sandcastle/Source/BuildAssembler/SyntaxComponents/Properties/AssemblyInfo.cs index b425318..b1dfc12 100644 --- a/tools/Sandcastle/Source/BuildAssembler/SyntaxComponents/Properties/AssemblyInfo.cs +++ b/tools/Sandcastle/Source/BuildAssembler/SyntaxComponents/Properties/AssemblyInfo.cs @@ -38,5 +38,5 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("2.5.10626.00")] -[assembly: AssemblyFileVersion("2.5.10626.00")] +[assembly: AssemblyVersion("2.6.10621.1")] +[assembly: AssemblyFileVersion("2.6.10621.1")] diff --git a/tools/Sandcastle/Source/BuildAssembler/SyntaxComponents/SyntaxGenerators.cs b/tools/Sandcastle/Source/BuildAssembler/SyntaxComponents/SyntaxGenerators.cs index 8f9f2c9..30255dd 100644 --- a/tools/Sandcastle/Source/BuildAssembler/SyntaxComponents/SyntaxGenerators.cs +++ b/tools/Sandcastle/Source/BuildAssembler/SyntaxComponents/SyntaxGenerators.cs @@ -88,6 +88,7 @@ namespace Microsoft.Ddue.Tools { protected static XPathExpression apiIsAbstractProcedureExpression = XPathExpression.Compile("boolean(proceduredata[@abstract='true'])"); protected static XPathExpression apiIsVirtualExpression = XPathExpression.Compile("boolean(proceduredata[@virtual='true'])"); protected static XPathExpression apiIsFinalExpression = XPathExpression.Compile("boolean(proceduredata[@final='true'])"); + protected static XPathExpression apiIsVarargsExpression = XPathExpression.Compile("boolean(proceduredata[@varargs='true'])"); protected static XPathExpression apiOverridesMemberExpression = XPathExpression.Compile("string(proceduredata/@overrides/member)"); protected static XPathExpression apiIsExplicitImplementationExpression = XPathExpression.Compile("boolean(memberdata/@visibility='private' and proceduredata/@virtual='true' and boolean(implements/member))"); protected static XPathExpression apiImplementedMembersExpression = XPathExpression.Compile("implements/member"); @@ -98,6 +99,8 @@ namespace Microsoft.Ddue.Tools { protected static XPathExpression apiIsWritePropertyExpression = XPathExpression.Compile("boolean(propertydata/@set='true')"); protected static XPathExpression apiGetVisibilityExpression = XPathExpression.Compile("string(propertydata/@get-visibility)"); protected static XPathExpression apiSetVisibilityExpression = XPathExpression.Compile("string(propertydata/@set-visibility)"); + // return data + protected static XPathExpression apiIsUdtReturnExpression = XPathExpression.Compile("boolean(returns/type[@api='T:System.Void']/requiredModifier/type[@api='T:System.Runtime.CompilerServices.IsUdtReturn'])"); // event data protected static XPathExpression apiHandlerOfEventExpression = XPathExpression.Compile("eventhandler/*[1]"); @@ -262,6 +265,11 @@ namespace Microsoft.Ddue.Tools { WriteOperatorSyntax(reflection, writer); } } + // Write out let properties (no .Net equivalent) as methods + if(name.StartsWith("let_")) + { + WriteNormalMethodSyntax(reflection, writer); + } } else { WriteNormalMethodSyntax(reflection, writer); } @@ -309,6 +317,16 @@ namespace Microsoft.Ddue.Tools { } } + protected virtual bool IsUnsupportedVarargs(XPathNavigator reflection, SyntaxWriter writer) + { + bool isVarargs = (bool) reflection.Evaluate(apiIsVarargsExpression); + + if(isVarargs) + writer.WriteMessage("UnsupportedVarargs_" + Language); + + return (isVarargs); + } + protected virtual bool IsUnsupportedUnsafe(XPathNavigator reflection, SyntaxWriter writer) { bool isUnsafe = (bool) reflection.Evaluate(apiIsUnsafeExpression); diff --git a/tools/Sandcastle/Source/BuildAssembler/SyntaxComponents/VisualBasicDeclarationSyntax.cs b/tools/Sandcastle/Source/BuildAssembler/SyntaxComponents/VisualBasicDeclarationSyntax.cs index e90ab1a..959aa14 100644 --- a/tools/Sandcastle/Source/BuildAssembler/SyntaxComponents/VisualBasicDeclarationSyntax.cs +++ b/tools/Sandcastle/Source/BuildAssembler/SyntaxComponents/VisualBasicDeclarationSyntax.cs @@ -161,6 +161,7 @@ namespace Microsoft.Ddue.Tools { public override void WriteNormalMethodSyntax (XPathNavigator reflection, SyntaxWriter writer) { + if (IsUnsupportedVarargs(reflection, writer)) return; string name = (string) reflection.Evaluate(apiNameExpression); XPathNavigator type = reflection.SelectSingleNode(apiReturnTypeExpression); @@ -211,106 +212,113 @@ namespace Microsoft.Ddue.Tools { string name = (string) reflection.Evaluate(apiNameExpression); XPathNavigator type = reflection.SelectSingleNode(apiReturnTypeExpression); - string identifier; - switch (name) { - // unary math operators - case "UnaryPlus": - identifier = "+"; - break; - case "UnaryNegation": - identifier = "-"; - break; - case "Increment": - identifier = "++"; - break; - case "Decrement": - identifier = "--"; - break; - // unary logical operators - case "LogicalNot": - identifier = "Not"; - break; - case "True": - identifier = "IsTrue"; - break; - case "False": - identifier = "IsFalse"; - break; - // binary comparison operators - case "Equality": - identifier = "="; - break; - case "Inequality": - identifier = "<>"; - break; - case "LessThan": - identifier = "<"; - break; - case "GreaterThan": - identifier = ">"; - break; - case "LessThanOrEqual": - identifier = "<="; - break; - case "GreaterThanOrEqual": - identifier = ">="; - break; - // binary math operators - case "Addition": - identifier = "+"; - break; - case "Subtraction": - identifier = "-"; - break; - case "Multiply": - identifier = "*"; - break; - case "Division": - identifier = "/"; - break; - case "Exponent": - identifier = "^"; - break; - case "Modulus": - identifier = "Mod"; - break; - case "IntegerDivision": - identifier = @"\"; - break; - // binary logical operators - case "BitwiseAnd": - identifier = "And"; - break; - case "BitwiseOr": - identifier = "Or"; - break; - case "ExclusiveOr": - identifier = "Xor"; - break; - // bit-array operators - case "OnesComplement": - identifier = "~"; - break; - case "LeftShift": - identifier = "<<"; - break; - case "RightShift": - identifier = ">>"; - break; - // concatenation - case "Concatenate": - identifier = "&"; - break; - // casting operators - case "Implicit": - case "Explicit": - identifier = "CType"; - break; - // didn't recognize an operator - default: - identifier = null; - break; - } + string identifier = null; + if (!(bool)reflection.Evaluate(apiIsUdtReturnExpression)) + { + switch (name) + { + // unary math operators + case "UnaryPlus": + identifier = "+"; + break; + case "UnaryNegation": + identifier = "-"; + break; + case "Increment": + identifier = "++"; + break; + case "Decrement": + identifier = "--"; + break; + // unary logical operators + case "LogicalNot": + identifier = "Not"; + break; + case "True": + identifier = "IsTrue"; + break; + case "False": + identifier = "IsFalse"; + break; + // binary comparison operators + case "Equality": + identifier = "="; + break; + case "Inequality": + identifier = "<>"; + break; + case "LessThan": + identifier = "<"; + break; + case "GreaterThan": + identifier = ">"; + break; + case "LessThanOrEqual": + identifier = "<="; + break; + case "GreaterThanOrEqual": + identifier = ">="; + break; + // binary math operators + case "Addition": + identifier = "+"; + break; + case "Subtraction": + identifier = "-"; + break; + case "Multiply": + identifier = "*"; + break; + case "Division": + identifier = "/"; + break; + case "Exponent": + identifier = "^"; + break; + case "Modulus": + identifier = "Mod"; + break; + case "IntegerDivision": + identifier = @"\"; + break; + // binary logical operators + case "BitwiseAnd": + identifier = "And"; + break; + case "BitwiseOr": + identifier = "Or"; + break; + case "ExclusiveOr": + identifier = "Xor"; + break; + // bit-array operators + case "OnesComplement": + identifier = "~"; + break; + case "LeftShift": + identifier = "<<"; + break; + case "RightShift": + identifier = ">>"; + break; + // concatenation + case "Concatenate": + identifier = "&"; + break; + // casting operators + case "Implicit": + case "Explicit": + identifier = "CType"; + break; + case "Assign": + identifier = "="; + break; + // didn't recognize an operator + default: + identifier = null; + break; + } + } if (identifier == null) { writer.WriteMessage("UnsupportedOperator_" + Language); return; diff --git a/tools/Sandcastle/Source/BuildAssembler/SyntaxComponents/VisualBasicUsageSyntax.cs b/tools/Sandcastle/Source/BuildAssembler/SyntaxComponents/VisualBasicUsageSyntax.cs index a32faf2..702e627 100644 --- a/tools/Sandcastle/Source/BuildAssembler/SyntaxComponents/VisualBasicUsageSyntax.cs +++ b/tools/Sandcastle/Source/BuildAssembler/SyntaxComponents/VisualBasicUsageSyntax.cs @@ -249,6 +249,7 @@ namespace Microsoft.Ddue.Tools { public override void WriteMethodSyntax (XPathNavigator reflection, SyntaxWriter writer) { if (IsUnsupportedUnsafe(reflection, writer)) return; + if (IsUnsupportedVarargs(reflection, writer)) return; base.WriteMethodSyntax(reflection, writer); } @@ -353,131 +354,141 @@ namespace Microsoft.Ddue.Tools { XPathNavigator returnType = reflection.SelectSingleNode(apiReturnTypeExpression); // Determine operator identifier and type - string identifier; - int type; - switch (name) { - // unary math operators - case "UnaryPlus": - identifier = "+"; - type = -1; - break; - case "UnaryNegation": - identifier = "-"; - type = -1; - break; - case "Increment": - identifier = "++"; - type = +1; - break; - case "Decrement": - identifier = "--"; - type = +1; - break; - // unary logical operators - case "LogicalNot": - identifier = "Not"; - type = -1; - break; - case "True": - identifier = "IsTrue"; - type = -1; - break; - case "False": - identifier = "IsFalse"; - type = -1; - break; - // binary comparison operators - case "Equality": - identifier = "="; - type = 2; - break; - case "Inequality": - identifier = "<>"; - type = 2; - break; - case "LessThan": - identifier = "<"; - type = 2; - break; - case "GreaterThan": - identifier = ">"; - type = 2; - break; - case "LessThanOrEqual": - identifier = "<="; - type = 2; - break; - case "GreaterThanOrEqual": - identifier = ">="; - type = 2; - break; - // binary math operators - case "Addition": - identifier = "+"; - type = 2; - break; - case "Subtraction": - identifier = "-"; - type = 2; - break; - case "Multiply": - identifier = "*"; - type = 2; - break; - case "Division": - identifier = "/"; - type = 2; - break; - case "Exponent": - identifier = "^"; - type = 2; - break; - case "Modulus": - identifier = "Mod"; - type = 2; - break; - case "IntegerDivision": - identifier = @"\"; - type = 2; - break; - // binary logical operators - case "BitwiseAnd": - identifier = "And"; - type = 2; - break; - case "BitwiseOr": - identifier = "Or"; - type = 2; - break; - case "ExclusiveOr": - identifier = "Xor"; - type = 2; - break; - // bit-array operators - case "OnesComplement": - identifier = "~"; - type = -1; - break; - case "LeftShift": - identifier = "<<"; - type = 2; - break; - case "RightShift": - identifier = ">>"; - type = 2; - break; - // concatenation - case "Concatenate": - identifier = "&"; - type = 2; - break; - // didn't recognize an operator - default: - identifier = null; - type = 0; - break; - } + string identifier = null; + int type = 0; + if (!(bool)reflection.Evaluate(apiIsUdtReturnExpression)) + { + switch (name) + { + // unary math operators + case "UnaryPlus": + identifier = "+"; + type = -1; + break; + case "UnaryNegation": + identifier = "-"; + type = -1; + break; + case "Increment": + identifier = "++"; + type = +1; + break; + case "Decrement": + identifier = "--"; + type = +1; + break; + // unary logical operators + case "LogicalNot": + identifier = "Not"; + type = -1; + break; + case "True": + identifier = "IsTrue"; + type = -1; + break; + case "False": + identifier = "IsFalse"; + type = -1; + break; + // binary comparison operators + case "Equality": + identifier = "="; + type = 2; + break; + case "Inequality": + identifier = "<>"; + type = 2; + break; + case "LessThan": + identifier = "<"; + type = 2; + break; + case "GreaterThan": + identifier = ">"; + type = 2; + break; + case "LessThanOrEqual": + identifier = "<="; + type = 2; + break; + case "GreaterThanOrEqual": + identifier = ">="; + type = 2; + break; + // binary math operators + case "Addition": + identifier = "+"; + type = 2; + break; + case "Subtraction": + identifier = "-"; + type = 2; + break; + case "Multiply": + identifier = "*"; + type = 2; + break; + case "Division": + identifier = "/"; + type = 2; + break; + case "Exponent": + identifier = "^"; + type = 2; + break; + case "Modulus": + identifier = "Mod"; + type = 2; + break; + case "IntegerDivision": + identifier = @"\"; + type = 2; + break; + // binary logical operators + case "BitwiseAnd": + identifier = "And"; + type = 2; + break; + case "BitwiseOr": + identifier = "Or"; + type = 2; + break; + case "ExclusiveOr": + identifier = "Xor"; + type = 2; + break; + // bit-array operators + case "OnesComplement": + identifier = "~"; + type = -1; + break; + case "LeftShift": + identifier = "<<"; + type = 2; + break; + case "RightShift": + identifier = ">>"; + type = 2; + break; + // concatenation + case "Concatenate": + identifier = "&"; + type = 2; + break; + case "Assign": + identifier = "="; + type = 2; + break; + + + // didn't recognize an operator + default: + identifier = null; + type = 0; + break; + } + } if (identifier == null) { writer.WriteMessage("UnsupportedOperator_" + Language); } else { |