[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] [RFC] [PATCH] [parser] org-element.el: Handle block parameters
From: |
Nicolas Goaziou |
Subject: |
Re: [O] [RFC] [PATCH] [parser] org-element.el: Handle block parameters |
Date: |
Tue, 29 Oct 2013 09:20:21 +0100 |
Hello,
Aaron Ecay <address@hidden> writes:
Thanks for the patch.
> This brings the parser in line with the Org Syntax as documented on
> Worg: <http://orgmode.org/worg/dev/org-syntax.html#Greater_Blocks>.
Besides this reason (which could also be solved by updating Org Syntax
document), do you have a need for this extension?
> This does not handle paramters for export blocks (#+begin_latex et
> al.) or comment blocks, but these would be trivial to add if needed.
Syntax for parameters is different for these blocks, and is already
handled.
Now some comments about the code.
> + (params (progn (looking-at "[ \t]*#\\+BEGIN_CENTER\\(?:
> +\\(.*\\)\\)?")
I suggest changing the regexp into
"[ \t]*#\\+BEGIN_CENTER\\(?: +\\(.*\\)[ \t]*\\)?"
in order to trim parameters, if any.
> + (match-string 1)))
It's better to use `org-match-string-no-properties' since you don't need
properties.
> + (format "#+BEGIN_CENTER%s\n%s#+END_CENTER"
> + (if (org-element-property :parameters center-block)
> + (concat " " (org-element-property :parameters center-block))
> + "")
> + contents))
A `let' would be nicer.
(let ((parameters (org-element-property :parameters center-block)))
(if parameters (concat " " parameters) ""))
> + (params (progn (looking-at "[ \t]*#\\+BEGIN_QUOTE\\(?:
> +\\(.*\\)\\)?")
> + (match-string 1)))
Ditto.
> + (format "#+BEGIN_QUOTE%s\n%s#+END_QUOTE"
> + (if (org-element-property :parameters quote-block)
> + (concat " " (org-element-property :parameters quote-block))
> + "")
Ditto
> + (type (progn (looking-at "[ \t]*#\\+BEGIN_\\(\\S-+\\)\\(?:
> +\\(.*\\)\\)?")
> + (upcase (match-string-no-properties 1))))
Ditto.
> + (params (match-string-no-properties 2)))
Use `org-match-string-no-properties' here, for compatibility with XEmacs.
> + (format "#+BEGIN_%s%s\n%s#+END_%s"
> + block-type
> + (if (org-element-property :parameters special-block)
> + (concat " " (org-element-property :parameters special-block))
> + "")
See above.
> + (params (progn (looking-at "[ \t]*#\\+BEGIN_VERSE\\(?:
> +\\(.*\\)\\)?")
> + (match-string 1)))
See above.
> + (format "#+BEGIN_VERSE%s\n%s#+END_VERSE"
> + (if (org-element-property :parameters verse-block)
> + (concat " " (org-element-property :parameters verse-block))
> + "")
See above.
Regards,
--
Nicolas Goaziou
- [O] [RFC] [PATCH] [parser] org-element.el: Handle block parameters, Aaron Ecay, 2013/10/28
- Re: [O] [RFC] [PATCH] [parser] org-element.el: Handle block parameters,
Nicolas Goaziou <=
- Re: [O] [RFC] [PATCH] [parser] org-element.el: Handle block parameters, Aaron Ecay, 2013/10/30
- Re: [O] [RFC] [PATCH] [parser] org-element.el: Handle block parameters, Nicolas Goaziou, 2013/10/30
- Re: [O] [RFC] [PATCH] [parser] org-element.el: Handle block parameters, Aaron Ecay, 2013/10/30
- Re: [O] [RFC] [PATCH] [parser] org-element.el: Handle block parameters, Nicolas Goaziou, 2013/10/31
- Re: [O] [RFC] [PATCH] [parser] org-element.el: Handle block parameters, Aaron Ecay, 2013/10/31
- Re: [O] [RFC] [PATCH] [parser] org-element.el: Handle block parameters, Nicolas Goaziou, 2013/10/31