Kon nichi ha

* Problem

My custom tag speaks *Character entity reference*, so I can read but, I cannot
expand as html code.

* Story (*long*)

** First Try (embedded lisp, It's work fine )
I try to insert "navigable buttons" for each entries on web*.

At first step, I try embedded elisp with <lisp> tag shown below.
------------------------------------------------------------------------
<lisp>
(save-excursion
 (let ((outstr
         (concat "[[index][DB Top]]//"
                 "[[#top][Top]]"
                 "<literal>//"))
        (num 1))
   (goto-char 0)
   (while (re-search-forward
            "^\*[ \t]*\\([^*].*\\)[ \t]*$" ; "^\*\s*([^*].*)[\s]*$"
            nil t)
     (setq outstr
            (concat
             outstr
             "<a href=\"#sec"
             (number-to-string num)
             "\">[" (match-string 1) "]</a> "))
     (setq num (1+ num))
     )
   (concat outstr "</literal>")
   )
)
</lisp>
------------------------------------------------------------------------
this fragment will be replaced  links to index.html PageTop and each
chapters on the page.

And  this work fine, but it is too long to insert more than several
times on each pages.

Then I push them into a function named "mymuse-insert-navi-buttons"
and define it on my ~/.emacs.

------------------------------------------------------------------------
<lisp>
(mymuse-insert-navi-buttons)
</lisp>
------------------------------------------------------------------------

This also work as expected, but I think it still longer for me.
So I decided to try to define custom tag.

** Second Try (custom tag, it does not work)

At first step, I define function for custom tag shown below.

------------------------------------------------------------------------
(defun mymuse-insert-navi-buttons-tag (beg end)
 (let ((outstr
         (concat "<literal><a href=\"index.html\">Index</a> "
                 "<a href=\"#top\">Top</a> "
                 ))
        (num 1))
   (save-excursion
     (goto-char 0)
     (while (re-search-forward
              "^\*[ \t]*\\([^*].*\\)[ \t]*$" ; "^\*\s*([^*].*)[\s]*$"
              nil t)
        (setq outstr
              (concat
               outstr
               "<a href=\"#sec"
               (number-to-string num)
               "\">[" (match-string 1) "]</a> "))
        (setq num (1+ num))
        )
     )
   (insert (concat outstr "</literal>"))

   )
 )
------------------------------------------------------------------------

Then, I set it to my tag "navi-button" via custom function of emacs like

("navi-button" nil nil mymuse-insert-navi-buttons)

Now the tag should be inserted is only "<navi-button>", very shorter,
and There is another good thing.
when I insert it,C-c i t (muse-insert-tag), completion is available.
That's Cooole.

It almost work, but some letter(ex.<,>) translate Character entity
reference(ex &lt&, &gt;), so I can expanded *string* for human reading,
but cannot expanded html code correctly.



Thank you.

--
逸見研一(いつみけんいち)
Mixi http://mixi.jp/show_friend.pl?id=113732
Orkut http://www.orkut.com/Profile.aspx?uid=11299027584966195898
Blog http://d.hatena.ne.jp/amt/
Plan http://calendar.yahoo.co.jp/amt_tmp


_______________________________________________
emacs-wiki-discuss mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/emacs-wiki-discuss

Reply via email to