-
Notifications
You must be signed in to change notification settings - Fork 0
filetools.splicer
sikvelsigma edited this page Aug 20, 2022
·
2 revisions
- class
Splicer
Allows to add text block in file marked with "splice@:name" "/splice@:name" for insertion in file with a tag "insert@name"
from pyuseful.filetools.splicer import Splicer
splicer = Splicer()
# find tag block in a file
splicer.parse_segments("./doc_code/splicer_source.md")
# add a new segment manually
splicer.add_segment_manual("seg2", "manually added text2")
# make new file from with insert tags swapped with found block
splicer.splice_into("./doc_code/splicer_test.md", "./doc_code/splicer_test_res.md")
# can parse and splice multiple files, use 'parse_batch()' and 'splice_batch'