MartinPacker / mdpre

mdpre - Markdown Preprocessor
MIT License
8 stars 3 forks source link

Access global toFile without passing #3

Closed 42sol-eu closed 8 months ago

42sol-eu commented 4 years ago

the global variable toFile is accessed in line 25, 54 ... without passing it to the function. it is neither declared as global nor checked if it is opened.

Solutions?

MartinPacker commented 4 years ago

Do you want to do this one? If so please create a branch to work on.

42sol-eu commented 4 years ago

sure thing.

my idea would be to move toFile inside a class that also has the writeMarkdown() function.

that should not be invasive to the code.

MartinPacker commented 4 years ago

Sounds good to me.

42sol-eu commented 4 years ago

OK. I am having a chicken and egg problem with this.

There are three basic ways to do it:

This heavily moves stuff so it is hard to merge later!

Much less intrusive but a bit ugly in the writeMarkdown function.

A good measure to remove the lingering crash whilst keeping the code.

What would you prefer?

MartinPacker commented 4 years ago

The class way is best.

42sol-eu commented 4 years ago

OK. I will do my best not to break anything here. I love the class way the best too.

MartinPacker commented 8 months ago

This is lost in the mists of time. Closing. Reopen if still relevant.