File tree Expand file tree Collapse file tree
src/com/xcodersteam/idea/plugins/mkupscss Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,24 +10,29 @@ import scala.xml._
1010
1111class 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
3338class CodeConvertingException (base : Exception = null , message : String = null ) extends Exception {
You can’t perform that action at this time.
0 commit comments