Using code in submissions

Using code in submissions

بواسطة - Loren Winfrey
عدد الردود: 14

I am teaching a html course where the students are sending me code in the forums and journal, This code is disturbing the display of the pages. We of course work in a mac enviroment so the html editor don't work in the browser,

Is there a way to have a script remove those charecters from thier postings? Or am I just dreaming?

Loren Winfrey

متوسط التقييمات: -
رداً على Loren Winfrey

Re: Using code in submissions

بواسطة - Paula Edmiston
"replace all occurrences of the left pointy bracket (<) with the actual code that renders as the left pointy bracket. as in "replace all occurances of < with &lt;"

The really nice thing is being able to create macros for all kinds of shortcuts and having colored text to highlight specific commands and tags.

When I'm preparing something like code displays in a web page I usually write the whole message in my favorite text editor, Textpad. It's shareware; try it out and if you like like it pay some money (not a lot). There are lots of great editors for writing code. OOps ... that's a windows program and I see it's not available for Macs. I went over to http://shareware.com and searched for 'editor' in the Mac section and there's BBedit (there's a 'lite' version for free, not sure how good it is)! I've heard it's a real programming editor for Macs. The nice thing about these specialized editors is that you can create macros to do things like replace the left pointy bracket (<) with code that renders as the bracket ... as in

replace all occurances of < with &lt;

You can see some code I rendered over at the General developer forum

The really nice thing is being able to create macros for all kinds of shortcuts and having colored text to highlight specific commands and tags.

رداً على Paula Edmiston

Re: Using code in submissions

بواسطة - Loren Winfrey

I understand how to use the charecters to display the code, what I am looking for is something that can replace it after it is submited. This way my students don't get anymore confused... I tried to show them the code for the  <> and thier eye's rolled up into thier heads...

Thanks for the help.

Loren

رداً على Loren Winfrey

Re: Using code in submissions

بواسطة - Martin Dougiamas
صورة Core developers صورة Documentation writers صورة Moodle HQ صورة Particularly helpful Moodlers صورة Plugin developers صورة Testers
The difficulty is that sometimes we want tags to work as HTML, but sometimes we want to show the <font color=red>source</font>.

I think the ideal solution here would be a modification to the formatting parser that understands <code></code> tags and converts everything between them into plain-formatted text. How does that sound?
رداً على Martin Dougiamas

Re: Using code in submissions

بواسطة - Loren Winfrey
Most wonderful. If there would be a way to switch it on and off would be nice. Ya see, I work on a mac and the applets disagree with my browser حزين.

Is this type of thing difficult to build or add in?

Loren
رداً على Loren Winfrey

Re: Using code in submissions

بواسطة - Martin Dougiamas
صورة Core developers صورة Documentation writers صورة Moodle HQ صورة Particularly helpful Moodlers صورة Plugin developers صورة Testers
Do you mean switch a <code> tag on and off? Or switch all HTML on and off?

I'm also not sure what you mean by the applets (Moodle doesn't have any).
رداً على Martin Dougiamas

Re: Using code in submissions

بواسطة - Loren Winfrey
Well I was thinking that turning off the code in the text boxes all together. And the applets I refered to is the editor for IE.
رداً على Loren Winfrey

Re: Using code in submissions

بواسطة - Martin Dougiamas
صورة Core developers صورة Documentation writers صورة Moodle HQ صورة Particularly helpful Moodlers صورة Plugin developers صورة Testers
Ah, OK, gotcha.  It's not actually an applet, but ... ah doesn't matter  :-)

Try replying to this post, and look in the formatting menu .. there's a new format I just added called "Plain text format" (took about 5 minutes).

Currently this format still replaces smilies, and replaces returns with <br /> but leaves all the HTML code alone and prints it as written.

For example:

<script language="Javascript">
<!--
document.write('<A TITLE="Read carefully" HREF=javascript:openpopup("/help.php?module=moodle&file=reading.html","popup","400","500") >Read carefully<IMG align="absmiddle" BORDER=0 HEIGHT=17 WIDTH=22 ALT="" SRC="http://moodle.org/pix/help.gif"></A>');
//-->
</script>

Does that do the trick?
رداً على Martin Dougiamas

Re: Using code in submissions

بواسطة - Loren Winfrey

This can work, but can it be added to journal's as well?

This could be a good thing!

But I am on my pc and I have the RT editor and it's converting the "code" into text. So I think it will work on the mac if It can be added to the journam\ls as well. Is there a way it could be the selected default for this?

Loren

 

 

رداً على Loren Winfrey

Re: Using code in submissions

بواسطة - Martin Dougiamas
صورة Core developers صورة Documentation writers صورة Moodle HQ صورة Particularly helpful Moodlers صورة Plugin developers صورة Testers
Yes, it's in journals as well, and anywhere else where you can specify the format using that menu, as they use the same central code. Individual modules set the defaults, though. Take a look in the relevant scripts - it should be pretty easy to spot.
رداً على Martin Dougiamas

Re: Using code in submissions

بواسطة - Martin Dougiamas
صورة Core developers صورة Documentation writers صورة Moodle HQ صورة Particularly helpful Moodlers صورة Plugin developers صورة Testers
I recently tweaked the plain text format so that it still processes smileys and urls while leaving code alone.

For example: http://moodle.org and :-D ;-)

but <a href="http://moodle.org">link</a> and <b>bold</b>
رداً على Loren Winfrey

Re: Using code in submissions

بواسطة - Art Lader
Could they save the HTML as a text file and upload it as an attachment to a message in the forum? Or take a screen shot of the code and upload it as an image? (That's not really what you are looking for though, is it?)
رداً على Art Lader

Re: Using code in submissions

بواسطة - Loren Winfrey
It does work, but they allways end up typing code and it then breaks up the page. I have asked the students to upload thier page but some type the code anyway.

If I could get it through to them not to type codeحزين, and to submit a file I would be happy مبتسم.

Loren