Skip to content

Commit 37d97fc

Browse files
committed
Fixed small bug
1 parent e137480 commit 37d97fc

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

src/com/xcodersteam/idea/plugins/mkupscss/CodeConverter.scala

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,29 @@ import scala.xml._
1010

1111
class CodeNode(node: Node, lang: CodeLang) {
1212
val tag = node.label
13-
val classNames = if (classnameAttribute.isDefined) Option(classnameAttribute.get.toString.split(" ").toSeq) else Option.empty
13+
val classNames = {
14+
val classnameAttribute = node.attribute(lang.namings.classname)
15+
if (classnameAttribute.isDefined)
16+
Option(classnameAttribute.get.toString.split(" ").toSeq)
17+
else
18+
Option.empty
19+
}
1420
val id = node.attributes.get(lang.namings.id)
1521
val children = if (shouldDigDeeper) node.child.map((node) => new CodeNode(node, lang)) else null
16-
private val classnameAttribute = node.attributes.get(lang.namings.classname)
1722

1823
def isJSXNode: Boolean = if (lang == CodeLangHelper.langs.get("JSX Harmony").get) !isTag else false
1924

20-
def shouldRender: Boolean = !isText && !isCDATA && isTag && !(isDiv && classNames.isEmpty && id.isEmpty)
21-
22-
def isText: Boolean = tag == null || tag.length == 0
23-
2425
def isTag: Boolean = tag.charAt(0).isLower
2526

27+
def shouldRender: Boolean = !isText && !isCDATA && isTag && !(isDiv && classNames.isEmpty && id.isEmpty)
28+
2629
def isDiv: Boolean = tag.toLowerCase == "div"
2730

2831
def isCDATA: Boolean = tag equalsIgnoreCase "#PCDATA"
2932

3033
def shouldDigDeeper: Boolean = !isText && node.child.nonEmpty
34+
35+
def isText: Boolean = tag == null || tag.length == 0
3136
}
3237

3338
class CodeConvertingException(base: Exception = null, message: String = null) extends Exception {

0 commit comments

Comments
 (0)