Skip to main content
added 728 characters in body
Source Link

In Elisp, I want to insert the contents of the "gazonk" JSON block into a variable.

#+name: gazonk
#+begin_src json
{
  xyzzy "
}
#+end_src

, but I just get "End of file during parsing"

#+BEGIN_SRC elisp :noweb yes
(setq example-data "<<gazonk>>")
#+END_SRC

Obviously, it's not valid JSON, but I want to insert the verbatim contents;)

EDIT: Here is a better example:

Here's valid JSON

#+name: gazonk
#+begin_src json
{
  "GivenName" : "Mortimer",
  "SurName" : "Smith",
  "NameSuffixText" : "Sr",
  "PreferredName" : "Morty",
}
#+end_src

Here's valid JSON, but enclosed, so not really valid;)

#+name: gazonk_enclosed
#+begin_src json
"
{
  "GivenName" : "Mortimer",
  "SurName" : "Smith",
  "NameSuffixText" : "Sr",
  "PreferredName" : "Morty",
}
"
#+end_src

This doesn't work with valid json

#+BEGIN_SRC elisp :results verbatim drawer :noweb yes
  (setq data <<gazonk>>)
#+END_SRC

, but this works

#+BEGIN_SRC elisp :results verbatim drawer :noweb yes
  (setq data <<gazonk_enclosed>>)
#+END_SRC

It's a general problem. I can't insert a code block into a variable, no matter what the language is. Here's XML:

#+name: fd7df9594ccfe7889b7e5817067733efc038967053e0ceb66b33bdc0ad7390d8
#+begin_src xml
<xml>
  <table>
    <rec id="1">
      <numField>123</numField>
      <stringField>String Value</stringField>
    </rec>
    <rec id="2">
      <numField>346</numField>
      <stringField>Text Value</stringField>
    </rec>
    <rec id="3">
      <numField>-23</numField>
      <stringField>stringValue</stringField>
    </rec>
  </table>
</xml>
#+end_src

#+BEGIN_SRC elisp :noweb yes
(setq example-data "<<fd7df9594ccfe7889b7e5817067733efc038967053e0ceb66b33bdc0ad7390d8>>")
#+END_SRC

In Elisp, I want to insert the contents of the "gazonk" JSON block into a variable.

#+name: gazonk
#+begin_src json
{
  xyzzy "
}
#+end_src

, but I just get "End of file during parsing"

#+BEGIN_SRC elisp :noweb yes
(setq example-data "<<gazonk>>")
#+END_SRC

Obviously, it's not valid JSON, but I want to insert the verbatim contents;)

EDIT: Here is a better example:

Here's valid JSON

#+name: gazonk
#+begin_src json
{
  "GivenName" : "Mortimer",
  "SurName" : "Smith",
  "NameSuffixText" : "Sr",
  "PreferredName" : "Morty",
}
#+end_src

Here's valid JSON, but enclosed, so not really valid;)

#+name: gazonk_enclosed
#+begin_src json
"
{
  "GivenName" : "Mortimer",
  "SurName" : "Smith",
  "NameSuffixText" : "Sr",
  "PreferredName" : "Morty",
}
"
#+end_src

This doesn't work with valid json

#+BEGIN_SRC elisp :results verbatim drawer :noweb yes
  (setq data <<gazonk>>)
#+END_SRC

, but this works

#+BEGIN_SRC elisp :results verbatim drawer :noweb yes
  (setq data <<gazonk_enclosed>>)
#+END_SRC

In Elisp, I want to insert the contents of the "gazonk" JSON block into a variable.

#+name: gazonk
#+begin_src json
{
  xyzzy "
}
#+end_src

, but I just get "End of file during parsing"

#+BEGIN_SRC elisp :noweb yes
(setq example-data "<<gazonk>>")
#+END_SRC

Obviously, it's not valid JSON, but I want to insert the verbatim contents;)

EDIT: Here is a better example:

Here's valid JSON

#+name: gazonk
#+begin_src json
{
  "GivenName" : "Mortimer",
  "SurName" : "Smith",
  "NameSuffixText" : "Sr",
  "PreferredName" : "Morty",
}
#+end_src

Here's valid JSON, but enclosed, so not really valid;)

#+name: gazonk_enclosed
#+begin_src json
"
{
  "GivenName" : "Mortimer",
  "SurName" : "Smith",
  "NameSuffixText" : "Sr",
  "PreferredName" : "Morty",
}
"
#+end_src

This doesn't work with valid json

#+BEGIN_SRC elisp :results verbatim drawer :noweb yes
  (setq data <<gazonk>>)
#+END_SRC

, but this works

#+BEGIN_SRC elisp :results verbatim drawer :noweb yes
  (setq data <<gazonk_enclosed>>)
#+END_SRC

It's a general problem. I can't insert a code block into a variable, no matter what the language is. Here's XML:

#+name: fd7df9594ccfe7889b7e5817067733efc038967053e0ceb66b33bdc0ad7390d8
#+begin_src xml
<xml>
  <table>
    <rec id="1">
      <numField>123</numField>
      <stringField>String Value</stringField>
    </rec>
    <rec id="2">
      <numField>346</numField>
      <stringField>Text Value</stringField>
    </rec>
    <rec id="3">
      <numField>-23</numField>
      <stringField>stringValue</stringField>
    </rec>
  </table>
</xml>
#+end_src

#+BEGIN_SRC elisp :noweb yes
(setq example-data "<<fd7df9594ccfe7889b7e5817067733efc038967053e0ceb66b33bdc0ad7390d8>>")
#+END_SRC

added 746 characters in body
Source Link

In Elisp, how can I insert aan org-babel JSON block into a variable with noweb?

In Elisp, I want to insert the contents of the "gazonk" JSON block into a variable.

#+name: gazonk
#+begin_src json
{
  xyzzy "
}
#+end_src

, but I just get "End of file during parsing"

#+BEGIN_SRC elisp :noweb yes
(setq example-data "<<gazonk>>")
#+END_SRC

Obviously, it's not valid elispJSON, but I want to insert the verbatim contents;)

EDIT: Here is a better example:

Here's valid JSON

#+name: gazonk
#+begin_src json
{
  "GivenName" : "Mortimer",
  "SurName" : "Smith",
  "NameSuffixText" : "Sr",
  "PreferredName" : "Morty",
}
#+end_src

Here's valid JSON, but enclosed, so not really valid;)

#+name: gazonk_enclosed
#+begin_src json
"
{
  "GivenName" : "Mortimer",
  "SurName" : "Smith",
  "NameSuffixText" : "Sr",
  "PreferredName" : "Morty",
}
"
#+end_src

This doesn't work with valid json

#+BEGIN_SRC elisp :results verbatim drawer :noweb yes
  (setq data <<gazonk>>)
#+END_SRC

, but this works

#+BEGIN_SRC elisp :results verbatim drawer :noweb yes
  (setq data <<gazonk_enclosed>>)
#+END_SRC

In Elisp, how can I insert a org-babel JSON block into a variable with noweb?

In Elisp, I want to insert the contents of the "gazonk" JSON block into a variable.

#+name: gazonk
#+begin_src json
{
  xyzzy "
}
#+end_src

, but I just get "End of file during parsing"

#+BEGIN_SRC elisp :noweb yes
(setq example-data "<<gazonk>>")
#+END_SRC

Obviously, it's not valid elisp, but I want to insert the verbatim contents;)

In Elisp, how can I insert an org-babel JSON block into a variable with noweb?

In Elisp, I want to insert the contents of the "gazonk" JSON block into a variable.

#+name: gazonk
#+begin_src json
{
  xyzzy "
}
#+end_src

, but I just get "End of file during parsing"

#+BEGIN_SRC elisp :noweb yes
(setq example-data "<<gazonk>>")
#+END_SRC

Obviously, it's not valid JSON, but I want to insert the verbatim contents;)

EDIT: Here is a better example:

Here's valid JSON

#+name: gazonk
#+begin_src json
{
  "GivenName" : "Mortimer",
  "SurName" : "Smith",
  "NameSuffixText" : "Sr",
  "PreferredName" : "Morty",
}
#+end_src

Here's valid JSON, but enclosed, so not really valid;)

#+name: gazonk_enclosed
#+begin_src json
"
{
  "GivenName" : "Mortimer",
  "SurName" : "Smith",
  "NameSuffixText" : "Sr",
  "PreferredName" : "Morty",
}
"
#+end_src

This doesn't work with valid json

#+BEGIN_SRC elisp :results verbatim drawer :noweb yes
  (setq data <<gazonk>>)
#+END_SRC

, but this works

#+BEGIN_SRC elisp :results verbatim drawer :noweb yes
  (setq data <<gazonk_enclosed>>)
#+END_SRC
Source Link

In Elisp, how can I insert a org-babel JSON block into a variable with noweb?

In Elisp, I want to insert the contents of the "gazonk" JSON block into a variable.

#+name: gazonk
#+begin_src json
{
  xyzzy "
}
#+end_src

, but I just get "End of file during parsing"

#+BEGIN_SRC elisp :noweb yes
(setq example-data "<<gazonk>>")
#+END_SRC

Obviously, it's not valid elisp, but I want to insert the verbatim contents;)