static array<tree> get_springer_author_datas (tree t, string s, bool llncs=false) { s= "\\author-" * s; int i, n=N(t); bool line_break= true; array<tree> r; tree u; tree author_data (APPLY, "\\author-data"); tree author_name (CONCAT); for (i=0; i<n; i++) { u= t[i]; if (is_tuple (u, "\\and")) { line_break= false; if (N(author_name) > 1) { tree tmp= concat(); for (int j=0; j<N(author_name); j++) if (j+1 < N(author_name) || !is_line_break (author_name[j])) tmp << author_name[j]; if (N(tmp) > 1) author_data << tree (APPLY, s, tmp); author_name= tree (CONCAT); } if (N(author_data) > 1) { r << author_data; author_data= tree (APPLY, "\\author-data"); } line_break= true; } else if (is_springer_titlenote (u)) author_data << tree (APPLY, "\\author-note", u[1]); else if (llncs && is_tuple (u, "\\inst", 1)) author_data << tree (APPLY, "\\author-inst", string_arg (u[1])); else if (is_tuple (u, "\\email", 1)) author_data << tree (APPLY, "\\author-email", u[1]); else if (is_tuple (u, "\\tmhomepage", 1)) author_data << tree (APPLY, "\\author-homepage", u[1]); else if (is_tuple (u, "\\tmmisc", 1)) author_data << tree (APPLY, "\\author-misc", u[1]); else if (!line_break || !is_line_break (u)) { if (!line_break || (u != " " && u != concat (" ") && u != concat ())) author_name << u; if (is_line_break (u)) line_break= true; else if (u != " " && u != concat (" ") && u != concat ()) line_break= false; } } if (N(author_name) > 1) { tree tmp= concat(); for (int j=0; j<N(author_name); j++) if (j+1 < N(author_name) || !is_line_break (author_name[j])) tmp << author_name[j]; if (N(tmp) > 1) author_data << tree (APPLY, s, tmp); author_name= tree (CONCAT); } if (N(author_data) > 1) { r << author_data; author_data= tree (APPLY, "\\author-data"); } return r; }
static array<tree> get_acm_author_datas (tree t) { int i, n=N(t); bool line_break= true; array<tree> r; tree u; tree author_data (APPLY, "\\author-data"); tree author_name (CONCAT); for (i=0; i<n; i++) { u= t[i]; if (is_tuple (u, "\\alignauthor")) { line_break= false; if (N(author_name) > 1) { tree tmp= concat(); for (int j=0; j<N(author_name); j++) if (j+1 < N(author_name) || !is_line_break (author_name[j])) tmp << author_name[j]; if (N(tmp) > 1) author_data << tree (APPLY, "\\author-name", tmp); author_name= tree (CONCAT); } if (N(author_data) > 1) { r << author_data; author_data= tree (APPLY, "\\author-data"); } line_break= true; } else if (is_acm_titlenote (u)) author_data << tree (APPLY, "\\author-note", u[1]); else if (is_tuple (u, "\\affaddr", 1)) author_data << tree (APPLY, "\\author-affiliation", u[1]); else if (is_tuple (u, "\\email", 1)) author_data << tree (APPLY, "\\author-email", u[1]); else if (is_tuple (u, "\\tmacmhomepage", 1)) author_data << tree (APPLY, "\\author-homepage", u[1]); else if (is_tuple (u, "\\tmacmmisc", 1)) author_data << tree (APPLY, "\\author-misc", u[1]); else if (!line_break || !is_line_break (u)) { if (!line_break || (u != " " && u != concat (" ") && u != concat ())) author_name << u; if (is_line_break (u)) line_break= true; else if (u != " " && u != concat (" ") && u != concat ()) line_break= false; } } if (N(author_name) > 1) { tree tmp= concat(); for (int j=0; j<N(author_name); j++) if (j+1 < N(author_name) || !is_line_break (author_name[j])) tmp << author_name[j]; if (N(tmp) > 1) author_data << tree (APPLY, "\\author-name", tmp); author_name= tree (CONCAT); } if (N(author_data) > 1) { r << author_data; author_data= tree (APPLY, "\\author-data"); } return r; }