Beispiel #1
0
        /// <summary>
        /// Convert FB2 image item
        /// </summary>
        /// <param name="imageItem">item to convert</param>
        /// <param name="imageConverterParams"></param>
        /// <returns>XHTML representation</returns>
        public IHTMLItem Convert(ImageItem imageItem, ImageConverterParamsV3 imageConverterParams)
        {
            if (imageItem == null)
            {
                throw new ArgumentNullException("imageItem");
            }
            var image = new Image(HTMLElementType.HTML5);
            image.Alt.Value = imageItem.AltText ?? string.Empty;
            image.Source.Value = imageConverterParams.Settings.ReferencesManager.AddImageRefferenced(imageItem, image);

            image.GlobalAttributes.ID.Value = imageConverterParams.Settings.ReferencesManager.AddIdUsed(imageItem.ID, image);
            if (imageItem.Title != null)
            {
                image.GlobalAttributes.Title.Value = imageItem.Title;
            }
            imageConverterParams.Settings.Images.ImageIdUsed(imageItem.HRef);
            return image;
        }
Beispiel #2
0
        /// <summary>
        /// Convert FB2 image item
        /// </summary>
        /// <param name="imageItem">item to convert</param>
        /// <param name="imageConverterParams"></param>
        /// <returns>XHTML representation</returns>
        public IHTMLItem Convert(ImageItem imageItem, ImageConverterParamsV3 imageConverterParams)
        {
            if (imageItem == null)
            {
                throw new ArgumentNullException("imageItem");
            }
            var image = new Image(HTMLElementType.HTML5);

            image.Alt.Value    = imageItem.AltText ?? string.Empty;
            image.Source.Value = imageConverterParams.Settings.ReferencesManager.AddImageRefferenced(imageItem, image);

            image.GlobalAttributes.ID.Value = imageConverterParams.Settings.ReferencesManager.AddIdUsed(imageItem.ID, image);
            if (imageItem.Title != null)
            {
                image.GlobalAttributes.Title.Value = imageItem.Title;
            }
            imageConverterParams.Settings.Images.ImageIdUsed(imageItem.HRef);
            return(image);
        }