;ELC ;;; Compiled ;;; in Emacs version 26.3 ;;; with all optimizations. ;;; This file contains utf-8 non-ASCII characters, ;;; and so cannot be loaded into Emacs 22 or earlier. (and (boundp 'emacs-version) (< (aref emacs-version (1- (length emacs-version))) ?A) (string-lessp emacs-version "23") (error "`%s' was compiled for Emacs 23 or later" #$)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (byte-code "\300\301!\210\300\302!\210\303\304\305\"\207" [require cl-lib pcase autoload apply-on-rectangle "rect"] 3) #@103 A symbol, one of: ‘LIGHT’, ‘HEAVY’, ‘DOUBLE’. This specifies the weight of all the lines. (defvar aa2u-uniform-weight 'LIGHT (#$ . 528)) (byte-code "\300\301\302\303 !\203 \304\202\305\"\207" [defalias aa2u--lookup-char hash-table-p ucs-names gethash #[514 "\300\"A\207" [assoc-string] 5 "\n\n(fn STRING ALIST)"]] 4) #@12 (fn POS) (defalias 'aa2u--text-p #[257 "\300\301\"\207" [get-text-property aa2u-text] 4 (#$ . 868)]) (put 'aa2u--text-p 'byte-optimizer 'byte-compile-inline-expand) #@539 Return the name of the UCS box-drawing char w/ COMPONENTS. The string begins with "BOX DRAWINGS"; followed by the weight as per variable ‘aa2u-uniform-weight’, followed by COMPONENTS, a list of one or two symbols from the set: VERTICAL HORIZONTAL DOWN UP RIGHT LEFT If of length two, the first element in COMPONENTS should be the "Y-axis" (VERTICAL, DOWN, UP). In that case, the returned string includes "AND" between the elements of COMPONENTS. Lastly, all words are separated by space (U+20). (fn &rest COMPONENTS) (defalias 'aa2u-ucs-bd-uniform-name #[128 "\301\302\303\304\305##\207" [aa2u-uniform-weight format "BOX DRAWINGS %s %s" mapconcat symbol-name " AND "] 8 (#$ . 1043)]) #@260 Apply STRINGIFIER to COMPONENTS; return the UCS char w/ this name. The char is a string (of length one), with two properties: aa2u-stringifier aa2u-components Their values are STRINGIFIER and COMPONENTS, respectively. (fn STRINGIFIER &rest COMPONENTS) (defalias 'aa2u-1c #[385 "\300 \301\"\302\303!\203\304\"\202\305\"A!\306\307\310%\207" [ucs-names apply string hash-table-p gethash assoc-string propertize aa2u-stringifier aa2u-components] 11 (#$ . 1757)]) (defalias 'aa2u-phase-1 #[0 "\300\211\301\302\"\210\211\303\304\"\207" [#[514 "eb\210\300\301\"\302\303\304#\205#\305\224\306\307\"\262\204\310\304\211#\210\202\207" [aa2u-1c aa2u-ucs-bd-uniform-name search-forward nil t 0 get-text-property aa2u-text replace-match] 7 "\n\n(fn WAS NAME)"] "|" VERTICAL "-" HORIZONTAL] 4]) #@12 (fn POS) (defalias 'aa2u-replacement #[257 "\211\300 Z\301\302\303\304\305\306\307\310\211  \311\312$ \f\f\313\314$\"!\203,\315\202D\211:\203C\211@A\211?\205>\211\262\266\202\202D\316\262 \f\317\320$  \321\322$\"!\203e\323\202}\211:\203|\211@A\211?\205w\211\262\266\202\202}\316\262\"#\262\262\262\262\262\207" [line-beginning-position #[514 "\211f\300=\204\"\301\302\"\203\303\202\301\304\"\205\305\306\307\">\205#\207" [43 memql (UP DOWN) VERTICAL (LEFT RIGHT) HORIZONTAL get-text-property aa2u-components] 6 "\n\n(fn NAME POS)"] #[1028 "\300!\301!ZW\205\\\"\207" [line-beginning-position line-end-position] 10 "\n\n(fn CC --CL-OK-- NAME DIR)"] #[1028 "\300 \301 \\V\206X?\205\"\207" [line-beginning-position line-end-position] 10 "\n\n(fn POS --CL-OK-- NAME DIR)"] #[257 "\211G\300U\207" [2] 3 "\n\n(fn LS)"] #[128 "\300\301\"\207" [delq nil] 4 "\n\n(fn &rest ARGS)"] apply aa2u-1c aa2u-ucs-bd-uniform-name UP 0 DOWN 2 VERTICAL nil LEFT -1 RIGHT 1 HORIZONTAL] 19 (#$ . 2577)]) (defalias 'aa2u-phase-2 #[0 "eb\210\300\301\302\300\303#\203*`\211S\304\305\"\262\204&\211\306S!\206!\307BB\262\210\202\211\211\205D\211@\211@b\210\310\311!\210\211Ac\210A\266\202\202+\262\207" [nil search-forward "+" t get-text-property aa2u-text aa2u-replacement "?" delete-char -1] 6]) (defalias 'aa2u-phase-3 #[0 "\300ed\301\302\303\302F#\207" [remove-text-properties aa2u-stringifier nil aa2u-components] 7]) #@1409 Convert simple ASCII art line drawings to Unicode. Specifically, perform the following replacements: - (hyphen) BOX DRAWINGS LIGHT HORIZONTAL | (vertical bar) BOX DRAWINGS LIGHT VERTICAL + (plus) (one of) BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL BOX DRAWINGS LIGHT DOWN AND RIGHT BOX DRAWINGS LIGHT DOWN AND LEFT BOX DRAWINGS LIGHT UP AND RIGHT BOX DRAWINGS LIGHT UP AND LEFT BOX DRAWINGS LIGHT VERTICAL AND RIGHT BOX DRAWINGS LIGHT VERTICAL AND LEFT BOX DRAWINGS LIGHT UP AND HORIZONTAL BOX DRAWINGS LIGHT DOWN AND HORIZONTAL BOX DRAWINGS LIGHT UP BOX DRAWINGS LIGHT DOWN BOX DRAWINGS LIGHT LEFT BOX DRAWINGS LIGHT RIGHT QUESTION MARK More precisely, hyphen and vertical bar are substituted unconditionally, first, and plus is substituted with a character depending on its north, south, east and west neighbors. NB: Actually, ‘aa2u’ can also use "HEAVY" instead of "LIGHT", depending on the value of variable ‘aa2u-uniform-weight’. This command operates on either the active region, or the accessible portion otherwise. (fn BEG END &optional INTERACTIVE) (defalias 'aa2u #[770 "\211\203\300 \204e\262d\262\212\214~\210}\210\301 \210\302 \210\303 *\207" [region-active-p aa2u-phase-1 aa2u-phase-2 aa2u-phase-3] 5 (#$ . 4079) "r\np"]) #@154 Like ‘aa2u’ on the region-rectangle. When called from a program the rectangle's corners are START (top left) and END (bottom right). (fn START END) (defalias 'aa2u-rectangle #[514 "\300\"\301\302!r\211q\210\303\304\305\306\307!\310\"\311$\216\312!\210\313`\314 \"\210\315ed\"*\262^b\210\312!\207" [delete-extract-rectangle generate-new-buffer " *temp*" make-byte-code 0 "\301\300!\205 \302\300!\207" vconcat vector [buffer-name kill-buffer] 2 insert-rectangle aa2u mark extract-rectangle] 10 (#$ . 5680) "r"]) #@277 Set property ‘aa2u-text’ of the text from START to END. This prevents ‘aa2u’ from misinterpreting "|", "-" and "+" in that region as lines and intersections to be replaced. Prefix arg means to remove property ‘aa2u-text’, instead. (fn START END &optional UNMARK) (defalias 'aa2u-mark-as-text #[770 "\211\203\300\202 \301\302#\207" [remove-text-properties add-text-properties (aa2u-text t)] 7 (#$ . 6211) "r\nP"]) #@184 Like ‘aa2u-mark-as-text’ on the region-rectangle. When called from a program the rectangle's corners are START (top left) and END (bottom right). (fn START END &optional UNMARK) (defalias 'aa2u-mark-rectangle-as-text #[770 "\300\301$\207" [apply-on-rectangle #[771 "`\300\\\\#\207" [aa2u-mark-as-text] 8 "\n\n(fn SCOL ECOL UNMARK)"]] 8 (#$ . 6649) "r\nP"]) (provide 'ascii-art-to-unicode)