Syntax Highligting for Code

Started by G_G, June 08, 2011, 01:08:17 pm

Previous topic - Next topic

G_G

Quote from: gameus on October 25, 2015, 02:57:57 am
Would it be possible to use regexp and sub out the tab "\t" and replace with like 4 spaces " "?


Meant to originally post this here.

Ryex

October 26, 2015, 01:56:13 pm #61 Last Edit: October 26, 2015, 01:59:19 pm by Ryex
LOL!
turns out this functionality is already implemented.

there is a mod setting to configure how many space tabs a space gets replaced with
and this code is supposed to add that many spaces together to set up the tab replace.

this sequence should appear twice in Subs-Highlight.php

not sure why it's not working.

   $tab = '';
   if (!empty($modSettings['ch_tab'])) {
       while ($i < $modSettings['ch_tab']) {
           $tab .= ' ';
           $i++;
       }
   }
   // ...
   $js = "\n\t\t" . '<script type="text/javascript" src="' . $settings['default_theme_url'] . '/highlight.pack.js"></script>
       <script type="text/javascript">
       hljs.configure({
         tabReplace: "' . $tab . '",
         useBR: true
       });
       hljs.initHighlightingOnLoad();
       </script>';
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Blizzard

Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Ryex

QuoteNumber of characters between tab columns [ 4 ]

^^
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Blizzard

Wouldn't that mean it's already converted to spaces?
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Ryex

it's supposed to yes, I'm not sure why it's not working.
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Blizzard

Any chance you can find some time to look into it?
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.