public override void Initialize(BuildContext context, ReferenceGroup group)
        {
            base.Initialize(context, group);

            _notApplicable = false;

            BuildGroupContext groupContext = context.GroupContexts[group.Id];
            if (groupContext != null)
            {
                // We do not have to spell check embedded documents...
                string embeddedText = groupContext["$IsEmbeddedGroup"];
                if (!String.IsNullOrEmpty(embeddedText) && 
                    embeddedText.Equals(Boolean.TrueString, StringComparison.OrdinalIgnoreCase))
                {
                    _notApplicable = true;
                    return;
                }
            }

            if (this.IsInitialized)
            {
                if (_spellChecking == null)
                {
                    ReferenceEngineSettings engineSettings = this.EngineSettings;

                    Debug.Assert(engineSettings != null);
                    if (engineSettings == null)
                    {
                        this.IsInitialized = false;
                        return;
                    }

                    _spellChecking = engineSettings.SpellChecking;
                    Debug.Assert(_spellChecking != null);
                    if (_spellChecking == null)
                    {
                        this.IsInitialized = false;
                        return;
                    }
                }

                _spellChecker = BuildSpellChecker.Default;
                if (_spellChecker != null)
                {
                    _spellChecker.Initialize(context);
                    if (!_spellChecker.IsInitialized)
                    {
                        this.IsInitialized = false;
                        return;
                    }
                }

                ICollection<string> configSkips = _spellChecking.SkipTags;
                if (configSkips != null && configSkips.Count != 0)
                {
                    _skipTags.UnionWith(configSkips);
                }
            }
        }
Exemple #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ReferenceSpellCheckConfiguration"/> class
 /// with parameters copied from the specified instance of the
 /// <see cref="ReferenceSpellCheckConfiguration"/> class, a copy constructor.
 /// </summary>
 /// <param name="source">
 /// An instance of the <see cref="ReferenceSpellCheckConfiguration"/> class from which the
 /// initialization parameters or values will be copied.
 /// </param>
 /// <exception cref="ArgumentNullException">
 /// If the parameter <paramref name="source"/> is <see langword="null"/>.
 /// </exception>
 public ReferenceSpellCheckConfiguration(ReferenceSpellCheckConfiguration source)
     : base(source)
 {
     _log           = source._log;
     _logXml        = source._logXml;
     _logFilePrefix = source._logFilePrefix;
     _skipTags      = source._skipTags;
     _spellChecker  = source._spellChecker;
 }
Exemple #3
0
        /// <summary>
        /// This creates a new build object that is a deep copy of the current
        /// instance.
        /// </summary>
        /// <returns>
        /// A new build object that is a deep copy of this instance.
        /// </returns>
        public override BuildConfiguration Clone()
        {
            ReferenceSpellCheckConfiguration options = new ReferenceSpellCheckConfiguration(this);

            if (_logFilePrefix != null)
            {
                options._logFilePrefix = String.Copy(_logFilePrefix);
            }
            if (_spellChecker != null)
            {
                options._spellChecker = String.Copy(_spellChecker);
            }
            if (_skipTags != null)
            {
                options._skipTags = new HashSet <string>(_skipTags);
            }

            return(options);
        }
        public ReferenceSpellCheckVisitor(ReferenceSpellCheckConfiguration configuration)
            : base(VisitorName, configuration)
        {
            _spellChecking = configuration;

            _targetTags = new HashSet<string>();
            _skipTags   = new HashSet<string>();

            _targetTags.Add("summary");
            _targetTags.Add("remarks");
            _targetTags.Add("param");
            _targetTags.Add("returns");
            _targetTags.Add("exception");
            _targetTags.Add("typeparam");

            _skipTags.Add("c");
            _skipTags.Add("see");
            _skipTags.Add("seealso");
            _skipTags.Add("code");
            _skipTags.Add("math");
            _skipTags.Add("image");
            _skipTags.Add("img");
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ReferenceEngineSettings"/> class
        /// with the default parameters.
        /// </summary>
        public ReferenceEngineSettings()
            : base("Sandcastle.References.ReferenceEngineSettings", BuildEngineType.Reference)
        {
            _webMvcSdkType                  = BuildSpecialSdkType.Null;
            _rootContainer                  = false;
            _embedScriptSharp               = true;
            _includeAllMembersTopic         = true;
            _includeInheritedOverloadTopics = true;
            _refNamer  = ReferenceNamer.Orcas;
            _refNaming = ReferenceNamingMethod.Guid;

            IBuildNamedList <BuildConfiguration> configurations = this.Configurations;

            if (configurations != null)
            {
                // For the ReferenceVisitors...
                ReferenceCommentConfiguration comments =
                    new ReferenceCommentConfiguration();

                ReferenceSpellCheckConfiguration spellCheck =
                    new ReferenceSpellCheckConfiguration();

                ReferenceVisibilityConfiguration documentVisibility =
                    new ReferenceVisibilityConfiguration();

                ReferenceXPathConfiguration pathDocumentVisibility =
                    new ReferenceXPathConfiguration();
                pathDocumentVisibility.Enabled = false;

                // For the ReferenceTocVistors...
                ReferenceTocExcludeConfiguration excludeToc =
                    new ReferenceTocExcludeConfiguration();
                ReferenceTocLayoutConfiguration layoutToc =
                    new ReferenceTocLayoutConfiguration();

                configurations.Add(comments);
                configurations.Add(documentVisibility);
                configurations.Add(pathDocumentVisibility);
                configurations.Add(spellCheck);

                configurations.Add(excludeToc);
                configurations.Add(layoutToc);
            }

            IBuildNamedList <BuildComponentConfiguration> componentConfigurations
                = this.ComponentConfigurations;

            if (componentConfigurations != null)
            {
                ReferencePreTransConfiguration preTrans =
                    new ReferencePreTransConfiguration();

                ReferenceMissingTagsConfiguration missingTags =
                    new ReferenceMissingTagsConfiguration();

                ReferenceAutoDocConfiguration autoDocument =
                    new ReferenceAutoDocConfiguration();

                ReferenceIntelliSenseConfiguration intelliSense =
                    new ReferenceIntelliSenseConfiguration();

                ReferencePlatformsConfiguration platforms =
                    new ReferencePlatformsConfiguration();

                ReferenceCloneConfiguration cloneDocument =
                    new ReferenceCloneConfiguration();

                ReferencePostTransConfiguration postTrans =
                    new ReferencePostTransConfiguration();

                ReferenceCodeConfiguration codeComponent =
                    new ReferenceCodeConfiguration();

                ReferenceMathConfiguration mathComponent =
                    new ReferenceMathConfiguration();

                ReferenceMediaConfiguration mediaComponent =
                    new ReferenceMediaConfiguration();

                ReferenceLinkConfiguration linkComponent =
                    new ReferenceLinkConfiguration();

                ReferenceSharedConfiguration sharedComponent =
                    new ReferenceSharedConfiguration();

                componentConfigurations.Add(preTrans);
                componentConfigurations.Add(autoDocument);
                componentConfigurations.Add(missingTags);
                componentConfigurations.Add(intelliSense);
                componentConfigurations.Add(platforms);
                componentConfigurations.Add(cloneDocument);
                componentConfigurations.Add(postTrans);
                componentConfigurations.Add(codeComponent);
                componentConfigurations.Add(mathComponent);
                componentConfigurations.Add(mediaComponent);
                componentConfigurations.Add(linkComponent);
                componentConfigurations.Add(sharedComponent);
            }
        }