Bug? [BANano] [SOLVED] - 1.21 'Else If' Transpiling Error

Mashiane

Expert
Licensed User
Hi there...

B4J Code

B4X:
Sub GetCssStyle(styleName As String) As String
    If styleName.StartsWith("@") Then
    else If styleName.StartsWith("#") Then
    else If styleName.StartsWith(".") Then
    Else
        styleName = "." & styleName
    End If
    Return CSSRule.Get(styleName)
End Sub
BANano Code

B4X:
this.getcssstyle = function (_stylename) {
        If (self == Null) self = this;
        If (_stylename.startsWith("@")) {} else if (.startsWith("#")) {} else if (.startsWith(".")) {} Else {
            _stylename = "." + _stylename;
        }
        Return self._cssrule[_stylename];
    };
It seems to loose the styleName in the startWith parts in the else if statements
 

Mashiane

Expert
Licensed User
Another example..

B4J Code

B4X:
public Sub MaterialBuildIcon(iconName As String, iconPos As String) As BANanoMaterialHTMLElement
    iconName = iconName.tolowercase
    If iconName.StartsWith("mdi-") Then
        AddClass("material-icons")
        iconName = MvFieldFrom(iconName,2,"-")
        iconName = iconName.Replace("-","_")
        AddContent(iconName)
    else if iconName.startswith("ggle-") Then
        iconName = MvFieldFrom(iconName,2,"-")
        AddContent(iconName)
    else if iconName.StartsWith("fa-") Then
        AddClass("fa " & iconName)
    else if iconName.StartsWith("fa fa-") Then
        AddClass(iconName)
    else if iconName.StartsWith("fa ") Then
        AddClass(iconName)
    Else
        AddClass(iconName)
    End If
    If iconPos.Length > 0 Then AddClass(iconPos)
    Return Me
End Sub
BANano Code

B4X:
this.materialbuildicon = function (_iconname, _iconpos) {
        if (self == null) self = this;
        _iconname = _iconname.toLowerCase();
        if (_iconname.startsWith("mdi-")) {
            self.addclass("material-icons");
            _iconname = self.mvfieldfrom(_iconname, 2, "-");
            _iconname = _iconname.split("-").join("_");
            self.addcontent(_iconname);
        } else if (.startsWith("ggle-")) {
            _iconname = self.mvfieldfrom(_iconname, 2, "-");
            self.addcontent(_iconname);
        } else if (.startsWith("fa-")) {
            self.addclass("fa " + _iconname);
        } else if (.startsWith("fa fa-")) {
            self.addclass(_iconname);
        } else if (.startsWith("fa ")) {
            self.addclass(_iconname);
        } else {
            self.addclass(_iconname);
        }
        if (_iconpos.length > 0) {
            self.addclass(_iconpos);
        }
        return self;
    };
 
Top