Mercurial > emacs
comparison lisp/info.el @ 76766:a05e2047bdb8
(Info-display-images-node): On a text-only terminal, show
the "text" or "alt" parts of the image blobs.
author | Nick Roberts <nickrob@snap.net.nz> |
---|---|
date | Tue, 27 Mar 2007 22:21:02 +0000 |
parents | 9d47b3ad340e |
children | dc6d80edce90 |
comparison
equal
deleted
inserted
replaced
76765:edb4e737aa3a | 76766:a05e2047bdb8 |
---|---|
1313 (while (re-search-forward | 1313 (while (re-search-forward |
1314 "\\(\0\b[[]image\\(\\(?:[^\b]\\|[^\0]+\b\\)*\\)\0\b[]]\\)" | 1314 "\\(\0\b[[]image\\(\\(?:[^\b]\\|[^\0]+\b\\)*\\)\0\b[]]\\)" |
1315 nil t) | 1315 nil t) |
1316 (let* ((start (match-beginning 1)) | 1316 (let* ((start (match-beginning 1)) |
1317 (parameter-alist (Info-split-parameter-string (match-string 2))) | 1317 (parameter-alist (Info-split-parameter-string (match-string 2))) |
1318 (src (cdr (assoc-string "src" parameter-alist))) | 1318 (src (cdr (assoc-string "src" parameter-alist)))) |
1319 (image-file (if src (if (file-name-absolute-p src) src | 1319 (if (display-images-p) |
1320 (concat default-directory src)) | 1320 (let* ((image-file (if src (if (file-name-absolute-p src) src |
1321 "")) | 1321 (concat default-directory src)) |
1322 (image (if (file-exists-p image-file) | 1322 "")) |
1323 (create-image image-file) | 1323 (image (if (file-exists-p image-file) |
1324 "[broken image]"))) | 1324 (create-image image-file) |
1325 (if (not (get-text-property start 'display)) | 1325 "[broken image]"))) |
1326 (add-text-properties | 1326 (if (not (get-text-property start 'display)) |
1327 start (point) `(display ,image rear-nonsticky (display))))))) | 1327 (add-text-properties |
1328 start (point) `(display ,image rear-nonsticky (display))))) | |
1329 ;; text-only display, show alternative text if provided, or | |
1330 ;; otherwise a clue that there's meant to be a picture | |
1331 (delete-region start (point)) | |
1332 (insert (or (cdr (assoc-string "text" parameter-alist)) | |
1333 (cdr (assoc-string "alt" parameter-alist)) | |
1334 (and src | |
1335 (concat "[image:" src "]")) | |
1336 "[image]")))))) | |
1328 (set-buffer-modified-p nil))) | 1337 (set-buffer-modified-p nil))) |
1329 | 1338 |
1330 ;; Texinfo 4.7 adds cookies of the form ^@^H[NAME CONTENTS ^@^H]. | 1339 ;; Texinfo 4.7 adds cookies of the form ^@^H[NAME CONTENTS ^@^H]. |
1331 ;; Hide any construct of the general form ^@[^@-^_][ ... ^@[^@-^_]], | 1340 ;; Hide any construct of the general form ^@[^@-^_][ ... ^@[^@-^_]], |
1332 ;; including one optional trailing newline. | 1341 ;; including one optional trailing newline. |