Add 'Open in editor' button for runnable code examples#1669
Add 'Open in editor' button for runnable code examples#1669dlang-bot merged 8 commits intodlang:masterfrom
Conversation
I just took the liberty to merge the respective PR and thus this is ready to be shipped :) CC @ZombineDev @CyberShadow @andralex @stonemaster @s-ludwig (I also added a commit to make the resulting generated example code look a bit nice). |
|
The obvious question is what does this add in addition to the existing "Edit" button? Opening the code on a separate page with no other clutter? Also, an observation: with this change, there is now an "Edit" button and "Open in editor" button, which is a bit superfluous. How about moving the latter to the button row that's displayed after you click "Edit"? |
This was one of the first feature request when this was first announced on the NG.
Hmm, I get your point, but the idea was to help people who don't want to edit their code inline on dlang.org (and might not realize that there's an "edit on external site" button in the edit mode). |
This feature needs work - for one, the effect of the "Export" button is not obvious, for two, the URLs generated are gargantuan and not suitable for actual sharing. It could either use what godbolt's compiler explorer does (integrate a third-party URL shortener) or save/generate short URLs itself.
No reason these can't be features of the inline editor as well.
A problem in the implementation should not serve as a reason for changing the UI!
Not sure if I made it sufficiently clear. If you were to swap the labels of the two buttons, they would both remain technically correct. "Edit inline" and "Edit on separate page" would be an improvement in that area but clumsy overall. Generally, I am really frustrated how many similar services we have with overlapping functionality. What we need is a single service on a single domain which has compilation, execution, disassembly, and sharing. Currently, the DPaste frontend is an unholy bloated abomination with features nobody wants, such as user account registration and two CAPTCHAs. IMO, the frontend should just be rewritten from scratch - with the feature set we actually need, reimplementing it should not take much effort. So, I'm hesitant about UI changes which further cement this fragmentation, and I would suggest to instead spend time to consolidate these services. Let me know if you need access to the DPaste accounts. |
Fair point.
Maintaining dlang.org is already painful enough :S
Hehe, btw that's also I reason why I experimented with replacing DPaste as backend with the DLang-Tour:
Okay understood, but I am interested on feedback/ideas from other people before starting to change this.
Hmm, I am not really interested in maintaining yet another service, sorry. My point was that I already maintain the Tour, which has a D execution backend and which can be - with little effort - be used as an editor as well. |
If these features were factored into a properly encapsulated JavaScript library then it should not have been difficult to add them to any website.
Well, "good enough" is the enemy of better, and we have been entrenching ourselves deeper and deeper into technical debt on many fronts across our entire infrastructure. At some point we are going to need to start saying "no" to further improvements which increase complexity and inter-dependencies in exchange for small benefits. |
|
Thanks for your pull request, @wilzbach! We are looking forward to reviewing it, and you should be hearing from a maintainer soon. Some tips to help speed things up:
Bear in mind that large or tricky changes may require multiple rounds of review and revision. Please see CONTRIBUTING.md for more information. Bugzilla references
|
|
@CyberShadow I found 17560 on Bugzilla. As predicted newbies have a hard time realizing that they need to import the current module (and maybe |
|
I don't feel comfortable merging hacks that compensate for the inadequacy of our previous hacks. The first step of solving technical debt is to begin saying 'no' to quick fixes that entrench us deeper into technical debt. |
That's not what I asked ;-) |
|
Fix Issue 17560 - Enhancement: view and copy full code example for offline compile/play
The question was whether we should add
Btw I just saw the example on https://www.rust-lang.org: Two note-worthy points:
|
Sounds fine by itself (not accounting for other blockers)
Should I interpret that as you openly stating on record that you have a conflict of interest that is preventing you from contributing to dlang.org in an unbiased manner? :) TBH I don't care what language or backend DPaste uses - it may very well be a 100-line vibe.d or PHP app with a simplistic database that uses the Tour backend, or a Tour page with some CSS on it to make it generic and non-specific to the tour. Still doesn't change that the fragmentation and technical debt is hurting us.
Nice. Can we use fa-external-link here?
Um. They have a "shorten" button. Which was the first option I proposed. |
Sure. We could even use FontAwesome icons for all buttons, e.g:
Hehe my points was more IIRC the D Language Foundation is already paying for the server of tour.dlang.org (I don't know details, but the instance has 4GB).
It's about dpaste.dzfl.pl - not dlang.org ;-)
I thought you didn't like the long redirect URLs?
Adding new features to a vibe.d app is fun, it isn't for PHP ;-) |
Looks great!
We need to remove features, not add them. As I said, all that's needed is running and saving D code. |
Heh, I meant instead of the "Edit (external)" label. That would avoid stuttering. Maybe with "float: right". What do you think? If you'd like to keep the icons on the other buttons, what do you think of putting them in front of the text? That seems more natural/common to me. |
Roughly like this?
I am not a designer, but I think we either go without buttons or with buttons for all actions - in-between looks a bit weird.
It was just an experiment. No hard feelings.
(this PR now contains this) |
|
Thanks! I'm not sure if you find all of my suggestions agreeable or if I'm being overly imposing with them :) |
9d06915 to
40af0a6
Compare
Sorry entirely forgot to post screenshots - forgot to press on "Comment"...
That's how we do it on the front page as well. I forgot about the "Edit" page, hence the editing of the last commit, but I think we are all set now: |
Hehe, I think it greatly helps to create a better end result and that's what matters ;-) |
|
Awesome possum. Thanks! |















As I have waited for DPaste to add this feature for more than a year, I decided that it can't be too difficult to add to the Dlang-Tour.
This depends on a PR at the dlang-tour: dlang-tour/core#524