emacs-wiki-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[emacs-wiki-discuss] Re: bugs?


From: Sacha Chua
Subject: [emacs-wiki-discuss] Re: bugs?
Date: Wed, 13 Apr 2005 23:48:43 +0800
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux)

address@hidden writes:

> Perhaps a distinction between `real' paths and `http' paths
> should be made, or one of the two should be excluded.  Currently,
> `real' paths are not possible, but I think that they should not be
> presented as a link).

I use the following code to convert things to relative URLs whenever possible:

(defvar sacha/emacs-wiki-use-absolute-url-flag nil
  "Non-nil means publish absolute URLs.")
(require 'w3m)
(defadvice emacs-wiki-link-url (around sacha activate)
  "Return relative links if possible."
  ad-do-it
  (when ad-return-value
    (unless (emacs-wiki-wiki-url-p ad-return-value)
      (setq ad-return-value
            (file-relative-name
             (expand-file-name
              ad-return-value
              planner-directory)
             planner-directory))
      (when (and sacha/emacs-wiki-use-absolute-url-flag
                 emacs-wiki-publishing-p)
        (setq ad-return-value
              (w3m-expand-url
               ad-return-value
               "http://sacha.free.net.ph/notebook/wiki/";))))))

I stick a lot of things into my notebook directory and elsewhere under
my public_html. Some things in my local public_html are not published
on my website. I settle for simply using relative URLs and leaving,
say, /etc/passwd as a 404.

It should be easy to modify this code to replace all links that match
or do not match a regexp filter with "", which means the file won't be
linked.

> And something else: cancelled tasks do not get their own class
> (like others get "task_", "taskp" etc).  (Note: taskC is already
> taken.)

I'll add task_cancelled when we figure out how the rest of the task is to be 
marked up...

> And something else: the task number in used as id in the HTML
> document.  An idea should however be unique, which is not
> necessarily the case in the generated document.

Does anyone actually use the task numbers for linking? Maybe we should
remove the IDs entirely. Hmm...

> Finally, perhaps 
> <li><div class="taskX"><span id="B23"><span class="taskB">B23 X </span> 
> </span>...
> could be marked up as
> <li class="taskX"><span id="B23" class="taskB">B23 X</span> ...
> instead.

Try out the following code and see if you like it. =)

(defun sacha/planner-markup-tasks ()
  (while (re-search-forward planner-task-regexp nil t)
    ;; Insert "<ul>\n"
    (goto-char (line-beginning-position))
    (insert "<ul>\n")
    (while (looking-at "^#\\([A-C]\\)\\([0-9]*\\)\\s-+\\(.\\)\\s-+\\(.+\\)")
      (let ((priority (match-string 1))
            (number (match-string 2))
            (status (match-string 3))
            (text (match-string 4)))
        (delete-region (line-beginning-position)
                       (min (point-max) (1+ (line-end-position))))
        (insert (format "<li class=\"%s\"><span class=\"%s\">%s</span> 
%s</li>\n"
                        (cond
                         ((string= status "_") "task_")
                         ((string= status "o") "tasko")
                         ((string= status ">") "taskd")
                         ((string= status "P") "taskp")
                         ((string= status "X") "taskX")
                         ((string= status "C") "task_cancelled")
                         (t "task"))
                        (cond
                         ((string= priority "A") "taskA")
                         ((string= priority "B") "taskB")
                         ((string= priority "C") "taskC")
                         (t "task"))
                        (concat priority number " " status)
                        text))))
    (insert "</ul>\n")))
(add-to-list 'planner-publishing-markup (function sacha/planner-markup-tasks))
(planner-update-wiki-project)

If it works, I'll replace the individual task markup with
planner-markup-tasks in planner--dev.
-- 
Sacha Chua <address@hidden> - open source geekette
http://sacha.free.net.ph/ - PGP Key ID: 0xE7FDF77C
interests: emacs, gnu/linux, personal information management, CS ed
sachac on irc.freenode.net#emacs . YM: sachachua83




reply via email to

[Prev in Thread] Current Thread [Next in Thread]