Beispiel #1
0
        public void SetMeta(MetaEntry meta)
        {
            if (meta == null)
            {
                return;
            }

            var index = meta.Name ?? meta.HttpEquiv ?? "charset";

            _metas[index] = meta;
        }
Beispiel #2
0
        public static MetaEntry Combine(MetaEntry meta1, MetaEntry meta2, string contentSeparator)
        {
            var newMeta = new MetaEntry();

            Merge(newMeta._builder.Attributes, meta1._builder.Attributes, meta2._builder.Attributes);
            if (!String.IsNullOrEmpty(meta1.Content) && !String.IsNullOrEmpty(meta2.Content))
            {
                newMeta.Content = meta1.Content + contentSeparator + meta2.Content;
            }
            return(newMeta);
        }
Beispiel #3
0
        public void AppendMeta(MetaEntry meta, string contentSeparator)
        {
            if (meta == null)
            {
                return;
            }

            var index = meta.Name ?? meta.HttpEquiv;

            if (String.IsNullOrEmpty(index))
            {
                return;
            }

            MetaEntry existingMeta;

            if (_metas.TryGetValue(index, out existingMeta))
            {
                meta = MetaEntry.Combine(existingMeta, meta, contentSeparator);
            }
            _metas[index] = meta;
        }