News:

Sarkat And Rian: Happily Ever After? [EX]
Congratulations shengami & FoxgirlJay for completing your RP!

Main Menu

Query: Formatting the "code" function

Started by Stygia, December 04, 2014, 03:26:28 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Stygia

Hey all, I looked around in the tutorials and didn't find an answer to my question, so I'll drop it here.

Basically, if I have a selection of code that I want to be easily selected by users, I've added the [ code ] and [ /code ] tag. Simple enough and it works....but the issue is that my code appears in the selection box as one wide, very short box with a scroll bar going across the bottom. Is there any way to make it more visually appealing? A text-wrapping function so that lines of text don't require the horizontal scroll bar?

So basically what I have is this:




Name : Insert your character's name, please.
Rank : Are you a Sentinel or a Guide or a Normal? Please put that.
Location : Where are they located? Obviously somewhere pertaining to the thread, but /where/?
Time : This helps keep track for other players what TIME it is. This allows for multiple interactions to occur at the same time, /but on different days/ or at /different times/ during the day. For player reference, the starting date will be November 8th.
Tagging : Is there someone specific you are speaking to? Tag. Please also note if the interaction/conversation is open or closed.
Anything Else : Does not need to be included every post. Some players like tagging musical inspiration for the piece. Some like to note what clothing their character is wearing. Etc. If you want to include something, please do. If not? Truck on, and know you don't have to include it!



[float=left][img height=200 padding=5]http://24.media.tumblr.com/0964d2065191b3d7d6ba44264c097c20/tumblr_mo4npimI8m1s1wqago1_250.jpg[/img][/float][b]Name :[/b] [i]Insert your character's name, please.[/i]
[b]Rank :[/b] [i]Are you a Sentinel or a Guide or a Normal? Please put that.[/i]
[b]Location :[/b] [i]Where are they located? Obviously somewhere pertaining to the thread, but /where/?[/i]
[b]Time :[/b] [i]This helps keep track for other players what TIME it is. This allows for multiple interactions to occur at the same time, /but on different days/ or at /different times/ during the day. For player reference, the starting date will be November 8th.[/i]
[b]Tagging :[/b] [i]Is there someone specific you are speaking to? Tag. Please also note if the interaction/conversation is open or closed.[/i]
[b]Anything Else :[/b] [i]Does not need to be included every post. Some players like tagging musical inspiration for the piece. Some like to note what clothing their character is wearing. Etc. If you want to include something, please do. If not? Truck on, and know you don't have to include it![/i]





And it's even worse if I try to hide it under a spoiler cut:


Spoiler: Click to Show/Hide
Name : Insert your character's name, please.
Rank : Are you a Sentinel or a Guide or a Normal? Please put that.
Location : Where are they located? Obviously somewhere pertaining to the thread, but /where/?
Time : This helps keep track for other players what TIME it is. This allows for multiple interactions to occur at the same time, /but on different days/ or at /different times/ during the day. For player reference, the starting date will be November 8th.
Tagging : Is there someone specific you are speaking to? Tag. Please also note if the interaction/conversation is open or closed.
Anything Else : Does not need to be included every post. Some players like tagging musical inspiration for the piece. Some like to note what clothing their character is wearing. Etc. If you want to include something, please do. If not? Truck on, and know you don't have to include it!



[float=left][img height=200 padding=5]http://24.media.tumblr.com/0964d2065191b3d7d6ba44264c097c20/tumblr_mo4npimI8m1s1wqago1_250.jpg[/img][/float][b]Name :[/b] [i]Insert your character's name, please.[/i]
[b]Rank :[/b] [i]Are you a Sentinel or a Guide or a Normal? Please put that.[/i]
[b]Location :[/b] [i]Where are they located? Obviously somewhere pertaining to the thread, but /where/?[/i]
[b]Time :[/b] [i]This helps keep track for other players what TIME it is. This allows for multiple interactions to occur at the same time, /but on different days/ or at /different times/ during the day. For player reference, the starting date will be November 8th.[/i]
[b]Tagging :[/b] [i]Is there someone specific you are speaking to? Tag. Please also note if the interaction/conversation is open or closed.[/i]
[b]Anything Else :[/b] [i]Does not need to be included every post. Some players like tagging musical inspiration for the piece. Some like to note what clothing their character is wearing. Etc. If you want to include something, please do. If not? Truck on, and know you don't have to include it![/i]




Thoughts? Suggestions? Thanks!

Stygia

Psi

#1
By definition, a code or pre tag set forces the website to ignore formatting/tags within the wrapping tag.

You could attempt to force it to wrap, by adding in line breaks into your source view.   

In many cases that wont affect the display or operation of your code, but in more traditional systems, most code isn't that long, or has line breaks added for clarity manually.   So the code view isn't designed to do forced line breaks, or line wrap.   It could potentially be done if the object was to restricte the code block to x width, but that would break how the code is meant to be displayed and defeat the purpose of a code view.

ie


if X=Y then
{do  this and this;}
or
{do this and this other thing;}
end if


When I deal with proxy.pac files which are javascript, and with stylesheets I often have

if (
     shpExpMatch(url,"*domain*") ||
     shpExpMatch(url,"*domain2*))
return {direct;}


This is the head section of this websites page


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" href="https://elliquiy.com/forums/Themes/elliquiy2/css/index.css?r=1" />
<link rel="stylesheet" type="text/css" href="https://elliquiy.com/forums/Themes/elliquiy2/css/elliquiy_widescreen.css?r=b" />
<script src="/forums/chat/js/chat.js" type="text/javascript" charset="UTF-8"></script>
<script src="/forums/chat/js/lang/en.js" type="text/javascript" charset="UTF-8"></script>
<script src="/forums/chat/js/config.js" type="text/javascript" charset="UTF-8"></script>
<script src="/forums/chat/js/FABridge.js" type="text/javascript" charset="UTF-8"></script>
<script src="/forums/chat/js/shoutbox.js" type="text/javascript" charset="UTF-8"></script>
<script src="/forums/elliquiy.min.js" type="text/javascript" charset="UTF-8"></script>
<script type="text/javascript" src="https://elliquiy.com/forums/Themes/default/scripts/script.js?fin20"></script>
<script type="text/javascript" src="https://elliquiy.com/forums/Themes/elliquiy2/scripts/theme.js?fin20"></script>
<script type="text/javascript">
        function hideSecond(el){el2=el.nextSibling;el2.style.display=(el2.style.display=="block")?"none":"block";}
</script>
<script type="text/javascript"><!-- // --><![CDATA[
var smf_theme_url = "https://elliquiy.com/forums/Themes/elliquiy2";
var smf_default_theme_url = "https://elliquiy.com/forums/Themes/default";
var smf_images_url = "https://elliquiy.com/forums/Themes/elliquiy2/images";
var smf_scripturl = "https://elliquiy.com/forums/index.php";
var smf_iso_case_folding = false;
var smf_charset = "ISO-8859-1";
var ajax_notification_text = "Loading...";
var ajax_notification_cancel_text = "Cancel";
// ]]></script>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="viewport" content="width=1024">
<meta name="description" content="Elliquiy Role Playing Forums - Index" />
<meta name="keywords" content="Roleplaying, Role Playing, RP, Roleplay, Adult, Sex, Sexual, Mature, Erotic" />
<title>Elliquiy Role Playing Forums - Index</title>
<link rel="canonical" href="https://elliquiy.com/forums/index.php" />
<link rel="help" href="https://elliquiy.com/forums/index.php?action=help" />
<link rel="search" href="https://elliquiy.com/forums/index.php?action=search" />
<link rel="contents" href="https://elliquiy.com/forums/index.php" />
<link rel="alternate" type="application/rss+xml" title="Elliquiy Role Playing Forums - RSS" href="https://elliquiy.com/forums/index.php?type=rss;action=.xml" />
</head>

See how its laid out manualy to assist with reading, normally in Code View?

The latter example obviously has a max height set, but not a width, which is why it scrolls vertical, without breaking how the code is displayed.
Often code viewers will also do syntax highlighting to make it easier to identify elements, and to spot missed closed strings or tags.

Rogue

The main issue with that is when spacing matters. It would be nice if there was a way to have the code function perhaps auto wordwrap? Maybe we should put this in the suggestion thread.

Cassandra LeMay

As far as I can see, the easiest solution would be to just cut the descriptions of the profile fields short. If you want players to use this template you will have to tell them so, most likely in an OOC post. In that case you can tell them everything you like about the different profile fields outside the actual profile code. It doesn't all have to go into the Code box.
ONs, OFFs, and writing samples | Oath of the Drake

You can not value dreams according to the odds of their becoming true.
(Sonia Sotomayor)