(expr, take=None)
return escape_xml(result)
* Creates a QGIS expression (e.g. '{maki}-11'  becomes '"maki"'+'11'
    :param expr:
    :param take: The nr of fields to take. All if value is None.
                 E.g.: "{name:latin}\n{name:nonlatin}" consists of two fields
    :return:
* Creates a QGIS expression (e.g. '{maki}-11'  becomes '"maki"'+'11'
    :param expr:
    :param take: The nr of fields to take. All if value is None.
                 E.g.: "{name:latin}\n{name:nonlatin}" consists of two fields
    :return:
* Creates a QGIS expression ( e . g . { maki } - 11 becomes maki + 11 : param expr : : param take : The nr of fields to take . All if value is None . E . g . : { name : latin } \ n { name : nonlatin } consists of two fields : return :
def _parse_expr(expr, take=None):
    """
     * Creates a QGIS expression (e.g. '{maki}-11'  becomes '"maki"'+'11'
    :param expr:
    :param take: The nr of fields to take. All if value is None.
                 E.g.: "{name:latin}\n{name:nonlatin}" consists of two fields
    :return:
    """
    if isinstance(expr, list):
        op = expr[0]
        data_expression_operators = ["get", "has", "id", "geometry-type", "properties", "feature-state"]
        is_data_expression = True if op in data_expression_operators else False
        if not is_data_expression:
            return ""
        else:
            if op == "get":
                assert len(expr) == 2
                return _parse_expr(expr[1])
            else:
                raise RuntimeError("Data expression operator not implemented: ", op)

    fields = _get_qgis_fields(expr)[:take]
    result = "+".join(fields)
    return escape_xml(result)
def _parse_expr ( expr , take = None ) : if isinstance ( expr , list ) : op = expr [ 0 ] data_expression_operators = [ "get" , "has" , "id" , "geometry-type" , "properties" , "feature-state" ] is_data_expression = True if op in data_expression_operators else False if not is_data_expression : return "" else : if op == "get" : assert len ( expr ) == 2 return _parse_expr ( expr [ 1 ] ) else : raise RuntimeError ( "Data expression operator not implemented: " , op ) fields = _get_qgis_fields ( expr ) [ : take ] result = "+" . join ( fields ) return escape_xml ( result )