branch: externals/org-transclusion commit b6091cdcaaae712970d4b34ddea4c136f9c6ef7e Author: Noboru Ota <m...@nobiot.com> Commit: Noboru Ota <m...@nobiot.com>
doc: update manual for the new feature for live-sync org src block --- NEWS | 10 ++++++++++ docs/org-transclusion-manual.org | 5 ++++- test/python-1.py | 11 +++++++++++ test/python-2.py | 8 ++++++++ test/python-3.py | 6 ++++++ test/test-live-sync.org | 12 ++++++++++++ 6 files changed, 51 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 9e28ffd263..9fe7d840d1 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,14 @@ * Current development version + - feat: add org-block-live-sync + + - Command 'org-transclusion-live-sync-start' now can start live sync + when + + 1) transcluding a source code text file + 2) into org src block with the ':src' property in #+transclude + + Example: #+transclude: [[python-1.py]] :src python + - feat: add org-transclusion-detach - New command 'org-transclusion-detach' can be used on the transclusion diff --git a/docs/org-transclusion-manual.org b/docs/org-transclusion-manual.org index 72da9d5b36..b636cb8a7f 100644 --- a/docs/org-transclusion-manual.org +++ b/docs/org-transclusion-manual.org @@ -1,7 +1,7 @@ #+title: Org-transclusion User Manual #+author: Noboru Ota <m...@nobiot.com> #+macro: version 1.3.x -#+macro: modified 04 March 2023 +#+macro: modified 29 March 2023 #+language: en #+export_file_name: org-transclusion.texi @@ -419,6 +419,9 @@ The source block will have the additional properties: ,#+begin_src python :session :results value #+end_example +With since 2023-03-28 update, you can also use live-sync the source code +transcluded into src-block. + ** Transclude range of lines for text and source files :PROPERTIES: :CUSTOM_ID: transclude-range-of-lines-for-text-and-source-files diff --git a/test/python-1.py b/test/python-1.py new file mode 100644 index 0000000000..5aa2044ed5 --- /dev/null +++ b/test/python-1.py @@ -0,0 +1,11 @@ +import matplotlib +import matplotlib.pyplot as plt +# end here +# id-1234 +fig=plt.figure(figsize=(9,6)) +plt.plot([1,3,2]) +fig.tight_layout() +fname = 'pyfig2.png' +plt.savefig(fname) +# id-1234 end here +return fname # return this to org-mode diff --git a/test/python-2.py b/test/python-2.py new file mode 100644 index 0000000000..c5e29aabb3 --- /dev/null +++ b/test/python-2.py @@ -0,0 +1,8 @@ +def foo(x): + if x>0: + return x+1 + + else: + return x-1 + +return foo(5) diff --git a/test/python-3.py b/test/python-3.py new file mode 100644 index 0000000000..502d500580 --- /dev/null +++ b/test/python-3.py @@ -0,0 +1,6 @@ +import random +if random.randint(0,10) % 2 == 0: + ret = "even" +else: + ret = "odd" +ret diff --git a/test/test-live-sync.org b/test/test-live-sync.org new file mode 100644 index 0000000000..87eeced85f --- /dev/null +++ b/test/test-live-sync.org @@ -0,0 +1,12 @@ +#+transclude: [[file:test-src.org::code]] + +#+transclude: [[python-1.py]] :src python + +#+RESULTS: +[[./pyfig2.png]] + + +#+transclude: [[python-2.py]] :src python + +#+RESULTS: +: 6