authors property

List<String>? authors

Gets the list of authors of the document. This is inferred by splitting the author string by comma. Returns null if no author exists.

Implementation

List<String>? get authors {
  if (author == null) {
    return null;
  }
  var authorString = author!.replaceAll(";", ",");
  authorString = authorString.replaceAll("&", ",");
  authorString = authorString.replaceAll("and", ",");
  List<String> splitted = authorString.split(",");
  List<String> ret = [];

  for (var token in splitted) {
    var start = 0;
    var end = token.length - 1;
    while (start < token.length && token[start] == ' ') {
      start++;
    }
    while (end >= 0 && token[end] == ' ') {
      end--;
    }
    if (end - start >= 0) {
      ret.add(token.substring(start, end + 1));
    }
  }
  return ret;
}