News:

Wondering if this will always be free?  See why free is better.

Main Menu

How can I download codeblocks?

Started by lambdacoresw, May 16, 2024, 05:53:43 AM

Previous topic - Next topic

lambdacoresw

Hi,
I want to download the sections I wrote between `[ code ] ... [ /code ]` tags as a file. For example, when I write Python code between these tags, I want to download it as `<file_name>.py`. Is such a thing possible? If so, can you provide information on how to do it?

Aleksi "Lex" Kilpinen

Copy and paste?  ::) It's not a file, it's just text, unless you decide to make it a file.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

lambdacoresw

Thanks for your reply.
Yes, I'm already doing it that way, but I was wondering if there is another way to make it a bit easier.

Aleksi "Lex" Kilpinen

I'm sure it would be possible, but would require custom coding. It would however (in my opinion) easily be overengineering what is essentially a simple copy operation. You would need to figure out what block you need, how to save it, how to name it, and how to serve it to the user. You could open a topic in Mod Requests if you want.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

lambdacoresw

In each `[ code ] ... [ /code]` block, there could be a standard download button, and when clicked, it could download by default as `program.py`. Later, it would be up to the user to rename it.

So.. Thanks again.

Advertisement: