[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [emacs-bidi] reordering based on implicit levels
From: |
Alex Schroeder |
Subject: |
Re: [emacs-bidi] reordering based on implicit levels |
Date: |
Mon, 12 Nov 2001 03:34:28 +0100 |
User-agent: |
Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.1 (i686-pc-linux-gnu) |
"Eli Zaretskii" <address@hidden> writes:
> I'd prefer to get the code you have to work on paragraphs, because
> that's by far the most frequent use it will get (I think).
It seems that the default operation will fail if the string is mostly
R2L. The lines will be reversed as well. Example:
(let ((str "THIS IS EITHER ARABIC OR HEBREW AND SHOULD ALL BE INVERTED.
CURRENTLY
IT IS NOT REALLY AS JUSTIFIED AS IT COULD BE. WE'LL LOOK AT THIS
LATER. cheers, alex."))
(bidi-reorder-string
str
(bidi-resolve-implicit-levels
(bidi-resolve-weak-types
(bidi-get-types str)))))
"RETAL
SIHT TA KOOL LL'EW .EB DLUOC TI SA DEIFITSUJ SA YLLAER TON SI TI
YLTNERRUC .DETREVNI EB LLA DLUOHS DNA WERBEH RO CIBARA REHTIE SI SIHT.
cheers, alex."
Essentially this makes R2L also Bottom-to-Top... :)
Splitting on newlines, running the algorithm on single lines, and
joining them again seems to work fine, however:
(let ((str "THIS IS EITHER ARABIC OR HEBREW AND SHOULD ALL BE INVERTED.
CURRENTLY
IT IS NOT REALLY AS JUSTIFIED AS IT COULD BE. WE'LL LOOK AT THIS
LATER. cheers, alex."))
(mapconcat 'identity
(mapcar (lambda (s)
(bidi-reorder-string
s
(bidi-resolve-implicit-levels
(bidi-resolve-weak-types
(bidi-get-types s)))))
(split-string str "\n"))
"\n"))
"YLTNERRUC .DETREVNI EB LLA DLUOHS DNA WERBEH RO CIBARA REHTIE SI SIHT
SIHT TA KOOL LL'EW .EB DLUOC TI SA DEIFITSUJ SA YLLAER TON SI TI
RETAL. cheers, alex."
(let ((str "this is either arabic or hebrew and should all be inverted.
currently
it is not really as justified as it could be. we'll look at this
later. CHEERS, ALEX."))
(mapconcat 'identity
(mapcar (lambda (s)
(bidi-reorder-string
s
(bidi-resolve-implicit-levels
(bidi-resolve-weak-types
(bidi-get-types s)))))
(split-string str "\n"))
"\n"))
"this is either arabic or hebrew and should all be inverted. currently
it is not really as justified as it could be. we'll look at this
later. XELA ,SREEHC."
Alex.
--
http://www.emacswiki.org/
Re: [emacs-bidi] reordering based on implicit levels, Alex Schroeder, 2001/11/11
Re: [emacs-bidi] reordering based on implicit levels,
Alex Schroeder <=
[emacs-bidi] explicit formatting codes in visual-order text, Alex Schroeder, 2001/11/11
Re: [emacs-bidi] reordering based on implicit levels, Alex Schroeder, 2001/11/11