readFile¶
-
EditFrontMatter.
readFile
(file_path=None, *args, **kwargs) → None[source]¶ - Read a file into
file_lines
list (if applicable) and seperate the front matter into
fmatter
yaml object. This function resetsfmatter
.
- Parameters
file_path (str) – optional file path
Hint
If local file_path:None and
file_path
:None,file_lines
should be populated before calling this function.In the example below, the initialization would fail if do_readFile:True:
proc = EditFrontMatter(do_readFile=False) proc.file_lines = ''.join(open(RUN_PATH + "example.md", "r").readlines()) # initialize proc.fmatter and record data position proc.readFile() ...
Note
If the file source content is empty
file_empty
is set to True. This affectsdumpFileData()
andwriteFile()
behavior- Read a file into