I am looking for an easier way to copy user pasted code at this forum.
Currently we have to mouse select everything and hit ctrl+C.
If I click inside that code, and hit ctrl+A, it selects the entire page (chromium).
I wonder if it could have a download button to save it to a file, when pasting the code we could even specify a default filename btw. Also such filename could be guessed by the site engine based on the code class name if it provides one.
Adding to that we could download all pasted code in a zip file, for the entire forum thread.
Look here for examples of how I imagined it could be.
Jump to this post. By using Gist from GitHub, we can “kind of” do that.
PS.: this forum engine is marvelous, the way elements are positioned all around, and all its features, a very pleasant experience!
Note: as I recall that thread buries the only good way to post code to the forum… to use a line of three back ticks: ` (not single quotes but back ticks.) Followed by the code. Followed by another line of three back ticks.
The </> button is kind of broken. It does weird things to indenting and has some other problems that I can’t recall. I wish we could change the </> to do the back ticks.
Part of the issue is that the </> button is for generic pre-formatted text. ASCII art, etc should be just fine.
The following was done with the </> button, though. In simple cases, it works.
You can’t expect it to act like a word processor. I suspect that many hit the button, paste their text, and then are puzzled as to why it didn’t work like the italic control in libre office, etc.
@nehon I actually meant to download the code that some other user has pasted at the forum thread, as a .java text file (.txt if unidentifiable, could be .patch too).
I thought, instead of selecting and copying code from the forum thread manually, if we could download the code other user pasted by hitting a download button?
And, if the forum thread has several pasted codes by several users, we could hit yet another download button to download the entire thread user pasted codes in a single .zip file, In this case the organization could be like this:
the forum user name would be the TopFolderUName on the .zip file
the ForumThreadPostNumericId would be the sub folder name, like in: TopFolderUName/ForumThreadPostNumericId
the pasted code FancyClassName would be the final FancyClassName.java, like in: TopFolderUName/ForumThreadPostNumericId/FancyClassName.java. If it is not a whole class, it could receive an indexed simple name like code003.java.
The point I dont know is about use cases/scenarios, if there are so many threads with usable pasted code that could make this functionality really useful, or it would just be something needlessly complicated, even if interesting
PS.: btw, I just saw I can “download my posts” at my profile. That is not the kind of download I mean here, because that is not a code download easyfier, but a html formatted whole posts backup kind of, in csv format.
Unfortunately we cannot customize the forum software to this extent.
What I can think of is to use Gist to post your code (though it’s all in the poster’s hand).
You’ll have a preview of the code and you’ll be able to download it as a file, or multiple files in a zip directly on github.
I’ve done this before and had it strip all of the formatting out… extra lines, etc… Three ticks always works and you can even specify a language preference. It also works in lots of other places (other than this forum).
I don’t remember what the exact issue was but sometimes the “indent the code to make it look like code” thing just flat out breaks… even when using the button. Where as the 3 back ticks has always worked 100000% of the time.
Ergo, I don’t bother with the one that “might” work and always use the one that always works… and I wish that the button would too.