f670704
1,/
f670704
f670704
# on each new iso-code process the current one
f670704
\!\(<iso_639_entry\|</iso_639_entries>\)!{
f670704
    x
f670704
    s/^$//
f670704
    # we are on the first iso-code--nothing to process here
f670704
    t
f670704
    # process and write to output
f670704
    s/\s\+/ /g
f670704
    s/
f670704
    s!/\s*>!!
f670704
    # use '%' as a separator of parsed and unparsed input
f670704
    s/\(.*\)iso_639_2T_code="\([^"]\+\)"\(.*\)/\2 % \1 \3/
f670704
    s/\([^%]\+\)%\(.*\)iso_639_2B_code="\([^"]\+\)"\(.*\)/\1\t\3 % \2 \4/
f670704
    #  clear subst. memory for the next t
f670704
    t clear
f670704
    :clear
f670704
    s/\([^%]\+\)%\(.*\)iso_639_1_code="\([^"]\+\)"\(.*\)/\1\t\3 % \2 \4/
f670704
    t name
f670704
    # no 639-1 code--write xx
f670704
    s/%/\tXX %/
f670704
    :name
f670704
    s/\([^%]\+\)%\(.*\)name="\([^"]\+\)"\(.*\)/\1\t\3/
f670704
    s/ \t/\t/g
f670704
    p
f670704
    b
f670704
    :noout
f670704
}
f670704
f670704
H