Repository: PumasAI/QuartoNotebookRunner.jl (julia)

Issue:
Expanded cells don't use correct source code
Just noticed this, the example from `cell_expansion.qmd` in the tests broke at some point because we didn't test for exact source content. The cell is 

````
```{julia}
#| echo: false
#| expand: true
[(;
    thunk = function ()
        println("print call")
        display("display call")
        "return value"
    end,
    code = """
    # Fake code goes here.
    """,
    options = Dict("layout-ncol" => 2),
)]
```
````

But the resulting expanded cell has the original source code, not the "Fake code goes here":

```
{
            "id": "2_1",
            "cell_type": "code",
            "metadata": {
            },
            "source": [
                "#| layout-ncol: 2\n",
                "#| echo: false\n",
                "#| expand: true\n",
                "[(;\n",
                "    thunk = function ()\n",
                "        println(\"print call\")\n",
                "        display(\"display call\")\n",
                "        \"return value\"\n",
                "    end,\n",
                "    code = \"\"\"\n",
                "    # Fake code goes here.\n",
                "    \"\"\",\n",
                "    options = Dict(\"layout-ncol\" => 2),\n",
                ")]"
            ],
```

Pull request description:
Fixes #113

Patch:
diff --git a/src/server.jl b/src/server.jl
index b4a0a85f..942713ad 100644
--- a/src/server.jl
+++ b/src/server.jl
@@ -767,13 +767,15 @@ function evaluate_raw_cells!(
                         cell_options["echo"] = false
                     end
 
+                    source = expand_cell ? remote.code : chunk.source
+
                     push!(
                         cells,
                         (;
                             id = expand_cell ? string(nth, "_", mth) : string(nth),
                             cell_type = chunk.type,
                             metadata = (;),
-                            source = process_cell_source(chunk.source, cell_options),
+                            source = process_cell_source(source, cell_options),
                             outputs,
                             execution_count = 1,
                         ),


Test patch:
diff --git a/test/testsets/cell_expansion.jl b/test/testsets/cell_expansion.jl
index b20e8c81..176b7524 100644
--- a/test/testsets/cell_expansion.jl
+++ b/test/testsets/cell_expansion.jl
@@ -31,7 +31,8 @@ test_example(joinpath(@__DIR__, "../examples/cell_expansion.qmd")) do json
     @test output["data"]["text/plain"] == "\"return value\""
 
     source = cell["source"]
-    @test any(line -> contains(line, "#| layout-ncol: 2"), source)
+    @test source[1] == "#| layout-ncol: 2\n"
+    @test source[2] == "# Fake code goes here."
 
     cell = json["cells"][5]
     @test cell["cell_type"] == "code"