repeat with i from 2 to bookmarksCounter
set bookM to item 1 of my decoupe(item i of my enliste, quote & ">") (* Pages ’06" sf:ranged="true" sf:page="5 *)
set bookPage to item -1 of my decoupe(bookM, "sf:page=" & quote) (* 5 *)
set bookName to item 1 of my decoupe(bookM, quote & " sf:ranged=") (* "Pages ’06" *)
(*
set linkRef to "#" & bookName (* "#Pages ’06" *)
if linkRef contains space then set linkRef to my remplace(linkRef, space, " ") (* "#Pages ’06" *)
if linkRef contains "&#x" then
set liste2 to my decoupe(linkRef, "&#x") (* {"#Pages ", "2019;06"} *)
repeat with j from 2 to count of liste2
set liste3 to my decoupe(item j of liste2, ";") (* {"2019", "06"} *)
set unicodeNum to item 1 of liste3
set item 1 of liste3 to do shell script "perl -MURI::Escape=uri_escape_utf8 -le 'print uri_escape_utf8(chr(0x" & unicodeNum & "))'"
set item j of liste2 to my recolle(liste3, "")
end repeat -- j
set linkRef to my recolle(liste2, "") (* "#Pages ’06" *)
end if
*)
set linkRef to "#" & (do shell script "perl -Mencoding=utf8 -MHTML::Entities -MURI::Escape=uri_escape_utf8 -lne 'print uri_escape_utf8(decode_entities($_))' <<<" & quoted form of (bookName))
copy {linkRef, bookPage} to end of my bookList
end repeat --i
twelwe lines of code are replaced by a single incantation.
Once again, thanks to all of you.
Yvan KOENIG (from FRANCE lundi 6 juillet 2009 13:54:51)