static tree
get_author_name (tree t) {
  for (int i=0; i<N(t); i++)
    if (is_apply (t[i], "\\author-name"))
      return t[i];
  return concat();
}
Exemple #2
0
static bool
need_tokenize (tree t, array<tree> sep) {
  if (!(is_apply (t) && N(t) == 2 && is_concat (t[1]))) return false;
  for (int i=0; i<N(t[1]); i++)
    if (contains (t[1][i], sep)) return true;
  return false;
}
Exemple #3
0
tree
filter_spaces (tree t, bool &spaced) {
  if (is_space (t) && spaced)  return concat();
  if (is_space (t) && !spaced) {
    spaced= true;
    return t;
  }
  spaced= false;
  if (is_atomic (t)) return t;
  tree r (L(t));
  int i, n=N(t);
  if (is_apply (t) || is_tuple (t)) {
    // then arity shouldn't vary
    for (i=0; i<n; i++)
      r << filter_spaces (t[i], spaced);
    return r;
  }
  for (i=0; i<n; i++) {
    if (t[i] == concat() || t[i] == "") continue;
    if (!is_space (t[i]) || !spaced) {
      r << filter_spaces (t[i], spaced);
      if (is_space (t[i])) spaced= true;
      else spaced= false;
    }
  }
  n= N(r);
  if (n>0 && is_space (r[n-1])) r[n-1]= concat();
  return r;
}
static tree
add_llncs_author_datas (tree author, array<tree> author_affs) {
  if (!is_apply (author) || N(author) < 2) return concat ();
  for (int i=0; i<N(author_affs); i++) {
    for (int j=1; j<N(author_affs[i]); j++)
      author << author_affs[i][j];
  }
  return author;
}
tree
collect_metadata_svmono (tree t) {
  int i, n=N(t);
  tree u, r (CONCAT);
  tree doc_data (APPLY, "\\doc-data");
  tree abstract_data (APPLY, "\\abstract-data");
  array<tree> doc_notes;
  array<tree> tmp= collect_metadata_latex (t);
  for (i=0; i<N(tmp); i++) {
    if (is_apply (tmp[i], "\\doc-data")) doc_data= tmp[i];
    if (is_apply (tmp[i], "\\abstract-data")) abstract_data= tmp[i];
  }
  for (i=0; i<n; i++) {
    u= t[i];
    if (is_tuple (u, "\\subtitle", 1)) {
      get_springer_title_notes (u[1], doc_notes);
      doc_data << tree (APPLY, "\\doc-subtitle", cstm (u[1]));
    }
  }
  if (N(doc_notes) > 0) doc_data << doc_notes;
  if (N(doc_data) > 1) r << doc_data << "\n";
  if (N(abstract_data) > 1) r << abstract_data << "\n";
  return r;
}
static array<tree>
merge_llncs_author_datas (array<tree> authors, array<tree> affs) {
  array<tree> r, author_affs;
  for (int i=0; i<N(authors); i++) {
    author_affs= array<tree>();
    for (int j=1; j<N(authors[i]); j++) {
      if (is_apply (authors[i][j], "\\author-inst", 1)) {
        int n= as_int (as_string (authors[i][j][1]));
        if (n>0 && n<=N(affs))
          author_affs << affs[n-1];
      }
    }
    r << add_llncs_author_datas (authors[i], author_affs);
  }
  return r;
}