parse method

  1. @override
List<LinkifyElement> parse(
  1. List<LinkifyElement> elements,
  2. LinkifyOptions options
)
override

Implementation

@override
List<LinkifyElement> parse(elements, options) {
  final list = <LinkifyElement>[];

  elements.forEach((element) {
    if (element is TextElement) {
      final match = _hashRegex.firstMatch(element.text);
      // final match2 = _hashRegex.allMatches(element.text);

      if (match == null){
        List appp = element.text.split(" ");
        if (appp.length > 0){
          appp.forEach((element2222) {
            if (element2222.toString().contains("#")){
              List bbb = element2222.toString().split("#");
              if (bbb.length > 1){
                if (bbb.first.toString() == ""){
                  list.add(TextElement(bbb.first.toString()));
                }else{
                  list.add(TextElement(bbb.first.toString() + " "));
                }
                if (bbb.last.toString() == ""){
                  list.add(TextElement("#"+bbb.last.toString()));
                }else{
                  list.add(HashElement("#"+bbb.last.toString()));
                }
              }else{
                list.add(HashElement(element2222.toString()));
              }
            }else{
              list.add(TextElement(element2222.toString()+ " "));
            }
          });
        }else{
          list.add(element);
        }

      }else{
        List ap = element.text.split(" ");
        ap.forEach((elemessnt) {
          if (elemessnt.toString().contains("#")){
            List bbbb = elemessnt.toString().split("\n");
            bbbb.forEach((elt) {
              if (elt.toString().contains("#")){
                List cc = elt.toString().split("#");
                if(cc.length > 1){
                  list.add(TextElement(cc.first.toString()+ ""));
                  list.add(HashElement("#"+cc.last.toString()+ ""));
                }else{
                  list.add(HashElement(elt.toString()+ "\n"));
                }
              }else{
                list.add(TextElement(elt.toString()+ "\n"));
              }
            });
          }else{
            list.add(TextElement(elemessnt+ " "));
          }
        });
      }
    } else {
      list.add(element);
    }
  });



  return list;
}