Hello guest, if you read this it means you are not registered. Click here to register in a few simple steps, you will enjoy all features of our Forum.
Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
People Not Using Code Tags
(Dec-08-2017, 12:59 AM)metulburr Wrote:
Quote:is there a way to make it so that the in-browser editor automatically adds codes when, say, someone pastes three or more lines?
I think this would require a lot of code that we non PHP devs seem not to be able to implement. Although that would surely fix the problem. One method i think i could implement, would be to disallow the post if the condition is met. Condition being X amount of python keywords? Or indented space...but then some people dont even make sure their code is indented. Then it would show a message saying that code was detected and code tags (ie [ python ]) were not used with a link to BBcode in a new tab to instruct how to use them if they dont know how.

And yes it closely resembles the other case...but i know how to deny a post, and not how to auto implement code tags around suspected python code. Maybe @[stranac] might know more as he seems to be much better at PHP.

Pasting code is handled entirely by the editor itself, using javascript.
You're supposed to be able to easily extend the editor according to the docs, but I experimented with it when I was writing the code tags plugin, and every change I tried to make resulted in the editor completely ignoring all MyBB specific code.
I tried asking for help in a few places, but it didn't really get me anywhere...
metulburr and micseydel like this post
I'm not sure we will ever solve this problem, as was said, people just don't bother to read the links. They just paste the code. Even when you give the mod edit, with the link included, they usually ignore it. It seems it usually takes a couple of reply's to the effect of "Your code is useless, post it correctly." that it finally sinks in.
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
As stranac said, it would be Javascript and not PHP. (I know neither.) I imagine it would sometimes be annoying, but I think on-balance it would be worth it. Maybe we could even disable it after a certain post count. I imagine that could cover 80%+ of the false negatives, and false positives would be fairly uncommon and not a big deal.

If the community is down to run the experiment, but no one has the expertise, I might be able to find some time soon to give it a try. I don't think it's too complex - especially without the post-count check.
metulburr likes this post
oh yeah i forgot it was javascript.

Yeah i would be down with that. If it was able to shut off after X number of posts. Are you thinking denying the post, or searching out the code in the post and wrapping them in code tags automatically?
For the moment, I would keep it simple and seamless - no post denial. Auto-wrap any paste of >=3 lines. Nothing fancy. We could iterate on that later but I think it would be a net improvement.
Quote:Auto-wrap any paste of >=3 lines
You mean the entire post then?

I think it would limit the annoyance if it was restricted to General Coding Help and homework forums as that is where most of the new people post.
I wouldn't mind limiting it to a single forum or two as an initial experiment.

I was thinking of wrapping the entire contents of the pasted stuff. I don't expect people to paste their entire post. If that did happen, I would think of it as the lesser of two evils, and easier for a mod to fix and people who aren't mods to deal with before a mod comes along. I don't think that pasting necessitates wrapping the entire post, from a Javascript-implementation standpoint.
metulburr likes this post

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Just a trial. For learning code tags sylas 3 502 Sep-25-2017, 11:41 AM
Last Post: metulburr
  Weird Python tags syntax coloring bug micseydel 4 1,092 Jun-02-2017, 05:04 AM
Last Post: nilamo
  note moderator instead of mod tags metulburr 7 1,130 Apr-11-2017, 01:05 PM
Last Post: metulburr
  Please use code tags Larz60+ 28 3,383 Apr-06-2017, 09:47 PM
Last Post: metulburr
  Do not know how to add "Code Tags" or "Error Tags" to my submissions mattkrebs 2 578 Mar-21-2017, 04:15 PM
Last Post: metulburr
  Created a plugin for our code tags stranac 18 2,913 Dec-13-2016, 12:16 PM
Last Post: Kebap
  a few extra tags metulburr 2 1,007 Oct-05-2016, 09:22 AM
Last Post: Ofnuts

Forum Jump:

Users browsing this thread: 1 Guest(s)