emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <n.goaziou@gmail.com>
To: Aaron Ecay <aaronecay@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [RFC] [PATCH] [parser] org-element.el: Handle block parameters
Date: Tue, 29 Oct 2013 09:20:21 +0100	[thread overview]
Message-ID: <878uxca3p6.fsf@gmail.com> (raw)
In-Reply-To: <1382987074-19223-1-git-send-email-aaronecay@gmail.com> (Aaron Ecay's message of "Mon, 28 Oct 2013 15:04:34 -0400")

Hello,

Aaron Ecay <aaronecay@gmail.com> 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

  reply	other threads:[~2013-10-29  8:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-28 19:04 [RFC] [PATCH] [parser] org-element.el: Handle block parameters Aaron Ecay
2013-10-29  8:20 ` Nicolas Goaziou [this message]
2013-10-30  4:28   ` Aaron Ecay
2013-10-30  8:01     ` Nicolas Goaziou
2013-10-30 22:23       ` Aaron Ecay
2013-10-31 11:00         ` Nicolas Goaziou
2013-10-31 18:15           ` Aaron Ecay
2013-10-31 19:08             ` Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878uxca3p6.fsf@gmail.com \
    --to=n.goaziou@gmail.com \
    --cc=aaronecay@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).