gjkerns / ob-julia

36 stars 25 forks source link

ob-julia, src block execution with extra newline characters from commentes at #+RESULTS: #8

Open sfmb-mx opened 7 years ago

sfmb-mx commented 7 years ago

How can we avoid this in literate analysis can be annoying for code like the example below:

#+begin_src julia :session :results output :exports all
  # reading:
  fname = "../data/example.dat"
  f1 = open(fname) # IOStream(<file example.dat>)

  data = readlines(f1)
  # 3-element Array{Union(ASCIIString,UTF8String),1}:
  #  "this is line 1.\r\n"
  #  "this is line 2.\r\n"
  #  "this is line 3."

  for line in data
      println(line)
      # process(line)
  end
  close(f1)
#+end_src

The exported results have this behavior:

#+RESULTS:
#+begin_example

"../data/example.dat"
IOStream(<file ../data/example.dat>)

3-element Array{String,1}:
 "this is line 1."
 "42; 3.14"
 "this is line 3."

this is line 1.
42; 3.14
this is line 3.
#+end_example

Any idea? Best regards!

fleimgruber commented 6 years ago

I had a shot at this, please see #14.