# === Unscramble aggregated fields ===
:disag
- s;\n([^:]+:)((.*[^\])?(\\\\)*),;\n\1\2\n\1;;
+ s;\n([^:\n]+:)(([^\n]*[^\])?(\\\\)*),;\n\1\2\n\1;;
t disag;
# === Insert FN when only N is present ===
}
pdi_attrib(){
- local card=":$1" name="$2" cnt="${3:-1}"
+ local card=":$1" name="$2" cnt="${3:-1}" attr="$4"
while [ $cnt -gt 0 ]; do
[ "${card#*${BR}${name};}" = "$card" ] && return 1
card="${card#*${BR}${name};}"
cnt=$((cnt - 1))
done
- printf %s\\n "${card%%:*}"
+ card="${card%%:*}"
+ if [ "$attr" ]; then
+ case $card in
+ *\;"$attr"=*) card="${card#*;${attr}=}";;
+ "$attr"=*) card="${card#${attr}=}";;
+ "$attr"|*\;"$attr"|"$attr"\;*|*\;"$attr"\;*) return 0;;
+ *) return 1;;
+ esac
+ case $card in
+ \"*\"\;*|\'*\'\;*)
+ card="${card#[\"\']}"; card="${card%%[\"\'];*}"
+ ;;
+ \"*\"|\'*\')
+ card="${card#[\"\']}"; card="${card%%[\"\']}"
+ ;;
+ *\;*) card="${card%%;*}";;
+ esac
+ fi
+ printf %s\\n "${card}"
}
pdi_value(){