Skip to content

Commit

Permalink
FEATURE : Fixed insert under.
Browse files Browse the repository at this point in the history
  • Loading branch information
crdoconnor committed Jan 1, 2024
1 parent 30cf27b commit 01f3370
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
19 changes: 19 additions & 0 deletions hitch/story/in.story
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,25 @@ Insert file:
This is a note generated by speech to text.
* DONE Done item

- orji:
env:
ORJITMP: ./tmp
cmd: in notetemplate.jinja2 under org/simple.org//0 --text speech.txt
output: |
Written note(s) successfully

- file contents:
filename: org/simple.org
contents: |
* Top note
** Subnote
** TODO Insert above, under or below, replace this
*** TODO New note
This is a note generated by speech to text.
** TODO New note
This is a note generated by speech to text.
* DONE Done item


Replace:
steps:
Expand Down
10 changes: 5 additions & 5 deletions orji/insert.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ def insert(jinjafile, relative, location, textfile):
note.demote()
elif relative == "under":
for note in chunk_to_insert.root.children:
write_note._node.add_child(note)
note.sibling = write_note._node
note.demote()
note.sibling = write_note._node
note.demote()
write_note._node.parent.add_child(note)

for _ in range(write_note._node.level):
note.sibling = write_note._node
note.demote()
elif relative == "replace":
for note in chunk_to_insert.root.children:
write_note._node.sibling.add_child(note)
Expand Down

0 comments on commit 01f3370

Please sign in to comment.