From ryo.takaishi.0 at gmail.com Sun Jan 8 10:17:33 2012 From: ryo.takaishi.0 at gmail.com (Ryo TAKAISHI) Date: Sun, 8 Jan 2012 19:17:33 +0900 Subject: [cl-org-mode-devel] [CL-ORG-MODE][PATCH] * src/utils.lisp: do not discriminate between lowercase char and uppercase char. Message-ID: <1326017853-20706-1-git-send-email-ryo.takaishi.0@gmail.com> This will be able to make out lower-case character similarly upper-case character. For example, "#+begin_src" similarly "#+BEGIN_SRC", "#+begin_example" similarly "#+BEGIN_EXAMPLE". --- Hello, I wrote a new patch and created branch for it "work-read-upcase-and-downcase" at cl-net repository. Thanks, Ryo TAKAISHI src/utils.lisp | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/src/utils.lisp b/src/utils.lisp index 536ea4a..57a29f8 100644 --- a/src/utils.lisp +++ b/src/utils.lisp @@ -12,7 +12,8 @@ If maybe-starts-with is a string. reverse it before testing against stack") (let ((does-it? (when (>= (length stack)(length list)) (loop :for cons on stack :for pair on list - :always (eql (car cons) (first pair)))))) + :always (eql (char-downcase (car cons)) + (char-downcase (first pair))))))) (when does-it? (values list (nthcdr (length list) stack))))) -- 1.7.8.rc1 From ryo.takaishi.0 at gmail.com Sun Jan 8 01:22:48 2012 From: ryo.takaishi.0 at gmail.com (Ryo Takaishi) Date: Sun, 8 Jan 2012 10:22:48 +0900 Subject: [cl-org-mode-devel] [PATCH] * src/cl-org-mode.lisp: Added support for link format. In-Reply-To: <1324565590-28855-1-git-send-email-ryo.takaishi.0@gmail.com> References: <1324565590-28855-1-git-send-email-ryo.takaishi.0@gmail.com> Message-ID: Hello, I created a banch "work-parse-link" for this patch at cl-net repository. Thanks, Ryo TAKAISHI On Thu, Dec 22, 2011 at 11:53 PM, Ryo TAKAISHI wrote: > It can parse "[[link]]" and "[[link][description]]". > --- > ?src/cl-org-mode.lisp | ? 60 ++++++++++++++++++++++++++++++++++++++++++++++++- > ?1 files changed, 58 insertions(+), 2 deletions(-) > > diff --git a/src/cl-org-mode.lisp b/src/cl-org-mode.lisp > index b24fdfc..653105f 100644 > --- a/src/cl-org-mode.lisp > +++ b/src/cl-org-mode.lisp > @@ -11,7 +11,10 @@ > > ?(defmethod node-dispatchers ((node org-node)) > ? (or *dispatchers* > - ? ? ?(mapcar #'make-instance '(src-node properties-node outline-node)))) > + ? ? ?(mapcar #'make-instance '(link-node > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?src-node > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?properties-node > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?outline-node)))) > > ?(defmethod node-prototypes (node) > ? (error "never call")) > @@ -246,4 +249,57 @@ then stick it in the default node" > ? ? ? ? ? ? ? ? (and (typep n 'property-node) > ? ? ? ? ? ? ? ? ? ? ?(equal (property-node.property n) key))) > ? ? ? ? ? ? ? (node.children node)))) > - ? ?(when node (property-node.value node)))) > \ No newline at end of file > + ? ?(when node (property-node.value node)))) > + > + > +(defclass link-node (org-parent-node) > + ? ? ((link :accessor node.link :initform nil :initarg :link) > + ? ? ?(description :accessor node.description :initform nil :initarg :description))) > + > +(defun at-link-node-p (stack) > + ?(let ((char (first stack)) > + ? ? ? ?(stack (rest stack))) > + ? ?(and (eql char #\[) > + ? ? ? ? (eql (first stack) #\[) > + ? ? ? ? (if (or (null (rest stack)) > + ? ? ? ? ? ? ? ? (second stack)) > + ? ? ? ? ? ? (values t (rest stack)) > + ? ? ? ? ? ? (at-link-node-p (cons char (rest stack))))))) > + > +(defmethod node-start ((node link-node) stack) > + ?(multiple-value-bind (pred old-stack) > + ? ? ?(at-link-node-p stack) > + ? ?(if pred > + ? ? ? ?(values > + ? ? ? ? (make-instance (class-of node)) > + ? ? ? ? old-stack)))) > + > +(defmethod node-end ((node link-node) (next-node link-node) stack) > + ?T) > + > +(defmethod node-end ((node link-node) (next-node text-node) stack) > + ?T) > + > +(defmethod finalize-node ((node link-node) next-node stack) > + ?(setf (node.next-node node) > + ? ? ? ?(if stack > + ? ? ? ? ? ?(make-default-node node next-node stack) > + ? ? ? ? ? ?next-node))) > + > +(defmethod read-next-node ((node link-node) (next-node null) stream) > + ?(let (text c) > + ? ?(loop for char = (read-char stream nil) > + ? ? ? ? ?:if (and (eql #\] char) > + ? ? ? ? ? ? ? ? ? (eql #\] (car text))) > + ? ? ? ? ?:do (if (eql (node.link node) nil) > + ? ? ? ? ? ? ? ? ?(setf (node.link node) (stack->string (cdr text))) > + ? ? ? ? ? ? ? ? ?(setf (node.description node) (stack->string (cdr text)))) > + ? ? ? ? ? ? ?(return) > + ? ? ? ? ?:if (and (eql #\[ char) > + ? ? ? ? ? ? ? ? ? (eql #\] (car text))) > + ? ? ? ? ?:do (setf (node.link node) (stack->string (cdr text))) > + ? ? ? ? ?(setf text nil) > + ? ? ? ? ?:else > + ? ? ? ? ?:do ;;(unread-char c stream) > + ? ? ? ? ? ? ?(push char text)) > + ? ?(call-next-method))) > -- > 1.7.8.rc1 > -- Ryo Takaishi