public HTMLTagCarte(string tag, HtmlTag.HTMLTagType type, int score, bool textEdit) : base(score) { _tag = tag; _tagtype = type; _textEdit = textEdit; }
public void openTag() { _openTag = new HtmlTag(_tagname, HtmlTag.HTMLTagType.OPENTAG); _closed = false; }
public void closeTag() { _endTag = new HtmlTag(_tagname, HtmlTag.HTMLTagType.ENDTAG); _closed = true; }
// Rendu d'une balise HTML ouvrante ou fermante public string renderHtmlTag(HtmlTag tag, string attribs = "") { string res = ""; //on insère la balise res += HtmlTag.openSymbol[tag.getType()]; res += tag.getTagName(); if (tag.getType() == HtmlTag.HTMLTagType.OPENTAG) res += attribs; res += HtmlTag.endSymbol; //on met à jour l'indentation if (HtmlElement.singleTags.Exists(v => v == tag.getTagName())) { if (tag.getType() == HtmlTag.HTMLTagType.OPENTAG) _indentLevel++; else _indentLevel--; } return res; }
// Rendu d'une balise HTML ouvrante ou fermante public List<StrTypePair> renderHtmlTag(HtmlTag tag, List<StrTypePair> attribs = null) { List<StrTypePair> res = new List<StrTypePair>(); _isAutoTag = _htmlAutoTags.Exists(v => v == tag.getTagName()); //on insère la balise if(tag.getType() == HtmlTag.HTMLTagType.OPENTAG) res.Add(new StrTypePair(HtmlTag.openSymbol[tag.getType()], (_isAutoTag) ? StrTypePair.StrType.AUTO_OPEN_TAG : StrTypePair.StrType.USR_OPEN_TAG)); else res.Add(new StrTypePair(HtmlTag.openSymbol[tag.getType()], (_isAutoTag) ? StrTypePair.StrType.AUTO_END_TAG : StrTypePair.StrType.USR_END_TAG)); res.Add(new StrTypePair(tag.getTagName(), (_isAutoTag) ? StrTypePair.StrType.AUTO_TAG_NAME : StrTypePair.StrType.USR_TAG_NAME)); if (tag.getType() == HtmlTag.HTMLTagType.OPENTAG && attribs != null) res.AddRange(attribs); res.Add(new StrTypePair(HtmlTag.endSymbol, (_isAutoTag) ? StrTypePair.StrType.AUTO_TAG : StrTypePair.StrType.USR_TAG)); return res; }