" & return at before paragraph 1
insert return & tab & "
" & artDate & "
" & return & "
" & return at after paragraph -1
replace "^" to tab & tab & tab in it with grep
replace "{[\\h8140-\\h9fff\\he040-\\hfcff]}{[\\h20-\\hff]}" to "\\1 \\2" in it with grep
replace "{[\\h20-\\hff]}{[\\h8140-\\h9fff\\he040-\\hfcff]}" to "\\1 \\2" in it with grep
replace "( {[\\h8140-\\h9fff\\he040-\\hfcff]}" to "(\\1" in it with grep
replace "{[\\h8140-\\h9fff\\he040-\\hfcff]} )" to "\\1)" in it with grep
replace "{[\\h8140-\\h9fff\\he040-\\hfcff]} {<[^>]+>} {[\\h8140-\\h9fff\\he040-\\hfcff]}" to "\\1\\2\\3" in it with grep
replace "{<\\s*[^/][^>]*>} {[\\h8140-\\h9fff\\he040-\\hfcff]}" to "\\1\\2" in it with grep
replace "{[\\h8140-\\h9fff\\he040-\\hfcff]} {<\\s*/[^>]*>}" to "\\1\\2" in it with grep
replace "{[\\h8140-\\h9fff\\he040-\\hfcff]} {[!?.,]}" to "\\1\\2" in it with grep
replace "{[\\h20-\\h7e]}'{[dmst]} " to "\\1’\\2 " in it with grep
replace "n'{[\\s\\r<>]}" to "n’\\1" in it with grep
replace "\\s{[!?。!?]}" to "\\1" in it with grep -- 句点の直前のスペースを削除
repeat
replace tab & " " to tab in it with grep
if result is 0 then exit repeat
end repeat
repeat
replace " " to " " in it with grep
if result is 0 then exit repeat
end repeat
on error errMsg number errNum
set AppleScript's text item delimiters to dfltDlm
allow redraw
display dialog "txt2xhtml: " & errMsg & return & "Error: #" & errNum with icon stop buttons {"OK"} default button "OK"
return false
end try
set AppleScript's text item delimiters to dfltDlm
allow redraw
set html coloring to true
end tell
end tell
-- EOF