Hi
I have defined a custom tag <strike> since muse does not appear to have
a strike-through markup (from the mailing list archives it seems that no
agreement was made regarding a notation for a strike-trough markup).
I have also defined the face muse-strike that is used when font-lock is
active to change the text inside the <strike></strike> tag (actually,
the tag is also changed). I'd like to know how to hide the tag when
font-lock is enabled similarly to what happens with the emphasized,
verbatim, and many other muse notations. In this way the font-locked
text would be crossed out in the muse buffer without the <strike> tag
polluting the source.
Below is a step-by-step sequence of what I have done.
;; -------------------------------------------------------------------
;; -------------------------------------------------------------------
;; -------------------------------------------------------------------
;; Add the strike tag to muse-publish-markup-tags
(add-to-list 'muse-publish-markup-tags
'("strike" t t t 'ignore)
t)
;; Add the strike tag to muse-html-markup-tags so that it is used when
;; publishing to html
(add-to-list 'muse-html-markup-tags '("strike" t t t
muse-publish-html-strike-tag))
;; Add the strike tag to muse-colors-tags in order to modify the face
properties
(add-to-list 'muse-colors-tags '("strike" t nil nil
muse-colors-strike-tag)))
;; Define the muse-strike face that has the strike-through property set
to t
(defface muse-strike
'((((class color) (background light))
(:strike-through t))
(((class color) (background dark))
(:strike-through t)))
"Face for strike-trough text."
:group 'muse-colors)
;; Define the muse-publish-html-strike-tag used when publishing to html
;; The .css file has
;; .strikethrough {
;; text-decoration: line-through;
;; }
(defun muse-publish-html-strike-tag (beg end attrs)
(save-excursion
;; goto the start of the mark up
(goto-char beg)
;; insert start tag
(muse-insert-markup "<span class=\"strikethrough\">")
;; goto end of the mark up
(goto-char end)
;; insert end tag
(muse-insert-markup "</span>")))
;; Define the muse-colors-strike-tag that changes the face of the text
inside
;; the strike tag to the muse-strike face (well, it also changes the
tag)
(defun muse-colors-strike-tag (beg end)
"Strip properties and colorize with `muse-strike'."
(muse-unhighlight-region beg end)
(let ((multi (save-excursion
(goto-char beg)
(forward-line 1)
(> end (point)))))
(add-text-properties beg end `(face muse-strike
font-lock-multiline ,multi))))
;; -------------------------------------------------------------------
;; -------------------------------------------------------------------
;; -------------------------------------------------------------------
--
_________________________
Darlan Cavalcante Moreira
_______________________________________________
Muse-el-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/muse-el-discuss