emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Myles English <mylesenglish@gmail.com>
To: emacs-orgmode Mode <emacs-orgmode@gnu.org>
Subject: how to print org-element of type paragraph as a string?
Date: Tue, 10 Dec 2013 00:23:55 +0000	[thread overview]
Message-ID: <CAO=Do-wq=E6LCugTca6Mc3NMNNRUE7hrxNF4xqTD5Cr5wO85Lg@mail.gmail.com> (raw)

Hello,

This should be an easy question for someone.  Given the org file
content below, how would you get the result or the source block to be
"here are the contents"?

Thanks,
Myles

* heading
here are the contents

#+begin_src elisp :results output
(dolist
      (job (org-element-map (org-element-parse-buffer) 'paragraph 'identity))
(print (car (org-element-contents job))))
#+end_src

#+RESULTS:
:
: #("here are the contents
: " 0 22 (:parent (paragraph (:begin 11 :end 34 :contents-begin 11
:contents-end 33 :post-blank 1 :post-affiliated 11 :parent (section
(:begin 11 :end 225 :contents-begin 11 :contents-end 224 :post-blank 1
:parent (headline (:raw-value "heading" :begin 1 :end 225 :pre-blank 0
:contents-begin 11 :contents-end 224 :level 1 :priority nil :tags nil
:todo-keyword nil :todo-type nil :post-blank 0 :footnote-section-p nil
:archivedp nil :commentedp nil :quotedp nil :CATEGORY nil :title
(#("heading" 0 7 (:parent #6))) :parent (org-data nil #6)) #4)) #2
(src-block (:language "elisp" :switches nil :parameters ":results
output" :begin 34 :end 207 :number-lines nil :preserve-indent nil
:retain-labels t :use-labels t :label-fmt nil :value "(dolist
:       (job (org-element-map (org-element-parse-buffer) 'paragraph 'identity))
: (print (car (org-element-contents job))))
: " :post-blank 1 :post-affiliated 34 :parent #4)) (fixed-width
(:begin 207 :end 224 :value "nil
: " :post-blank 0 :post-affiliated 218 :results ("") :parent #4)))) #0)))

             reply	other threads:[~2013-12-10  0:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-10  0:23 Myles English [this message]
2013-12-10  1:08 ` how to print org-element of type paragraph as a string? Nick Dokos

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='CAO=Do-wq=E6LCugTca6Mc3NMNNRUE7hrxNF4xqTD5Cr5wO85Lg@mail.gmail.com' \
    --to=mylesenglish@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).