private void ReadSubLanguage(XmlReader reader)
{
// This is a nifty added on hack made specifically for HTML.
// Normally the style config elements are quite managable as there
// are typically less than 10 when you don't count common styles.
//
// However HTML uses 9 different Sub languages that combined make
// use of all 128 styles (well there are some small gaps). In order
// to make this more managable I did added a SubLanguage element that
// basically just prepends the Language's name and "." to the Style
// Name definition.
//
// So for example if you had the following
// <Styles>
// <SubLanguage Name="ASP JavaScript">
// <Style Name="Keyword" Bold="True" />
// </SubLanguage>
// </Styles>
// That style's name will get interpreted as "ASP JavaScript.Keyword".
// which if you look at the html.txt in LexerStyleNames you'll see it
// maps to Style # 62
string subLanguageName = string.Empty;
if (reader.HasAttributes)
{
while (reader.MoveToNextAttribute())
if (reader.Name.ToLower() == "name")
subLanguageName = reader.Value;
reader.MoveToElement();
}
if (!reader.IsEmptyElement)
{
while (!(reader.NodeType == XmlNodeType.EndElement && reader.Name.Equals("sublanguage", StringComparison.OrdinalIgnoreCase)))
{
reader.Read();
if (reader.NodeType == XmlNodeType.Element && reader.Name.Equals("style", StringComparison.OrdinalIgnoreCase))
{
StyleConfig sc = this.getStyleConfigFromElement(reader);
sc.Name = subLanguageName + "." + sc.Name;
this._styles.Add(sc);
}
}
}
reader.Read();
}