RolePlay onLine RPoL Logo

, welcome to RPoL Development

18:18, 28th March 2024 (GMT+0)

Easy Tables and Grids.

Posted by jase
jase
admin, 3072 posts
Cogito, ergo procuro.
Carpe stultus!
Mon 29 Apr 2013
at 14:40

Re: Easy Tables and Grids.

I've been working on the "easy" tables in conjunction with something else recently, and it quickly became apparent to me that having anything with an opening and closing character was rather... annoying.  Plus what stm said about non-english keyboard stuck in my mind.

So with that in mind I've ditched the original smarttable layout and gone with something between PHP Markdown, Wikis, and random voices in my head.  The reason I haven't gone with something in particular is there's no standard, so there's no reason for me to pick something that already exists, plus those I liked the most had severe limitations (such as PHP Markdown has to have a header row, and cannot have header cells anywhere else).

So, the new proposal for easy tables is that they are now constructed with simple pipe symbols at the start of a line, and separating each cell.

| Header | Header | Header |
|--------|--------|--------|
| Cell   | Cell   | Cell   |

Or ...
| Header | Header | Header |
|--------------------------|
| Cell   | Cell   | Cell   |


Or ...
|= Header  | Cell  | Cell  |
|= Header  | Cell  | Cell  |
|= Header  | Cell  | Cell  |

Characters immediately after the pipe affect the display of the cell.
  1. "=" denotes a header cell (TH)
  2. "^" means centre aligned
  3. ">" means right aligned
  4. "<" means left aligned
  5. A number means a columns span of that many columns.
  6. An additional full stop plus a number after the above means row span.

1-4 can be jammed up against the cell text (e.g. "=<Text"), however the column/row span require a space after them to avoid the table automatically grabbing text it shouldn't.  If your cell is going to have one of the special characters in it then just put a space after the pipe, which I'd recommend for good visual layout anyway.

This all happens without needing a encompasing wrapper.  To avoid ordinary pipe symbols being turned into a table, there has to be at least two lines starting with a pipe, the first line has to have at least two pipes in total.

e.g.


| Header | Header | Header |
|-   (enough to denote it's a table, plus at least one minus sign so it's considered a header)

Or ...
| Cell | Cell  | Cell  |
|    (enough to trigger the table conversion)

Trailing (end-of-line) pipe symbols are optional.

The table generation also takes lead from the first row in the table and assumes you want that many columns for the table.  Though you can exceed it later, the table will pad out the extra cells per row as it thinks they're needed.


| Header 1.1   | Header 1.2 | Header 1.3  |  1.4 |
|------------------------------------------------|
|>Header 2.1   | Cell 2.2   | Lazy...
|>2.3 Cell 3.1              | Cell 3.3    |> 3.4 |
                            |1.3 Cell 4.3 |^ 4.4 |
                                          |  5.4 |
| 6.1          | 6.2                      |  6.4 |

Will display something like:

Header 1.1Header 1.2Header 1.31.4
Header 2.1Cell 2.2Lazy... 
Cell 3.1Cell 3.33.4
Cell 4.34.4
5.4
6.16.26.4

This message was last edited by the user at 04:08, Fri 03 May 2013.
rogar308
member, 323 posts
Gaming is good!
Got RPOL in my soul
Mon 29 Apr 2013
at 15:16
  • msg #50

Re: Easy Tables and Grids.

+1 for random voices in my head

I already use the |'s for tables in another wiki so that works well for me.
Maidenfine
member, 78 posts
Mon 29 Apr 2013
at 17:09
  • msg #51

Re: Easy Tables and Grids.

+1 It's relatively simple for someone who just wants to do something quick. But it also allows for more complication if someone needs or wants it.
Lunarius
member, 248 posts
eadem mutata resurgo
pax ex tyranny
Mon 29 Apr 2013
at 19:18
  • msg #52

Re: Easy Tables and Grids.

+1 if the current table method will still exist and this will be an additional option for formatting.
-1 if it will replace the current table method outright.
adrasteia1
member, 1274 posts
Even a small star
shines in the darkness
Mon 29 Apr 2013
at 22:48
  • msg #53

Re: Easy Tables and Grids.

That's very well thought out.

+1 as an additional and potentially simpler method for table creation.
-1 but (as Lunarius said) if it's to replace the use of the html table tags.
jmkool
member, 250 posts
aka'd as The Kool
Mon 29 Apr 2013
at 22:59
  • msg #54

Re: Easy Tables and Grids.

This seems well thought out, and much easier to visualize as it's being prepared.

+1 as an option, but -1 if it's to replace the existing method.  The current method, while more cumbersome, allows for more exactness.
jase
admin, 3073 posts
Cogito, ergo procuro.
Carpe stultus!
Tue 30 Apr 2013
at 00:34
  • msg #55

Re: Easy Tables and Grids.

Breaking tables in the current 7 million posts seems a really good idea!
Lunarius
member, 249 posts
eadem mutata resurgo
pax ex tyranny
Tue 30 Apr 2013
at 00:37
  • msg #56

Re: Easy Tables and Grids.

In reply to jase (msg # 55):

Too bad we're at the end of April; that would make one heck of a prank. :P
adrasteia1
member, 1275 posts
Even a small star
shines in the darkness
Tue 30 Apr 2013
at 01:07
  • msg #57

Re: Easy Tables and Grids.

Well, I guess there's that..
Skald
moderator, 413 posts
Whatever it is,
I'm against it
Tue 30 Apr 2013
at 05:47
  • msg #58

Re: Easy Tables and Grids.

VERY clever.

I like it ... but I'd also want an option to override, as I use character sheets which make extensive use of pipe symbols and don't know that I'd necessarily want them to turn into tables (though I'm sure a bit of beta testing would determine that one way or t'other).

Would/could the pre and/or tt tags override the smart table ?  Compared with 7 million posts, it'd be nothing for me to have to add tags to char sheets in my games if I needed to.

And of course, where would we be without feature creep ... would it be possible/desireable to add another control character (say ~) to hide the table lines (ie make 'em the same colour as the background) - sometimes it's nicer to set out data that way, and could be used to give the effect of set tabstops with a proportional font.
jase
admin, 3074 posts
Cogito, ergo procuro.
Carpe stultus!
Tue 30 Apr 2013
at 08:02
  • msg #59

Re: Easy Tables and Grids.

Skald:
I use character sheets which make extensive use of pipe symbols

Yes, but I assume they're not the first character on each line.

   This | Will | Not
Trigger |    A | Table

| Nor | Will | One | Line

| Nor
| Will
| One
| Pipe


ThisWill
TriggerATable

Putting anything infront of the pipe (except a space) will stop the table triggering, so wrapping a pipe in tt or something will also do it, if for some reason you do need a bunch of lines starting with |.
matthewfenn
member, 303 posts
www.nj-pbem.com
Northern Journey PBeM DM
Tue 30 Apr 2013
at 09:20
  • msg #60

Re: Easy Tables and Grids.

In reply to jase (msg # 59):

Would this trigger a table?

.A.
B..
..C

jase
admin, 3075 posts
Cogito, ergo procuro.
Carpe stultus!
Tue 30 Apr 2013
at 10:42
  • msg #61

Re: Easy Tables and Grids.

In reply to matthewfenn (msg # 60):

Nope, doesn't meet the basic requirements.

Something similar will trigger the "easy grids".
Skald
moderator, 414 posts
Whatever it is,
I'm against it
Tue 30 Apr 2013
at 12:52
  • msg #62

Re: Easy Tables and Grids.

You're absolutely right jase - none of my character sheets have the pipe as the first character, so all good.

Definite +1 from me, then. :>

Out of interest ... would a non-breaking space before a pipe at the start of a line stop the easy table from being triggered ?  If so, that'd be an easy out for anyone who wanted it using the ISO code &nbsp;
jase
admin, 3076 posts
Cogito, ergo procuro.
Carpe stultus!
Tue 30 Apr 2013
at 13:15
  • msg #63

Re: Easy Tables and Grids.

In reply to Skald (msg # 62):

&nbsp; is stored and transmitted to the client as that (it's the browser that then makes it a space), so yes that'll fall into the "anything infront of the pipe" category.  (c;

<i>|</i> will also do it.

So will &#124; (that's the pipe symbol!).
rogar308
member, 327 posts
Gaming is good!
Got RPOL in my soul
Tue 30 Apr 2013
at 13:33
  • msg #64

Re: Easy Tables and Grids.

+1 I can't help myself. I'm really excited about this one. Honestly, I probably won't go and retro fit all the like 50+ PC/NPC's we have but I'll almost certainly come up with a good template for implementation going forward.
jait
member, 269 posts
Wed 1 May 2013
at 00:35
  • msg #65

Re: Easy Tables and Grids.

+1.

There's far more flexibility there than I'd expect.
jase
admin, 3077 posts
Cogito, ergo procuro.
Carpe stultus!
Fri 3 May 2013
at 05:11

Re: Easy Tables and Grids.

I've updated the site so that the tables and grids will activate in this forum (only, 'cos I'm tricky like that), so you can now see real-world examples.

Feel free to compose and preview your own examples, but please don't spam the thread (and thus forum) with tests.  You can visit http://beta.rpol.net if you feel the need to post your tests.

Questions and idiosyncrasies which need examples are, of course, welcome.

If you check out some of the previous posts, they'll now render for real.

Grids now also work (this forum only), which includes matthewfenn's example/question in msg #60.  (c;

Small (size 1) grid:
A 
 B

Default (size 2) grid:
 12
Ax 
B x

Largest (size 5) grid:
A 
 B

We also now have a table width setting:
AWide
Table

Quote me to see the source.
Skald
moderator, 415 posts
Whatever it is,
I'm against it
Fri 3 May 2013
at 06:53
  • msg #67

Re: Easy Tables and Grids.

Awesome ! :>

Now ... <smiles nervously>

Can we have a Grid (or EasyGrid) link beneath the compose message screen (suggest right next to the table link) to do all the hard work for the simplest grids/tables ?  Click to throw to pop up with the following inputs:

Rows    |2|  |x| Bold first row
Columns |2|  |x| Bold first column

Size    |2|v|


User enters no. of rows and columns in textbox (1 is allowable, but default to 2).If Bold first row or column checkboxes ticked then just add the = in each top and/or left grid cell ready for user to add text. Size dropdown list values 1 to 5 only.  Grid of required size appears as if by magic for user to type the text into the relevant cells.

Too easy !  Well, at least for our resident genius Admin ! ;>

Brought to you by the Grand High Poobah of Feature Creep !!!! <grrrins>
This message was last edited by the user at 06:55, Fri 03 May 2013.
jase
admin, 3078 posts
Cogito, ergo procuro.
Carpe stultus!
Fri 3 May 2013
at 10:01

Re: Easy Tables and Grids.

In reply to Skald (msg # 67):

Javascript popups can only prompt for one thing, which is why the multiple recipient window is a window.  I don't think the speed of that is appropriate for this use.

So we'd need some kind of modal (read as: complicated) window.  We could use jQuery to do, but RPoL currently doesn't use that... and then where into a whole lot of stuff to do one thing.  (c;
Skald
moderator, 416 posts
Whatever it is,
I'm against it
Fri 3 May 2013
at 12:39
  • msg #69

Re: Easy Tables and Grids.

Modal window it is !  <grins>  No, seriously, fair enough - feature creep too far.  I can understand that's a lot more work and probably not appropriate.

Personally, I'd be REALLY happy typing:

3x4@2

into a single input box for a 3 row, 4 column, size 2 table (@ argument option, default to size 2) ?

... but I can understand if that's getting a bit obscure for anyone not old enough to remember the arcane switches from DOS (and for anyone out there who has to ask what DOS was, you're too young) !  ;>
rogar308
member, 330 posts
Gaming is good!
Got RPOL in my soul
Fri 3 May 2013
at 13:45
  • msg #70

Re: Easy Tables and Grids.

I'd suggest to make a table template and just copy and hack that. Granted it's not quite as nice but it gets the job done fairly quickly.
matthewfenn
member, 304 posts
www.nj-pbem.com
Northern Journey PBeM DM
Fri 3 May 2013
at 16:21
  • msg #71

Re: Easy Tables and Grids.

Is it possible to have more than one row of data in an individual cell?

Similar to


This data
is all
in one cell

As is
this data


Also, is it possible to set the width of a column to a % of the whole table?
matthewfenn
member, 305 posts
www.nj-pbem.com
Northern Journey PBeM DM
Fri 3 May 2013
at 16:56
  • msg #72

Re: Easy Tables and Grids.

Thought I'd revisit my post from msg#40 and see if these new tables would make it easier and smarter:

This was made using the <table><tr><td> structure etc:
LIFE: 57
CRMNLSTGRANT
C.HAND: 2  Grant Hand 4
C.DECK: 39 (60 card deck) Grant DECK 39 (60 card deck)
BATTLEFIELD:
Land
(-)Piranha Marsh (B)
(-)Swamp (B)
(-)Crypt of Agadeem (B)(see link)
 [http://magiccards.info/zen/en/212.html]
Creatures
War-spike changeling (3/3,changeling)(R:1st strike)(runed halo)
[http://magiccards.info/mt/en/112.html]
Child of Night (2/1, lifelink)
 [http://magiccards.info/m10/en/88.html]
Anowon, the Ruin Sage (4/3)on our upkeep, each player sacs a nonvampire)
 [http://magiccards.info/wwk/en/49.html]
 
Vampire Nighthawk (10/11, flying,deathtouch,lifelink)[8](runed halo)[http://magiccards.info/zen/en/116.html] (blade of bloodchief)
t-Kalitas, Bloodchief of Ghet (5/5)(BBB,tap: destroy creature, see link)
 [http://magiccards.info/zen/en/99.html]
Vampire Aristocrat (6/6)(sac creature get +2/+2 for turn)[4](blade of bloodchief)
 [http://magiccards.info/m10/en/117.html]
Black Vampire Creature Token (2/4)
Black Vampire Creature Token (1/1)


And this was made with the pipes:
LIFE: 57
CRMNLSTGRANT
C.HAND: 2Grant Hand 4
C.DECK: 39 (60 card deck)Grant DECK 39 (60 card deck)
BATTLEFIELD:
Land
(-)Piranha Marsh (B)(-)Crypt of Agadeem (B)(see link)  [http://magiccards.info/zen/en/212.html]
(-)Swamp (B)
Creatures
War-spike changeling (3/3,changeling)(R:1st strike)(runed halo) [http://magiccards.info/mt/en/112.html]Vampire Nighthawk (10/11, flying,deathtouch,lifelink)[8](runed halo)[http://magiccards.info/zen/en/116.html] (blade of bloodchief)
Child of Night (2/1, lifelink) [http://magiccards.info/m10/en/88.html]t-Kalitas, Bloodchief of Ghet (5/5)(BBB,tap: destroy creature, see link) [http://magiccards.info/zen/en/99.html]
Anowon, the Ruin Sage (4/3)  on our upkeep, each player sacs a nonvampire) [http://magiccards.info/wwk/en/49.html]Vampire Aristocrat (6/6)(sac creature get +2/+2 for turn)[4](blade of bloodchief) [http://magiccards.info/m10/en/117.html]
Black Vampire Creature Token (2/4)
Black Vampire Creature Token (1/1)

It certainly makes for a neater table - the columns are all in line.  Thank you Jase - an excellent improvement...

As a possible bit of scope creep, what I really want to be able to do is have carriage returns within a cell without forcing a new row.  For example, the Child of Night cell above should have the hyperlink showing on the 2nd line rather than on the same line.

Also, as mentioned in my previous post above, it would be great if it were possible to fix the % width of a column as well - in the example above, it didn't matter, because both sides of the table had lots of data in them, so it made them equal, but if the data were imbalanced, then the table becomes unbalanced as well:

TestTable
Small columnA wide column with lots of data in it that will wrap and wrap and wrap and wrap and wrap and wrap and wrap and wrap and wrap and wrap and wrap and wrap and wrap and wrap and wrap and wrap and wrap and wrap and wrap and wrap and wrap

jmkool
member, 251 posts
aka'd as The Kool
Fri 3 May 2013
at 21:38
  • msg #73

Re: Easy Tables and Grids.

I say not to get too picky about extra flexibility with the pipes.  We do, after all, have the detailed <table> mechanics if we need that.  We aren't looking to replace it, merely provide a qick shortcut for simple tables.
Sign In