* org-babel-tangle xml text
@ 2009-11-03 15:16 "Martin G. Skjæveland"
2009-11-03 16:18 ` Eric Schulte
0 siblings, 1 reply; 2+ messages in thread
From: "Martin G. Skjæveland" @ 2009-11-03 15:16 UTC (permalink / raw)
To: emacs-orgmode
Hi all,
I am quite new to the wonderful world of org-mode and org-babel. Right
now I am using org-mode to make exercises for a semantic web programming
course. org-mode and its friends give me a efficient writing tool, a
presentation tool, export for web, export for print and a literate
programming tool. That's nice!
But I have a question. I would like to include many code snippets
written in RDF (XML/RDF, N3), which are languages not supported by
org-babel [1], in my document, and I would like to use the "Edit the
source code example at point in its native mode"-feature of org-mode and
the tangle-feature of org-babel. Now I'm specifying the language as css
(see below) since it is supported by org-babel and does not add any
comments to output. This works for "tangling", but not for native editing.
Is there a way I can add xml and n3 to the list of supported languages?
These languages does not need interpretation, so I'm thinking it should
be quite easy to add. I have fumblingly tried
(add-to-list 'org-babel-tangle-langs '("xml"))
and
(add-to-list 'org-babel-tangle-langs '("css" "xml"))
but it as no effect.
Below is a sample of what I am currently using. Running org-babel-tangle
gives me the correct foaf.rdf file. I would like to swap 'css' with
'xml' so that the code can be edited and understood as xml.
#+SRCNAME: foaf-main
#+BEGIN_SRC css :tangle foaf.rdf
<rdf:RDF>
<<foaf-rel>>
</rdf:RDF>
#+END_SRC
#+SRCNAME: foaf-rel
#+BEGIN_SRC css :tangle no
<foaf:knows>
<foaf:Person rdf:ID="timbl">
</foaf:knows>
#+END_SRC
I hope this was clear -- and that someone can help.
Thanks!
Martin
[1]
http://orgmode.org/worg/org-contrib/babel/org-babel.php#reference-and-documentation
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: org-babel-tangle xml text
2009-11-03 15:16 org-babel-tangle xml text "Martin G. Skjæveland"
@ 2009-11-03 16:18 ` Eric Schulte
0 siblings, 0 replies; 2+ messages in thread
From: Eric Schulte @ 2009-11-03 16:18 UTC (permalink / raw)
To: Martin G. Skjæveland; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 630 bytes --]
"Martin G. Skjæveland" <martige@ifi.uio.no> writes:
> Is there a way I can add xml and n3 to the list of supported
> languages? These languages does not need interpretation, so I'm
> thinking it should be quite easy to add. I have fumblingly tried
>
> (add-to-list 'org-babel-tangle-langs '("xml"))
>
> and
>
> (add-to-list 'org-babel-tangle-langs '("css" "xml"))
>
> but it as no effect.
>
Hi Martin,
The attached org-mode file contains instructions for adding xml and n3
to org-babel and org-babel-tangle. Note that there may be another step
if the major mode for n3 is not n3-mode. Best -- Eric
[-- Attachment #2: xml-and-n3.org --]
[-- Type: text/plain, Size: 738 bytes --]
* xml and n3
introduce org-babel to =xml= and =n3=
#+begin_src emacs-lisp :results silent
(org-babel-add-interpreter "xml")
(org-babel-add-interpreter "n3")
#+end_src
if say =n3= should be edited using =xml-mode=, then evaluate the
following adding this pair to =org-src-lang-modes=
#+begin_src emacs-lisp :results silent
(add-to-list 'org-src-lang-modes '("n3" . xml))
#+end_src
inform org-babel-tangle of their existence and file extensions
#+begin_src emacs-lisp :results silent
(add-to-list 'org-babel-tangle-langs '("xml" "xml" nil t))
(add-to-list 'org-babel-tangle-langs '("n3" "n3" nil t))
#+end_src
#+begin_src xml :tangle example
<first>
</first>
#+end_src
#+begin_src n3 :tangle example
n3 stuff
#+end_src
[-- Attachment #3: Type: text/plain, Size: 204 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-11-03 16:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-03 15:16 org-babel-tangle xml text "Martin G. Skjæveland"
2009-11-03 16:18 ` Eric Schulte
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.