# test-tagging.awk -- check the footnote structures of a tagged PDF # # show-pdf-tags --xml test-tagging.pdf | awk -v want= -f test-tagging.awk # # Every footnotemark (Lbl) and footnote (FENote) structure element must # refer to the other one (/Ref, shown as ), # and there must be of each. Prints TAGS-RESULT OK or NG. function done() { if (kind != "") { id[kind, ++n[kind]] = cur; ref[kind, n[kind]] = refs } kind = ""; cur = ""; refs = "" } /]/ { done(); kind = "mark"; next } /]/ { done(); kind = "note"; next } kind != "" && /referenced-as="/ { s = $0; sub(/.*referenced-as="/, "", s); sub(/".*/, "", s); cur = s; next } kind != "" && /<\?References objects="/ { s = $0; sub(/.*objects="/, "", s); sub(/".*/, "", s); refs = s; done(); next } kind != "" && /^[ \t]*<[^?]/ && !/