Skip to content

Commit 1555d22

Browse files
DavidLiedleclaude
andcommitted
Fix: remove 29 orphaned #+end_src tags leaking as visible text
When a markdown code block demonstrated org #+end_src syntax, the md→org converter consumed that #+end_src as the block's closing tag, leaving the real closing tag as a stray #+end_src outside any block. fix_org_blocks.py then made things worse by leaving it unmatched. Affected: ch03 (1), ch11 (24), ch12 (1), ch13 (3). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent cdbee83 commit 1555d22

File tree

4 files changed

+0
-29
lines changed

4 files changed

+0
-29
lines changed

03-document-structure.org

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,6 @@ def fibonacci(n):
240240
return n
241241
return fibonacci(n-1) + fibonacci(n-2)
242242
#+end_example
243-
#+end_src
244243

245244
We'll dive deep into code blocks in Chapter 11 (spoiler: they're executable).
246245

11-code-blocks-literate-programming.org

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ We've seen this syntax:
1818
def hello():
1919
print("Hello from Org-Mode!")
2020
#+end_example
21-
#+end_src
2221

2322
But here's the magic. Put cursor in the block and press =C-c C-c=:
2423

@@ -97,7 +96,6 @@ print("Line 1")
9796
print("Line 2")
9897
print("Line 3")
9998
#+end_example
100-
#+end_src
10199

102100
Execute with =C-c C-c=:
103101

@@ -147,7 +145,6 @@ x = 42
147145
#+BEGIN_SRC python
148146
print(x) # Error: x not defined
149147
#+END_SRC
150-
#+end_src
151148

152149
With sessions, state persists:
153150

@@ -159,7 +156,6 @@ x = 42
159156
#+BEGIN_SRC python :session
160157
print(x) # Works! Outputs: 42
161158
#+END_SRC
162-
#+end_src
163159

164160
Same Python interpreter, same namespace. Variables, functions, imports—all persist.
165161

@@ -173,7 +169,6 @@ x = 1
173169
#+BEGIN_SRC python :session project-b
174170
x = 2
175171
#+END_SRC
176-
#+end_src
177172

178173
Separate environments, same document.
179174

@@ -188,7 +183,6 @@ print(f"{name} is {age} years old")
188183

189184
#+RESULTS:
190185
: Alice is 30 years old
191-
#+end_src
192186

193187
** Variables from Tables
194188

@@ -210,7 +204,6 @@ print(df.sum(numeric_only=True))
210204
: Q2 40
211205
: Q3 42
212206
: Q4 46
213-
#+end_src
214207

215208
Table becomes 2D list. Process with any language.
216209

@@ -228,7 +221,6 @@ print(sum(numbers))
228221

229222
#+RESULTS:
230223
: 15
231-
#+end_src
232224

233225
Chain blocks together. One block's output feeds another's input.
234226

@@ -252,7 +244,6 @@ return [
252244
| Alice | 28 | Portland |
253245
| Bob | 35 | Seattle |
254246
| Carol | 42 | Vancouver |
255-
#+end_src
256247

257248
Generate org tables from code. Add formulas. Instant data reports.
258249

@@ -276,7 +267,6 @@ return 'sine.png'
276267

277268
#+RESULTS:
278269
[[file:sine.png]]
279-
#+end_src
280270

281271
The plot appears in your document. Update code, re-execute, plot updates.
282272

@@ -286,7 +276,6 @@ With R:
286276
#+BEGIN_SRC R :results graphics file :file plot.png
287277
plot(cars)
288278
#+end_example
289-
#+end_src
290279

291280
With gnuplot, ditaa, graphviz—dozens of options.
292281

@@ -351,7 +340,6 @@ print(f"Recursive: {result1} in {time1:.4f}s")
351340
print(f"Iterative: {result2} in {time2:.6f}s")
352341
print(f"Speedup: {time1/time2:.0f}x")
353342
#+END_SRC
354-
#+end_src
355343

356344
Code, explanation, tests, benchmarks—all in one document. Export to PDF for sharing, execute for verification.
357345

@@ -373,7 +361,6 @@ def fibonacci(n):
373361
if __name__ == "__main__":
374362
print([fibonacci(i) for i in range(10)])
375363
#+end_example
376-
#+end_src
377364

378365
Run =M-x org-babel-tangle= or =C-c C-v t=. Org extracts code to =fib.py=.
379366

@@ -395,7 +382,6 @@ def main():
395382
if __name__ == "__main__":
396383
main()
397384
#+END_SRC
398-
#+end_src
399385

400386
Tangle creates =program.py= with all blocks combined in order.
401387

@@ -427,7 +413,6 @@ def main():
427413
if __name__ == "__main__":
428414
main()
429415
#+END_SRC
430-
#+end_src
431416

432417
=<<blockname>>= inserts that block's content. Compose programs from pieces.
433418

@@ -458,7 +443,6 @@ SELECT name, age FROM users WHERE age > 25;
458443
| Alice | 28 |
459444
| Bob | 35 |
460445
| Carol | 42 |
461-
#+end_src
462446

463447
Results as org tables. Add formulas, analyze data.
464448

@@ -468,7 +452,6 @@ With PostgreSQL:
468452
#+BEGIN_SRC sql :engine postgresql :database mydb :user myuser
469453
SELECT * FROM orders WHERE status = 'pending';
470454
#+end_example
471-
#+end_src
472455

473456
Your documentation queries production databases. Be careful, but powerful.
474457

@@ -485,7 +468,6 @@ ls -la ~/org | head -10
485468
: drwxr-xr-x+ 87 user staff 2784 Jan 15 09:15 ..
486469
: -rw-r--r-- 1 user staff 2048 Jan 14 15:20 inbox.org
487470
: ...
488-
#+end_src
489471

490472
Document system administration with executable examples.
491473

@@ -496,14 +478,12 @@ Document system administration with executable examples.
496478
#+BEGIN_SRC shell :dir ~/projects/myapp
497479
ls
498480
#+end_example
499-
#+end_src
500481

501482
*:file* - Output file:
502483
#+begin_example
503484
#+BEGIN_SRC dot :file diagram.png
504485
digraph { A -> B; B -> C; }
505486
#+end_example
506-
#+end_src
507487

508488
*:cache* - Cache results:
509489
#+begin_example
@@ -513,7 +493,6 @@ import time
513493
time.sleep(5)
514494
return "Done"
515495
#+end_example
516-
#+end_src
517496

518497
Re-run only if code changes.
519498

@@ -522,15 +501,13 @@ Re-run only if code changes.
522501
#+BEGIN_SRC shell :cmdline -n 5
523502
head
524503
#+end_example
525-
#+end_src
526504

527505
*:stdin* - Provide input:
528506
#+begin_example
529507
#+BEGIN_SRC python :stdin example-data
530508
import sys
531509
print(sys.stdin.read().upper())
532510
#+end_example
533-
#+end_src
534511

535512
* Document-Wide Defaults
536513

@@ -554,7 +531,6 @@ Per-subtree:
554531
#+BEGIN_SRC python
555532
print("Uses :session py :results output")
556533
#+end_example
557-
#+end_src
558534

559535
* Reproducible Research
560536

12-export-publishing.org

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,6 @@ Remember =:exports= from Chapter 11?
330330
#+BEGIN_SRC python :exports both
331331
print("Hello!")
332332
#+end_example
333-
#+end_src
334333

335334
- =:exports code= - Show only code in export
336335
- =:exports results= - Show only output

13-advanced-features.org

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ Execute code on remote machines:
154154
#+BEGIN_SRC shell :dir /ssh:user@remote:/path/to/dir
155155
ls -la
156156
#+end_example
157-
#+end_src
158157

159158
Tramp integration. Document remote operations.
160159

@@ -176,7 +175,6 @@ return [[item['name'], item['value']] for item in parsed['items']]
176175
#+BEGIN_SRC R :var dataset=previous-block
177176
plot(dataset)
178177
#+END_SRC
179-
#+end_src
180178

181179
Fetch with shell → Parse with Python → Visualize with R. All in one document.
182180

@@ -199,7 +197,6 @@ assert calculate_tax(0) == 0
199197
assert calculate_tax(50) == 10
200198
print("All tests passed!")
201199
#+END_SRC
202-
#+end_src
203200

204201
Tests live with documentation. Update function → re-run tests.
205202

0 commit comments

Comments
 (0)