File:  [Local Repository] / reports / tools.el
Revision 1.9: download - view: text, annotated - select for diffs - revision graph
Thu Dec 15 04:53:32 2016 UTC (7 years, 4 months ago) by boris
Branches: MAIN
CVS tags: HEAD
New info

(defun add-spaces (&optional num)
  "Add spaces until the line has num spaces"
  (interactive "p")
  (if (<= num 1) (setq num 70))
  (end-of-line)
  (while (> num (- (line-end-position) (line-beginning-position)))
    (insert " "))
  (beginning-of-line))

(defun convert-utf-to-html-entites  ()
  "Convert utf entities to html"
  (interactive)
  (save-excursion
    (setq case-fold-search nil)
    (beginning-of-buffer)
    (while (search-forward "«" nil t)
    (replace-match "&laquo;" nil t))
    (beginning-of-buffer)
    (while (search-forward "»" nil t) 
    (replace-match "&raquo;" nil t))
    (beginning-of-buffer)
    (while (search-forward "–" nil t) 
    (replace-match "&ndash;" nil t))
    (beginning-of-buffer)
    (while (search-forward "—" nil t) 
    (replace-match "&mdash;" nil t))
    (beginning-of-buffer)
    (while (search-forward "Є" nil t) ; YE
    (replace-match "&#x404;" nil t))
    (beginning-of-buffer)
    (while (search-forward "є" nil t) ; YE
    (replace-match "&#x454;" nil t))
    (beginning-of-buffer)
    (while (search-forward "і" nil t) ; i
    (replace-match "&#1110;" nil t))
    (beginning-of-buffer)
    (while (search-forward "ї" nil t) ; yi
    (replace-match "&#1111;" nil t))
    (beginning-of-buffer)
    (while (search-forward "І" nil t) ; yi
    (replace-match "&#x406;" nil t))
  ))

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>