Deleted
Posts: 0
Deleted said great things
|
Post by Deleted on Aug 15, 2010 0:46:27 GMT -8
Hi, I've been battling to allow my members to post results tables in columns on my forum as in THIS LINK. I found various solutions none of which worked see THIS SUPPORT THREADThat gave me a combination of ideas that preserves spaces in posts by alternately using <space><ALT 255> substituting that for <space><space>. Forcing a fixed width font in the edit area and adding a drop down font menu seems to complete the job. The request to compliment the solution is to have a script to convert tabs to spaces. As there are no tab stops I guess it's not possible to do this dynamically dependent on the space the tab is filling. Thus would it be possible for the button on the edit screen to replace each tab with four spaces please? (I can tune that). That would make lining up data easier. Thanks in advance Sav.
|
|
|
Post by Wormopolis on Aug 15, 2010 1:27:52 GMT -8
apologies for stealing the data from your post but I wanted to run some tests... Pos Team Played Won Draw Lost For Against Bonus Points 1= Hurst Club 9 5 3 1 32 22 13 45 1= United Services Club 9 5 2 2 33 21 12 45 3 Greyhound "B&B's" 9 4 2 3 28 26 10 38 4 Eight Bells 9 3 1 5 25 29 7 32 5 Laughing Fish 9 3 1 5 22.5 31.5 7 29.5 6 Plough Plumpton 9 0 5 4 21.5 32.5 5 26.5 Pos Team Played Won Draw Lost For Against Bonus Points
1= Hurst Club 9 5 3 1 32 22 13 45 1= United Services Club 9 5 2 2 33 21 12 45 3 Greyhound "B&B's" 9 4 2 3 28 26 10 38 4 Eight Bells 9 3 1 5 25 29 7 32 5 Laughing Fish 9 3 1 5 22.5 31.5 7 29.5 6 Plough Plumpton 9 0 5 4 21.5 32.5 5 26.5
|
|
|
Post by Wormopolis on Aug 15, 2010 1:28:48 GMT -8
what I did in the second example, was surround the data table with [pre][/pre] tags
|
|
Deleted
Posts: 0
Deleted said great things
|
Post by Deleted on Aug 15, 2010 9:09:12 GMT -8
what I did in the second example, was surround the data table with [pre][/pre] tags The [pre][/pre] tags (did not know [noubbc]!!) works to some extent but screws up word wrapping. It would work for results tables but not for longer passages. It also means the posters have to know a bit about tags and some of mine are pretty dim! I was trying to make it as transparent as possible. Best wishes, Chris.
|
|
|
Post by Wormopolis on Aug 15, 2010 16:33:22 GMT -8
and Im sure your members appreciate that.
here is the the hard part however. you want something that makes it where they can post a table in the middle of regular text and have a code recognize it is a table? there HAS to be some sort of key word involved here. no code is going to be smart enough to just KNOW that something is a table. to a computer, its all just text. you have to give it something special to look for in order for it to treat some text differently then others.
now if you just want something that looked for tab delimiters and forced them all to be exactly 4 spaces.. I can give that a shot. I have to find out how it stores tabs first.
but as for the complexity of pre tabs.. if they are already making tables somewhere else and then pasting into a post, it seems like a insignificant step to have them surround it with pre tags.
|
|
Deleted
Posts: 0
Deleted said great things
|
Post by Deleted on Aug 16, 2010 9:54:10 GMT -8
Cheers my friend.
All tabs in a post is fine, sorry did not realise we were talking at cross purposes. My amendments to existing codes will substitute the <ALT 255> null character every other space in a contiguous string of spaces when the form is posted and thus preserve layout and wrapping.
The tab key is not recognised as a tab in the edit screen, but tabs exist from Word documents when pasted in. They are displayed as a single space on posted threads and screw up columns.
If you are busy, don't worry about it until you have time to spare, I'll continue to play
Thx,
Chris.
Some more research and trial and error, I've added
document.postForm.message.value=document.postForm.message.value.replace(/\t/g, '----');
"----" are spaces to my other coding for replacing spaces and it seems to work on posting, they can go back in and tidy up after
That will help for now thx
Must teach myself javascripting!!
Chris.
|
|