Skip to content

filetools.splicer

sikvelsigma edited this page Aug 20, 2022 · 2 revisions

Summery

  • class Splicer

Allows to add text block in file marked with "splice@:name" "/splice@:name" for insertion in file with a tag "insert@name"

Contains

Splicer

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'

Clone this wiki locally