public override ElementSyntaxBase With( NameToken name = null, IImmutableList <AttributeSyntaxBase> attributes = null, IImmutableList <NodeSyntax> nodes = null, bool?isEmpty = null) { name = name ?? Name; nodes = nodes ?? Nodes; attributes = attributes ?? Attributes; if ((isEmpty ?? false) && nodes.Count == 0) { return(EmptyElementSyntax.Create( StartTag.LessThan, Name, attributes, SlashToken.Default, EndTag.GreaterThan)); } if (name.Equals(Name) && (attributes.Equals(Attributes) || attributes.SequenceEqual(Attributes)) && (nodes.Equals(Nodes) || nodes.SequenceEqual(Nodes))) { return(this); } return(Create( StartTag.With(name, attributes), nodes, EndTag.With(EndTag.Name.With(name.Text)))); }
public override string DoFormating(string vhod) { string startTagStart = "[" + Name + "="; string endTag = String.Format(endF, Name); int start = vhod.Length; while ((start = vhod.IndexOf(startTagStart)) >= 0) { int startTagLength = vhod.Substring(start).IndexOf(']') + 1; int parameterLength = startTagLength - 1 - startTagStart.Length; int parameterStart = start + startTagStart.Length; string parameter = vhod.Substring(parameterStart, parameterLength); int end = vhod.IndexOf(endTag); if (end > vhod.Length) { throw new Exception("No closing tag for " + startTagStart); } int valueStart = start + startTagLength; int valueEnd = end - valueStart; int elementStart = start; int elementEnd = end + endTag.Length; string content = vhod.Substring(valueStart, valueEnd); Dictionary <string, string> parametri = new Dictionary <string, string>(); parametri.Add("parameter", parameter); parametri.Add("value", content); vhod = vhod.Substring(0, elementStart) + StartTag.Braces().NamedFormat(parametri) + EndTag.Braces().NamedFormat(parametri) + vhod.Substring(elementEnd); } return(vhod); }
/// <summary> /// Constructs and initializes a new instance of <see /// cref="Tag" /> for a specified <see cref="TagLib.File" />. /// </summary> /// <param name="file"> /// A <see cref="TagLib.File" /> object on which the new /// instance will perform its operations. /// </param> /// <remarks> /// Constructing a new instance does not automatically read /// the contents from the disk. <see cref="Read" /> must be /// called to read the tags. /// </remarks> public Tag (File file) : base () { start_tag = new StartTag (file); end_tag = new EndTag (file); AddTag (start_tag); AddTag (end_tag); }
public override string DoFormating(string vhod) { string startTag = String.Format(startF, Name); string endTag = String.Format(endF, Name); int start = vhod.Length; while ((start = vhod.IndexOf(startTag)) >= 0) { int end = vhod.IndexOf(endTag); if (end > vhod.Length) { throw new Exception("No closing tag for " + startTag); } int valueStart = start + startTag.Length; int valueEnd = end - valueStart; int elementStart = start; int elementEnd = end + endTag.Length; string content = vhod.Substring(valueStart, valueEnd); vhod = vhod.Substring(0, elementStart) + StartTag.Replace("$value", content).Braces() + EndTag.Replace("$value", content).Braces() + vhod.Substring(elementEnd); } return(vhod); }
/// <summary> /// Gets a tag of a specified type from the current instance, /// optionally creating a new tag if possible. /// </summary> /// <param name="type"> /// A <see cref="TagLib.TagTypes" /> value indicating the /// type of tag to read. /// </param> /// <param name="create"> /// A <see cref="bool" /> value specifying whether or not to /// try and create the tag if one is not found. /// </param> /// <returns> /// A <see cref="Tag" /> object containing the tag that was /// found in or added to the current instance. If no /// matching tag was found and none was created, <see /// langword="null" /> is returned. /// </returns> /// <remarks> /// If a <see cref="TagLib.Id3v2.Tag" /> is added to the /// current instance, it will be placed at the start of the /// file. On the other hand, <see cref="TagLib.Id3v1.Tag" /> /// <see cref="TagLib.Ape.Tag" /> will be added to the end of /// the file. All other tag types will be ignored. /// </remarks> public override TagLib.Tag GetTag(TagTypes type, bool create) { TagLib.Tag t = (Tag as TagLib.NonContainer.Tag) .GetTag(type); if (t != null || !create) { return(t); } switch (type) { case TagTypes.Id3v1: return(EndTag.AddTag(type, Tag)); case TagTypes.Id3v2: return(StartTag.AddTag(type, Tag)); case TagTypes.Ape: return(EndTag.AddTag(type, Tag)); default: return(null); } }
public void TestForEach() { string str = @"@foreach(var item in Items) { <RenderItem Item='@item' /> }"; List <Line> lines = Tokenizer.Parse(str); Assert.AreEqual(3, lines.Count); Assert.AreEqual(TokenType.CSBlockStart, lines[0].Tokens[0].TokenType); Assert.AreEqual("foreach(var item in Items) {", ((Text)lines[0].Tokens[1]).Content.Trim()); Assert.AreEqual(TokenType.StartTag, lines[1].Tokens[1].TokenType); StartTag startTag = (StartTag)lines[1].Tokens[1]; Assert.AreEqual(true, startTag.IsSelfClosingTag); Assert.AreEqual("RenderItem", startTag.Name); Assert.AreEqual(1, startTag.Attributes.Count); Assert.AreEqual(LineType.SingleLine, startTag.LineType); Assert.AreEqual("Item", ((AttributeToken)startTag.Attributes[0]).Name); Assert.AreEqual(true, ((AttributeToken)startTag.Attributes[0]).Value.IsCSStatement); Assert.AreEqual(false, ((AttributeToken)startTag.Attributes[0]).Value.HasParentheses); Assert.AreEqual("item", ((AttributeToken)startTag.Attributes[0]).Value.Content); Assert.AreEqual(TokenType.CSBlockEnd, lines[2].Tokens[0].TokenType); }
public virtual string DoFormating(string vhod) { return (vhod .Replace(String.Format(startF, Name), StartTag.Braces()) .Replace(String.Format(endF, Name), EndTag.Braces())); }
private void BuildRenderStartTag(RenderTreeBuilder builder, StartTag startTag) { if (startTag.LineType == LineType.SingleLine || startTag.LineType == LineType.MultiLineStart) { builder.OpenElement(Next(), "span"); builder.AddAttribute(Next(), "class", _themeTagSymbolsClass); builder.AddContent(Next(), "<"); builder.CloseElement(); builder.OpenElement(Next(), "span"); builder.AddAttribute(Next(), "class", _themeTagNameClass); builder.AddContent(Next(), startTag.Name); builder.CloseElement(); } BuildRenderAttributes(builder, startTag.Attributes); if (startTag.LineType == LineType.SingleLine || startTag.LineType == LineType.MultiLineEnd) { builder.OpenElement(Next(), "span"); builder.AddAttribute(Next(), "class", _themeTagSymbolsClass); if (startTag.IsSelfClosingTag && !startTag.IsGeneric) { string spacer = (startTag.LineType == LineType.MultiLineEnd && startTag.Attributes.Count == 0) ? string.Empty : " "; builder.AddContent(Next(), spacer + "/"); } builder.AddContent(Next(), ">"); builder.CloseElement(); } }
/// <summary> /// Gets a tag of a specified type from the current instance, /// optionally creating a new tag if possible. /// </summary> /// <param name="type"> /// A <see cref="TagLib.TagTypes" /> value indicating the /// type of tag to read. /// </param> /// <param name="create"> /// A <see cref="bool" /> value specifying whether or not to /// try and create the tag if one is not found. /// </param> /// <returns> /// A <see cref="Tag" /> object containing the tag that was /// found in or added to the current instance. If no /// matching tag was found and none was created, <see /// langword="null" /> is returned. /// </returns> public override TagLib.Tag GetTag(TagTypes type, bool create) { switch (type) { case TagTypes.Xiph: return(metadata.GetComment(create, tag)); case TagTypes.FlacMetadata: return(metadata); } Tag t = (base.Tag as TagLib.NonContainer.Tag).GetTag(type); if (t != null || !create) { return(t); } switch (type) { case TagTypes.Id3v1: return(EndTag.AddTag(type, Tag)); case TagTypes.Id3v2: return(StartTag.AddTag(type, Tag)); case TagTypes.Ape: return(EndTag.AddTag(type, Tag)); default: return(null); } }
/// <inheritdoc/> public override int GetHashCode() { unchecked { return((StartTag.GetHashCode() * 397) ^ EndTag.GetHashCode()); } }
/// <summary> /// Determines if element contains given position /// </summary> /// <param name="position">Position in a text buffer</param> public override bool Contains(int position) { if (base.Contains(position)) { return(true); } if (StartTag.Contains(position)) { return(true); } if (EndTag != null) { if (EndTag.Contains(position)) { return(true); } } else { if (position == VirtualEnd && !IsShorthand() && !IsSelfClosing()) { return(true); } } return(false); }
public void Reflow(DrawContext dc, BoundingContext bounds, bool incremental) { reflowCompleted = true; // TODO: L: do something with item metrics? ItemMetrics im; startTag = new StartTag(this, elementNode); startTag.Compose(dc, style, out im); endTag = new EndTag(this, elementNode); endTag.Compose(dc, style, out im); ParentTable.InitRow(dc, startTag, endTag, bounds); cells.Clear(); foreach (XmlNode n in elementNode.ChildNodes) { XmlElement e = n as XmlElement; if (e == null) { continue; } Table.CellInfo ci = ParentTable[e]; TableCell c = ci.Cell; cells.Add(c); BoundingContext newBounds = new BoundingContext(bounds, ci.Column.Width); c.Parent = this; c.Reflow(dc, newBounds, false); ParentTable.Update(c); } RecalcBounds(); }
public void AddCssProperties(CssProperties properties) { if (StartTag != "") { StartTag = StartTag.Insert(StartTag.Length - 1, properties.AllCssProperiesToString()); } }
public void AddHref(string href, string basicUri) { if (IsRelativePath(href)) { href = basicUri + href; } href = $" href=\"{href}\""; StartTag = StartTag.Insert(StartTag.Length - 1, href); }
public override void Write(TextWriter writer) { StartTag.Write(writer); foreach (var node in Nodes) { node.Write(writer); } EndTag.Write(writer); }
public override void Save() { Mode = AccessMode.Write; try { long metadata_start = StartTag.Write(); long metadata_end; IList <Block> old_blocks = ReadBlocks(ref metadata_start, out metadata_end, BlockMode.Blacklist, BlockType.XiphComment, BlockType.Picture); GetTag(TagTypes.Xiph, true); List <Block> new_blocks = new List <Block>(); new_blocks.Add(old_blocks[0]); foreach (Block block in old_blocks) { if (block.Type != BlockType.StreamInfo && block.Type != BlockType.XiphComment && block.Type != BlockType.Picture && block.Type != BlockType.Padding) { new_blocks.Add(block); } } new_blocks.Add(new Block(BlockType.XiphComment, (GetTag(TagTypes.Xiph, true) as Ogg.XiphComment).Render(false))); foreach (IPicture picture in metadata.Pictures) { if (picture == null) { continue; } new_blocks.Add(new Block(BlockType.Picture, new Picture(picture).Render())); } long length = 0; foreach (Block block in new_blocks) { length += block.TotalSize; } long padding_size = metadata_end - metadata_start - BlockHeader.Size - length; if (padding_size < 0) { padding_size = 1024 * 4; } if (padding_size != 0) { new_blocks.Add(new Block(BlockType.Padding, new ByteVector((int)padding_size))); } ByteVector block_data = new ByteVector(); for (int i = 0; i < new_blocks.Count; i++) { block_data.Add(new_blocks[i].Render(i == new_blocks.Count - 1)); } Insert(block_data, metadata_start, metadata_end - metadata_start); EndTag.Write(); TagTypesOnDisk = TagTypes; } finally { Mode = AccessMode.Closed; } }
public ParsedElement(CharEnumerator charEnumerator) { StartTag = GetTag(charEnumerator); if (StartTag.Equals("<hr>", StringComparison.InvariantCultureIgnoreCase)) { return; } Children = GetChildren(charEnumerator); EndTag = GetTag(charEnumerator); }
public override void Reflow(DrawContext dc, BoundingContext bounds, bool incremental) { ReflowStart(dc); if (incremental) { bounds = bounds.Narrow(style.Left, style.Right); } MarkupItem tag = new StartTag(CurrentLine, ElementNode); ReflowMarkup(tag, dc, style, bounds); ImageStyle s = style as ImageStyle; if (s == null) { throw new InvalidOperationException("Expected style for image to be Custom"); } string imgPath = ElementNode.GetAttribute(s.SourceAttribute); if (imgPath == null) { throw new InvalidOperationException("SourceAttribute for image is missing"); } // think about relative to doc Bitmap bm; Uri docUri = new Uri(elementNode.BaseURI); Uri uri = new Uri(docUri, imgPath); if (uri.IsFile && File.Exists(uri.AbsolutePath)) { bm = new Bitmap(uri.AbsolutePath); } else { bm = ErrorBitmap; } ImageLineItem ili = new ImageLineItem(CurrentLine, ElementNode, bm); ReflowMarkup(ili, dc, style, bounds); tag = new EndTag(CurrentLine, ElementNode); ReflowMarkup(tag, dc, style, bounds); ReflowEnd(dc); }
public void TestMultiLineTag() { string str = @"<div class='test' />"; List <Line> lines = Tokenizer.Parse(str); Assert.AreEqual(3, lines.Count); List <IToken> lineTokens = lines[0].Tokens; Assert.AreEqual(1, lineTokens.Count); Assert.AreEqual(TokenType.StartTag, lineTokens[0].TokenType); StartTag startTag = (StartTag)lineTokens[0]; Assert.AreEqual("div", startTag.Name); Assert.AreEqual(true, startTag.IsSelfClosingTag); Assert.AreEqual(LineType.MultiLineStart, startTag.LineType); Assert.AreEqual(0, startTag.Attributes.Count); lineTokens = lines[1].Tokens; Assert.AreEqual(1, lineTokens.Count); Assert.AreEqual(TokenType.StartTag, lineTokens[0].TokenType); startTag = (StartTag)lineTokens[0]; Assert.AreEqual("div", startTag.Name); Assert.AreEqual(true, startTag.IsSelfClosingTag); Assert.AreEqual(LineType.MultiLine, startTag.LineType); Assert.AreEqual(2, startTag.Attributes.Count); List <IToken> attributes = startTag.Attributes; Assert.AreEqual(TokenType.Text, attributes[0].TokenType); Assert.AreEqual(TokenType.Attribute, attributes[1].TokenType); AttributeToken attribute = (AttributeToken)attributes[1]; Assert.AreEqual("class", attribute.Name); Assert.AreEqual("test", attribute.Value.Content); lineTokens = lines[2].Tokens; Assert.AreEqual(1, lineTokens.Count); Assert.AreEqual(TokenType.StartTag, lineTokens[0].TokenType); startTag = (StartTag)lineTokens[0]; Assert.AreEqual("div", startTag.Name); Assert.AreEqual(true, startTag.IsSelfClosingTag); Assert.AreEqual(LineType.MultiLineEnd, startTag.LineType); Assert.AreEqual(0, startTag.Attributes.Count); }
/// <inheritdoc/> public override int GetHashCode() { unchecked { var hash = 27; hash = (13 * hash) + StartTag.GetHashCode(); hash = (13 * hash) + EndTag.GetHashCode(); hash = (13 * hash) + TagStartPosition.GetHashCode(); hash = (13 * hash) + TagEndPosition.GetHashCode(); hash = (13 * hash) + ContentStartPosition.GetHashCode(); hash = (13 * hash) + ContentEndPosition.GetHashCode(); hash = (13 * hash) + Content.GetHashCode(); hash = (13 * hash) + IsClosed.GetHashCode(); return(hash); } }
public void NewRazorFeaturesInPreview6() { string str = @"@page '/' @namespace MyNamespace @attribute [Authorize] <div @key='key' @onclick='@Clicked' @bind='myValue' @directive @directive='value' @directive:key @directive:key='value' @directive-suffix @directive-suffix='value' @directive-suffix:key @directive-suffix:key='value' /> @code { public void Clicked() { //Comments arent supported yet } } "; List <Line> lines = Tokenizer.Parse(str); Assert.AreEqual(15, lines.Count); Assert.AreEqual(TokenType.CSLine, lines[1].Tokens[0].TokenType); Assert.AreEqual(CSLineType.Namespace, ((CSLine)lines[1].Tokens[0]).LineType); Assert.AreEqual(TokenType.CSLine, lines[2].Tokens[0].TokenType); Assert.AreEqual(CSLineType.Attribute, ((CSLine)lines[2].Tokens[0]).LineType); Assert.AreEqual(TokenType.StartTag, lines[4].Tokens[0].TokenType); StartTag startTag = (StartTag)lines[4].Tokens[0]; Assert.AreEqual(TokenType.Attribute, startTag.Attributes[0].TokenType); AttributeToken attribute = (AttributeToken)startTag.Attributes[0]; Assert.AreEqual("@key", attribute.Name); Assert.AreEqual(TokenType.QuotedString, attribute.Value.TokenType); Assert.AreEqual("key", attribute.Value.Content); attribute = (AttributeToken)startTag.Attributes[1]; Assert.AreEqual("@onclick", attribute.Name); Assert.AreEqual("Clicked", attribute.Value.Content); Assert.AreEqual(true, attribute.Value.IsCSStatement); Assert.AreEqual(TokenType.CSBlockStart, lines[8].Tokens[0].TokenType); Assert.AreEqual(true, ((CSBlockStart)lines[8].Tokens[0]).IsCode); }
internal override void CreateNewComment() { var literalText = CreateParameterTextString(); var textToken = new LiteralTextToken(literalText); var paramTextNode = new TextNode(""); paramTextNode.AddToken(textToken); var startTag = new StartTag("param"); var nameAttribute = new Attribute("name", ParamName); startTag.Attribute = nameAttribute; var endTag = new EndTag("param"); var exampleElementNode = new ExampleElementNode(DocCommentExterior); exampleElementNode.AddNode(paramTextNode); exampleElementNode.StartTag = startTag; exampleElementNode.EndTag = endTag; AddNode(exampleElementNode); }
public override string DoFormating(string vhod) { string sts = "[" + Name; int stsIndex = -1; string endTag = String.Format(endF, Name); while ((stsIndex = vhod.IndexOf(sts)) >= 0) { string formatedPart = vhod.Substring(0, stsIndex); string unformatedPart = vhod.Substring(stsIndex); int steIndex = unformatedPart.IndexOf("]"); int endTagIndex = unformatedPart.IndexOf(endTag); string paramString = unformatedPart.Substring(sts.Length, steIndex - sts.Length - 1); if (String.IsNullOrEmpty(paramString)) { throw new Exception("Ni parametrov"); } Dictionary <string, string> parametri = new Dictionary <string, string>(); foreach (string kvp in paramString.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)) { string[] parameter = kvp.Split('='); if (parameter.Length < 2) { throw new Exception("Invalid parameter format: " + kvp); } if (parameter[0].CompareTo("content") == 0) { throw new Exception("'content' can not be used as a parameter!"); } parametri.Add(parameter[0], parameter[1]); } parametri.Add("content", unformatedPart.Substring(steIndex + 1, endTagIndex - steIndex - 1)); string newEnd = EndTag.Braces(); vhod = formatedPart + StartTag.Braces().NamedFormat(parametri) + EndTag.Braces().NamedFormat(parametri) + unformatedPart.Substring(endTagIndex + endTag.Length); } return(vhod); }
/// <summary>Shifts node start, end and all child elements by the specified offset.</summary> public override void Shift(int offset) { StartTag.Shift(offset); if (EndTag != null) { EndTag.Shift(offset); } if (OrphanedEndTagsCollection != null) { OrphanedEndTagsCollection.Shift(offset); } VirtualEnd += offset; for (int i = 0; i < Children.Count; i++) { Children[i].Shift(offset); } }
public void TestVariable() { List <Line> lines = Tokenizer.Parse("This is an <b name='@testname' /> test"); Assert.AreEqual(1, lines.Count); List <IToken> lineTokens = lines[0].Tokens; Assert.AreEqual(3, lineTokens.Count); Assert.AreEqual(TokenType.StartTag, lineTokens[1].TokenType); StartTag startTag = (StartTag)lineTokens[1]; Assert.AreEqual("b", startTag.Name); Assert.AreEqual(1, startTag.Attributes.Count); Assert.AreEqual(TokenType.Attribute, startTag.Attributes[0].TokenType); AttributeToken attribute = (AttributeToken)startTag.Attributes[0]; Assert.AreEqual("name", attribute.Name); Assert.AreEqual(true, attribute.Value.IsCSStatement); Assert.AreEqual(false, attribute.Value.HasParentheses); Assert.AreEqual("testname", attribute.Value.Content); }
public void TestStatement() { List <Line> lines = Tokenizer.Parse("This is an <div onclick='@(() => onclick(\"hello\"))' /> test"); Assert.AreEqual(1, lines.Count); List <IToken> lineTokens = lines[0].Tokens; Assert.AreEqual(3, lineTokens.Count); Assert.AreEqual(TokenType.StartTag, lineTokens[1].TokenType); StartTag startTag = (StartTag)lineTokens[1]; Assert.AreEqual("div", startTag.Name); Assert.AreEqual(1, startTag.Attributes.Count); Assert.AreEqual(TokenType.Attribute, startTag.Attributes[0].TokenType); AttributeToken attribute = (AttributeToken)startTag.Attributes[0]; Assert.AreEqual("onclick", attribute.Name); Assert.AreEqual(true, attribute.Value.IsCSStatement); Assert.AreEqual(true, attribute.Value.HasParentheses); Assert.AreEqual("() => onclick(\"hello\")", attribute.Value.Content); }
public TagClass(string tag, int start, string text, char[] t) { this.Start = start; this.EndTag = "</" + tag + ">"; this.baseText = text; if (baseText != null) { int s = IndexOf(t, '>', start); IsSingleTag = Check(t, '/', s - 1); this.StartTag = baseText.Substring(start, s + 1 - start); if (IsSingleTag) { this.parameter = StartTag.Replace("<" + tag, "").Replace("/>", ""); } else { this.parameter = StartTag.Replace("<" + tag, "").Replace(">", ""); } //ClassName = Web.GetParameter(this.parameter, "class"); //IdName = Web.GetParameter(this.parameter, "id"); } }
/// <summary> /// Shifts node components that are located at or beyond given start point by the specified range /// </summary> /// <param name="start">Start point</param> /// <param name="offset">Offset to shift by</param> public override void ShiftStartingFrom(int start, int offset) { // short-circuit in the case where the shift starts after our end if (start > End) { return; } // if tag is not closed and change is right at the end, // e need to grow start tag rather than element inner range if (StartTag.Contains(start) || StartTag.Start >= start || (!StartTag.IsClosed && start == StartTag.End)) { StartTag.ShiftStartingFrom(start, offset); } if (EndTag != null && (EndTag.Contains(start) || EndTag.Start >= start)) { EndTag.ShiftStartingFrom(start, offset); } if (OrphanedEndTagsCollection != null) { OrphanedEndTagsCollection.ShiftStartingFrom(start, offset); } if (VirtualEnd >= start) { VirtualEnd = Math.Max(start, VirtualEnd + offset); } int count = Children.Count; for (int i = 0; i < count; i++) { Children[i].ShiftStartingFrom(start, offset); } }
/// <summary>Completes element. Called by tree builder when element is complete: /// start tag is self-closed or implicitly closed or element is closed by /// a well-formed end tag or by another tag that is being opened.</summary> internal virtual void CompleteElement( ITextRange closingSequence, bool isClosed, ReadOnlyCollection <ElementNode> children, ReadOnlyCollection <AttributeNode> startTagAtributes, ReadOnlyCollection <AttributeNode> endTagAttributes) { Debug.Assert(children != null); Debug.Assert(startTagAtributes != null); Debug.Assert(endTagAttributes != null); if (!StartTag.IsComplete) { StartTag.Complete(startTagAtributes, closingSequence, isClosed, false, false); } else if (EndTag != null && !EndTag.IsComplete) { EndTag.Complete(endTagAttributes, closingSequence, isClosed, false, false); } Children = children; VirtualEnd = closingSequence.End; }
public override void Reflow(DrawContext dc, BoundingContext bounds, bool incremental) { ReflowStart(dc); if ( incremental ) bounds=bounds.Narrow(style.Left, style.Right); MarkupItem tag=new StartTag(CurrentLine, ElementNode); ReflowMarkup(tag, dc, style, bounds); ImageStyle s=style as ImageStyle; if ( s == null ) throw new InvalidOperationException("Expected style for image to be Custom"); string imgPath=ElementNode.GetAttribute(s.SourceAttribute); if ( imgPath == null ) throw new InvalidOperationException("SourceAttribute for image is missing"); // think about relative to doc Bitmap bm; Uri docUri=new Uri(elementNode.BaseURI); Uri uri=new Uri(docUri, imgPath); if ( uri.IsFile && File.Exists(uri.AbsolutePath) ) bm=new Bitmap(uri.AbsolutePath); else bm=ErrorBitmap; ImageLineItem ili=new ImageLineItem(CurrentLine, ElementNode, bm); ReflowMarkup(ili, dc, style, bounds); tag=new EndTag(CurrentLine, ElementNode); ReflowMarkup(tag, dc, style, bounds); ReflowEnd(dc); }
public TagClass(string tag, int start, string text) { this.Start = start; // this.StartTag = startTag; this.EndTag = "</" + tag + ">"; this.baseText = text; if (baseText != null) { int s = baseText.IndexOf('>', start); int single = baseText.IndexOf("/>", start); this.StartTag = baseText.Substring(start, s + 1 - start); if (single > 0 && s > single) { IsSingleTag = true; this.parameter = StartTag.Replace("<" + tag, "").Replace("/>", ""); } else { this.parameter = StartTag.Replace("<" + tag, "").Replace(">", ""); } //ClassName = Web.GetParameter(this.parameter, "class"); //IdName = Web.GetParameter(this.parameter, "id"); } }
internal Applet(StartTag startTag, EndTag endTag, IEnumerable <ISegment> children) : base(startTag, endTag, children) { }