From feb64766f178dbfd6f8a5bd034acd5ce287b05df Mon Sep 17 00:00:00 2001 From: Gabriel <172639817+gs-101@users.noreply.github.com> Date: Mon, 2 Sep 2024 21:37:27 -0300 Subject: [PATCH 1/3] feat: org python templates A basic python template, one contaning `value` as a `:result` option, and another with `output`. --- templates/org.eld | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/templates/org.eld b/templates/org.eld index 3a21ab1..801ec14 100644 --- a/templates/org.eld +++ b/templates/org.eld @@ -25,6 +25,12 @@ org-mode (format-time-string "%Y-%m-%d") n ":EXPORT_HUGO_DRAFT: false" n ":END:") (rdmecollapse "*** " (p "Heading") n "#+HTML:
" (p "sub-heading") " " n (r> "link or any comments") n n "#+HTML:
" n) +(python & "#+begin_src python" n r n "#+end_src" + :post (org-edit-src-code)) +(pythonvle & "#+begin_src python :results value" n r n "#+end_src" + :post (org-edit-src-code)) +(pythonotpt & "#+begin_src python :results output" n r n "#+end_src" + :post (org-edit-src-code)) ;; taken from https://github.com/minad/tempel/blob/5b09f612cfd805dba5e90bf06580583cab045499/README.org#template-file-format (cptn & "#+caption: ") From b49900d8bb453f39e273d671a715f56c6bdb5319 Mon Sep 17 00:00:00 2001 From: Gabriel <172639817+gs-101@users.noreply.github.com> Date: Tue, 3 Sep 2024 07:45:18 -0300 Subject: [PATCH 2/3] fix: shorten python to py_ This avoids any conflicts with auto-completion. --- templates/org.eld | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/org.eld b/templates/org.eld index 801ec14..b935005 100644 --- a/templates/org.eld +++ b/templates/org.eld @@ -25,11 +25,11 @@ org-mode (format-time-string "%Y-%m-%d") n ":EXPORT_HUGO_DRAFT: false" n ":END:") (rdmecollapse "*** " (p "Heading") n "#+HTML:
" (p "sub-heading") " " n (r> "link or any comments") n n "#+HTML:
" n) -(python & "#+begin_src python" n r n "#+end_src" +(py_ & "#+begin_src python" n r n "#+end_src" :post (org-edit-src-code)) -(pythonvle & "#+begin_src python :results value" n r n "#+end_src" +(py_vl & "#+begin_src python :results value" n r n "#+end_src" :post (org-edit-src-code)) -(pythonotpt & "#+begin_src python :results output" n r n "#+end_src" +(py_otpt & "#+begin_src python :results output" n r n "#+end_src" :post (org-edit-src-code)) ;; taken from https://github.com/minad/tempel/blob/5b09f612cfd805dba5e90bf06580583cab045499/README.org#template-file-format From 0821183fbfcd51b3c8739b6422e330c7f1f91026 Mon Sep 17 00:00:00 2001 From: Gabriel <172639817+gs-101@users.noreply.github.com> Date: Tue, 3 Sep 2024 08:07:45 -0300 Subject: [PATCH 3/3] style: move lines Now the templates are on line 22, under the GNU Plot one, grouping the `src` blocks together. --- templates/org.eld | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/templates/org.eld b/templates/org.eld index b935005..70f1d9a 100644 --- a/templates/org.eld +++ b/templates/org.eld @@ -19,18 +19,18 @@ org-mode :post (org-edit-src-code)) (gnplt & "#+begin_src gnuplot :var data=" (p "table") " :file " (p "plot.png") n r n "#+end_src" :post (org-edit-src-code)) -(vrs & "#+begin_verse" n> r> n> "#+end_verse") -(rdnly ":tangle yes :tangle-mode (identity #o444) :mkdirp yes" n) -(oxhugo & ":PROPERTIES:" n ":EXPORT_FILE_NAME: " (p "Simple Filename") n ":EXPORT_DATE: " - (format-time-string "%Y-%m-%d") n ":EXPORT_HUGO_DRAFT: false" n ":END:") -(rdmecollapse "*** " (p "Heading") n "#+HTML:
" (p "sub-heading") " " n - (r> "link or any comments") n n "#+HTML:
" n) (py_ & "#+begin_src python" n r n "#+end_src" :post (org-edit-src-code)) (py_vl & "#+begin_src python :results value" n r n "#+end_src" :post (org-edit-src-code)) (py_otpt & "#+begin_src python :results output" n r n "#+end_src" :post (org-edit-src-code)) +(vrs & "#+begin_verse" n> r> n> "#+end_verse") +(rdnly ":tangle yes :tangle-mode (identity #o444) :mkdirp yes" n) +(oxhugo & ":PROPERTIES:" n ":EXPORT_FILE_NAME: " (p "Simple Filename") n ":EXPORT_DATE: " + (format-time-string "%Y-%m-%d") n ":EXPORT_HUGO_DRAFT: false" n ":END:") +(rdmecollapse "*** " (p "Heading") n "#+HTML:
" (p "sub-heading") " " n + (r> "link or any comments") n n "#+HTML:
" n) ;; taken from https://github.com/minad/tempel/blob/5b09f612cfd805dba5e90bf06580583cab045499/README.org#template-file-format (cptn & "#+caption: ")