1495 (setq ecb-tip-of-the-day nil) |
1495 (setq ecb-tip-of-the-day nil) |
1496 |
1496 |
1497 ;;; ---------------------------------------------------------------- |
1497 ;;; ---------------------------------------------------------------- |
1498 (message "html") |
1498 (message "html") |
1499 |
1499 |
1500 (defun text2html (start end) |
1500 (defun html-charref-escape-region (start end) |
1501 (interactive "r") |
1501 (interactive "r") |
1502 (save-excursion |
1502 (save-excursion |
1503 (save-restriction |
1503 (save-restriction |
1504 (narrow-to-region start end) |
1504 (narrow-to-region start end) |
1505 (goto-char (point-min)) |
1505 (goto-char (point-min)) |
1508 (replace-string "<" "<") |
1508 (replace-string "<" "<") |
1509 (goto-char (point-min)) |
1509 (goto-char (point-min)) |
1510 (replace-string ">" ">") |
1510 (replace-string ">" ">") |
1511 ))) |
1511 ))) |
1512 |
1512 |
|
1513 (defun html-charref-from-char (char) |
|
1514 (format "&#%d;" char) |
|
1515 ) |
|
1516 |
|
1517 (defun html-charref-from-string (string) |
|
1518 (let ((res "")) |
|
1519 (mapc |
|
1520 (lambda (char) (setq res (concat res (html-charref-from-char char)))) |
|
1521 string) |
|
1522 res |
|
1523 ) ) |
|
1524 |
|
1525 (defun html-charref-escape-region2 (begin end &optional prefix) |
|
1526 (interactive "r\nP") |
|
1527 (if prefix |
|
1528 (save-excursion |
|
1529 (goto-char begin) |
|
1530 (insert (html-charref-from-string (delete-and-extract-region begin end)))) |
|
1531 (html-charref-from-string (buffer-substring begin end)) |
|
1532 )) |
|
1533 |
|
1534 (defun html-charref-to-string (html) |
|
1535 (let ((res "") (pos 0)) |
|
1536 (while (string-match "&#\\([[:digit:]]+\\);" html pos) |
|
1537 (setq res (concat res (string (string-to-int (substring html (match-beginning 1) (match-end 1)) 10)))) |
|
1538 (setq pos (match-end 0)) |
|
1539 ) |
|
1540 res |
|
1541 ) ) |
|
1542 |
|
1543 (defun html-charref-unescape-region (begin end &optional prefix) |
|
1544 (interactive "r\nP") |
|
1545 (if prefix |
|
1546 (save-excursion |
|
1547 (goto-char begin) |
|
1548 (insert (html-charref-to-string (delete-and-extract-region begin end)))) |
|
1549 (html-charref-to-string (buffer-substring begin end)) |
|
1550 )) |
|
1551 |
1513 ;;; ---------------------------------------------------------------- |
1552 ;;; ---------------------------------------------------------------- |
1514 (message "nxml") |
1553 (message "nxml") |
1515 |
1554 |
1516 (setq nxml-sexp-element-flag t) |
1555 (setq nxml-sexp-element-flag t) |
1517 (setq nxml-child-indent 2) |
1556 (setq nxml-child-indent 2) |