1. jerone

    26.11.2007

    0 ↑
    0 ↓
    Hey, I like this script.

    I have a suggestion:
    Make clickable links for all links/images/scripts and so on.
    Offcourse with the original text in place.

    Maybe you can use this piece off code:
    $text = $text.replace(/(http:\/\/+[\w\/\-%&#=.,?+$]+)/g, "<a href='$1'>$1</a>");
    $text = $text.replace(/([\w.-]+@[\w.-]+\.\w+)/g, "<a href='mailto:$1'>$1</a>");
    Tell me what you think and keep up the great work

    gr J
  2. jerone

    26.11.2007

    0 ↑
    0 ↓
    Just a few another suggestions:
    - I would like to change a tab length. Now its 8 characters long, but i would like to set it to 4.
    - a new language: C# (C sharp).
    - And maybe some more explaining on the site about how the main and language script works would be nice (so i can adjust them correctly or add another language).

    gr J
  3. Ivan Sagalaev

    28.11.2007

    0 ↑
    0 ↓
    Hi!

    I'll think about your suggestions, thanks. However I really don't want to implement "urlification" because this is not important in _code snippets_ but will introduce considerable bloat and will make library bigger and slower.

    As for tabs... I don't do anything to them, they are just interpreted by browser as it likes. And this is a fundamental thing with tabs: they don't have any "proper" interpretation. If one wants a code to look in some strict way it's better to just use spaces for indentation.
  4. jerone

    02.01.2008

    0 ↑
    0 ↓
    A little late, but thank you for your reply (read it well earlyer).

    I still like to see some document about making my own language script for this.

    Also i have a fix for javascript title;
    change this:
          className: 'title',
    begin: UNDERSCORE_IDENT_RE, end: '^'
    into this:
          className: 'title',
    begin: '[a-zA-Z_$][a-zA-Z0-9_$]*', end: '^'
    The change is because the $ charakter is also possible in javascript.

    gr J
  5. Ivan Sagalaev

    02.01.2008

    0 ↑
    0 ↓
    Indeed... Thanks!
  6. jerone

    03.01.2008

    0 ↑
    0 ↓
    I wrote a code for the tabs to spaces function. Maybe you like to add it.
    function tab2space(text, spaces){  /*J*/
    spaces = (typeof spaces == 'number') ? spaces : 4;
    var lines = text.split('\n');
    var result = '';
    for (var line = 0; line < lines.length; line++) {
    lineX = lines[line];
    var tabPos = lineX.toString().indexOf('\t');
    while (tabPos > -1) {
    var start = lineX.substr(0, tabPos);
    var tab = '';
    for (var i = 0; i < spaces - (tabPos % spaces); i++) {
    tab += ' ';
    }
    var end = lineX.substr(tabPos + 1)
    lineX = start + tab + end;
    tabPos = lineX.indexOf('\t');
    }
    result += lineX + '\n';
    }
    return result;
    }
    (Were value is the value where the tabs are. And spaces are the number of spaces you want to have; e.g. 4)

    And put:
    value = tab2space(value,4);
    just after:
    function highlight(value) {
  7. jerone

    03.01.2008

    0 ↑
    0 ↓
    Also i got some weird bug when i'm adding this pease off code to the pre code block:
    // Set return opacity from 0 t/m 100 %;
    // e.g.: $setReturnOpacity(70);
    // return: [string] opacity;
    // syntax: n [integer] procent from 0 to 100;
    function $setReturnOpacity(n) {
    return opacity = "filter:alpha(opacity=" + n + ");" + /**IE**/
    "filter: progid:DXImageTransform.Microsoft.Alpha(opacity=" + n + ");" + /**IE old**/
    "opacity:" + (n/100) + ";" + /**CSS3**/
    "-moz-opacity:" + (n/100) + ";" + /**Mozilla**/
    "-khtml-opacity:" + (n/100) + ";"; /**KHTML**/
    };
    It convert to javascript, which is good, but the pease (n/100) does he think is regexp. Which is ofcourse not.

    I can't find it, any idea's?

    gr J
  8. Ivan Sagalaev

    18.01.2008

    0 ↑
    0 ↓
    Well... The problem is that javascript regexps are defined as almost anything between /.../. I'm still trying to devise any way to distinguish them from divisions in your case. No ideas yet :-(
  9. cliffyk

    07.03.2008

    0 ↑
    0 ↓
    I just used server side VBScript, Replace(sCode, vbTab, " "), before loading the snippet to be displayed...

Внимание! Это довольно старый топик, посты в него не попадут в новые, и их никто не увидит. Пишите пост, если хотите просто дополнить топик, а чтобы задать новый вопрос — начните новый.