Author Topic: New code: Advanced tables (Now with sorting)  (Read 24336 times)

Offline Prime32

  • Over-Underling
  • Retired Admin
  • *****
  • Posts: 2914
    • View Profile
New code: Advanced tables (Now with sorting)
« on: December 04, 2011, 01:16:26 PM »
I've added support for an alternative set of table tags. These allow for borders, merged cells, and rows of alternating colours. The old table tags are still available.

A1B1C1D1
A1C1D1
A1B1C1D1
A1B1C1D1

A1B1C1D1
A1C1D1
A1B1C1D1
A1B1C1D1

A1B1C1D1
A1C1D1
A1B1C1D1
A1B1C1D1

A1B1C1D1
A1C1D1
A1B1C1D1
A1B1C1D1

Code: (This post) [Select]
[table2]
[row][cell]A1[/cell][cell]B1[/cell][cell]C1[/cell][cell]D1[/cell][/row]
[row][cellspan=2]A1[/cellspan][cell]C1[/cell][cell]D1[/cell][/row]
[row][cell]A1[/cell][cell]B1[/cell][cell]C1[/cell][cell]D1[/cell][/row]
[row][cell]A1[/cell][cell]B1[/cell][cell]C1[/cell][cell]D1[/cell][/row]
[/table2]

[table2=1]
[row][cell]A1[/cell][cell]B1[/cell][cell]C1[/cell][cell]D1[/cell][/row]
[row][cellspan=2]A1[/cellspan][cell]C1[/cell][cell]D1[/cell][/row]
[row][cell]A1[/cell][cell]B1[/cell][cell]C1[/cell][cell]D1[/cell][/row]
[row][cell]A1[/cell][cell]B1[/cell][cell]C1[/cell][cell]D1[/cell][/row]
[/table2]

[table2]
[row2][cell]A1[/cell][cell]B1[/cell][cell]C1[/cell][cell]D1[/cell][/row2]
[row][cellspan=2]A1[/cellspan][cell]C1[/cell][cell]D1[/cell][/row]
[row2][cell]A1[/cell][cell]B1[/cell][cell]C1[/cell][cell]D1[/cell][/row2]
[row][cell]A1[/cell][cell]B1[/cell][cell]C1[/cell][cell]D1[/cell][/row]
[/table2]

[table2=1]
[row2][cell]A1[/cell][cell]B1[/cell][cell]C1[/cell][cell]D1[/cell][/row2]
[row][cellspan=2]A1[/cellspan][cell]C1[/cell][cell]D1[/cell][/row]
[row2][cell]A1[/cell][cell]B1[/cell][cell]C1[/cell][cell]D1[/cell][/row2]
[row][cell]A1[/cell][cell]B1[/cell][cell]C1[/cell][cell]D1[/cell][/row]
[/table2]
« Last Edit: September 18, 2012, 01:49:50 PM by Prime32 »

Offline sirpercival

  • Epic Member
  • ****
  • Posts: 10855
  • you can't escape the miles
    • View Profile
Re: New code: Advanced tables
« Reply #1 on: December 04, 2011, 01:38:47 PM »
Excellent!  What about something special for a header row?  Thicker lines, or something?  Standard bbcode has a [th] tag.
I am the assassin of productivity

(member in good standing of the troll-feeders guild)

It's begun — my things have overgrown the previous sig.

Offline Garryl

  • DnD Handbook Writer
  • ****
  • Posts: 4503
    • View Profile
Re: New code: Advanced tables
« Reply #2 on: December 04, 2011, 01:41:25 PM »
So, for the new ones, the opening tag is table2 (instead of table), rows are either row or row2 (depending on if you want background shading or not; row2 has the background) instead of tr, and cells are cell instead of td.

Interesting, the presence of borders around cells appears to be based on the presence of a parameter, rather than the specific value given to it. Starting with [table2=] gives borders, just like putting anything after the = sign.

You don't need to close cell and row/row2 tags. However, if you don't, it will eat all newline between the end of the table and the next non-newline character.

If you close a row tag, it assumes that the next bit (until the start of the next row or row2 tag) is a new row.

Make sure to close the overall table2 tag, however, or it will move the table to the end of the post.


A1B1C1D1
A1C1D1
A1B1C1D1
A1B1C1D1



Code: [Select]
[table2=]
[row2][cell]A1[cell]B1[cell]C1[cell]D1
[row][cell=2]A1[cell]C1[cell]D1[/row]
[cell]A1[cell]B1[cell]C1[cell]D1
[row][cell]A1[cell]B1[cell]C1[cell]D1
[/table2]


Did you program this yourself or did you get it form somewhere else?

Offline sirpercival

  • Epic Member
  • ****
  • Posts: 10855
  • you can't escape the miles
    • View Profile
Re: New code: Advanced tables
« Reply #3 on: December 04, 2011, 01:44:56 PM »
Also, if you add bolding, something weird seems to happen.

ThingThing2
Thing3Thing4

Code: [Select]
[table2=1][row][cell][b]Thing[/b][/cell][cell][b]Thing2[/b][/cell][/row]
[row][cell]Thing3[/cell][cell]Thing4[/cell][/row][/table2]
I am the assassin of productivity

(member in good standing of the troll-feeders guild)

It's begun — my things have overgrown the previous sig.

Offline Prime32

  • Over-Underling
  • Retired Admin
  • *****
  • Posts: 2914
    • View Profile
Re: New code: Advanced tables
« Reply #4 on: December 04, 2011, 02:21:01 PM »
Interesting, the presence of borders around cells appears to be based on the presence of a parameter, rather than the specific value given to it. Starting with [table2=] gives borders, just like putting anything after the = sign.
Yeah, I can add support for specific parameters but not arbitrary ones. I.e. I couldn't make it "set border to the given width", but I could include options like "1", "red", etc.

Quote
Did you program this yourself or did you get it form somewhere else?
Myself.

Also, if you add bolding, something weird seems to happen.
Fixed.
« Last Edit: December 04, 2011, 02:22:33 PM by Prime32 »

Offline sirpercival

  • Epic Member
  • ****
  • Posts: 10855
  • you can't escape the miles
    • View Profile
Re: New code: Advanced tables
« Reply #5 on: December 04, 2011, 05:33:35 PM »
Is there a way to customize the shading color on row2 tags?
I am the assassin of productivity

(member in good standing of the troll-feeders guild)

It's begun — my things have overgrown the previous sig.

Offline Prime32

  • Over-Underling
  • Retired Admin
  • *****
  • Posts: 2914
    • View Profile
Re: New code: Advanced tables
« Reply #6 on: December 04, 2011, 05:43:17 PM »
Is there a way to customize the shading color on row2 tags?

A1B1C1D1
A1C1D1
A1B1C1D1
A1B1C1D1
Code: [Select]
[table2=1]
[row=#FF9999][cell]A1[/cell][cell]B1[/cell][cell]C1[/cell][cell]D1[/cell][/row]
[row][cellspan=2]A1[/cellspan][cell]C1[/cell][cell]D1[/cell][/row]
[row2][cell]A1[/cell][cell]B1[/cell][cell]C1[/cell][cell]D1[/cell][/row2]
[row][cell]A1[/cell][cell]B1[/cell][cell]C1[/cell][cell]D1[/cell][/row]
[/table2]
« Last Edit: December 04, 2011, 06:29:52 PM by Prime32 »

Offline sirpercival

  • Epic Member
  • ****
  • Posts: 10855
  • you can't escape the miles
    • View Profile
Re: New code: Advanced tables
« Reply #7 on: December 04, 2011, 05:45:15 PM »
Awesome!  Do the color words for font colors work, or is it all hex codes?  Just curious.

Test

Code: [Select]
[table2=1]
[row=black][cell][color=white]Test[/color][/cell][/row]
[/table2]
I am the assassin of productivity

(member in good standing of the troll-feeders guild)

It's begun — my things have overgrown the previous sig.

Offline SorO_Lost

  • Epic Member
  • ****
  • Posts: 7197
  • Banned
    • View Profile
Re: New code: Advanced tables
« Reply #8 on: December 04, 2011, 06:22:24 PM »
How about allowing recoloring of individual cells?

Code: [Select]
[table2]
[row=#31304A][cell] [/cell][cell] [/cell][cell] [/cell][cell] [/cell][cell] [/cell][cell] [/cell][cell] [/cell][cell] [/cell][cell] [/cell][cell] [/cell][cell] [/cell][cell] [/cell][cell] [/cell][cell] [/cell][cell] [/cell][cell=#524D63] [/cell][/row]
[row=#31304A][cell] [/cell][cell] [/cell][cell] [/cell][cell] [/cell][cell] [/cell][cell] [/cell][cell=#31244A] [/cell][cell=#6B6973] [/cell][cell] [/cell][cell] [/cell][cell] [/cell][cell] [/cell][cell=#52495A] [/cell][cell=#8C8694] [/cell][cell=#D6D7D6] [/cell][cell=#F7FBF7] [/cell]
[/table2]

And great job so far.

Offline Prime32

  • Over-Underling
  • Retired Admin
  • *****
  • Posts: 2914
    • View Profile
Re: New code: Advanced tables
« Reply #9 on: December 04, 2011, 06:27:58 PM »
How about allowing recoloring of individual cells?
Okay. There's only room for one parameter though. So the original CELL=? tag is now CELLSPAN=?, breaking any posts that used it before (I went back and updated mine). And you can't colour merged cells.
« Last Edit: December 04, 2011, 06:35:39 PM by Prime32 »

Offline SorO_Lost

  • Epic Member
  • ****
  • Posts: 7197
  • Banned
    • View Profile
Re: New code: Advanced tables
« Reply #10 on: December 04, 2011, 07:35:37 PM »
How about allowing recoloring of individual cells?
Okay. There's only room for one parameter though. So the original CELL=? tag is now CELLSPAN=?, breaking any posts that used it before (I went back and updated mine). And you can't colour merged cells.
Yeahee I wasn't the one that broke something this time.



LevelBABFortRelfWillSpecialSpells0123456789
10202Animal companion, nature sense, wild empathy31--------
21303Woodland stride42--------

Code: [Select]
[table2]
[row=#F2E4BC][cell][b]Level[/b][/cell][cell][b]BAB[/b][/cell][cell][b]Fort[/b][/cell][cell][b]Relf[/b][/cell][cell][b]Will[/b][/cell][cell][b]Special[/b][/cell][cell][b]Spells[/b][/cell][cell=#F2E4BC][b]0[/b][/cell][cell=#E7EAEF][b]1[/b][/cell][cell=#F2E4BC][b]2[/b][/cell][cell=#E7EAEF][b]3[/b][/cell][cell=#F2E4BC][b]4[/b][/cell][cell=#E7EAEF][b]5[/b][/cell][cell=#F2E4BC][b]6[/b][/cell][cell=#E7EAEF][b]7[/b][/cell][cell=#F2E4BC][b]8[/b][/cell][cell=#E7EAEF][b]9[/b][/cell]
[/row]

[row][cell]1[/cell][cell]0[/cell][cell]2[/cell][cell]0[/cell][cell]2[/cell][cell]Animal companion, nature sense, wild empathy[/cell][cell][/cell]
[cell=#F2E4BC]3[/cell]
[cell=#E7EAEF]1[/cell]
[cell=#F2E4BC]-[/cell][cell=#E7EAEF]-[/cell][cell=#F2E4BC]-[/cell][cell=#E7EAEF]-[/cell][cell=#F2E4BC]-[/cell][cell=#E7EAEF]-[/cell][cell=#F2E4BC]-[/cell][cell=#E7EAEF]-[/cell]
[/row]

[row=#F2E4BC][cell]2[/cell][cell]1[/cell][cell]3[/cell][cell]0[/cell][cell]3[/cell][cell]Woodland stride[/cell][cell][/cell]
[cell=#F2E4BC]4[/cell]
[cell=#E7EAEF]2[/cell]
[cell=#F2E4BC]-[/cell][cell=#E7EAEF]-[/cell][cell=#F2E4BC]-[/cell][cell=#E7EAEF]-[/cell][cell=#F2E4BC]-[/cell][cell=#E7EAEF]-[/cell][cell=#F2E4BC]-[/cell][cell=#E7EAEF]-[/cell]
[/row]
[/table2]

Looking pretty sharp.

Offline Garryl

  • DnD Handbook Writer
  • ****
  • Posts: 4503
    • View Profile
Re: New code: Advanced tables
« Reply #11 on: December 05, 2011, 06:41:33 PM »
Prime, would it be possible to have a table that goes column by column instead of row by row? For homebrewers, that would make it so much easier to just plug in 20 levels of full BaB or good saves or whatever, instead of having to edit it into every line. Similarly, many special options (spellcasting, manifesting, etc.) get appended to class tables, and just sticking them on the end is much easier than editing in something to every line.

Offline Childe

  • DnD Handbook Writer
  • ***
  • Posts: 485
  • Even forever must end, I think. ...
    • View Profile
    • Legend RPG, Rule of Cool Gaming
Re: New code: Advanced tables
« Reply #12 on: December 05, 2011, 08:02:44 PM »
These are a huge step up from what we had before; however, if it's possible, either cell merging or splitting would be ideal (for the Spells over-header above the individual levels (0-9 as applicable)); and does each column auto-fit to the line with? If so, long Special lines will stretch out the column. Does it have a fixed maximum width for the overall table, after which it forces a new line?
"You had a tough day at the office. So you come home, make
yourself some dinner, smother your kids, pop in a movie, maybe
have a drink. It's fun, right? Wrong. Don't smother your kids."
- The More You Know

Offline Prime32

  • Over-Underling
  • Retired Admin
  • *****
  • Posts: 2914
    • View Profile
Re: New code: Advanced tables
« Reply #13 on: December 05, 2011, 09:22:43 PM »
Prime, would it be possible to have a table that goes column by column instead of row by row? For homebrewers, that would make it so much easier to just plug in 20 levels of full BaB or good saves or whatever, instead of having to edit it into every line. Similarly, many special options (spellcasting, manifesting, etc.) get appended to class tables, and just sticking them on the end is much easier than editing in something to every line.
Try nested tables. I've used something similar in the past for the same reasons.
(click to show/hide)
This project could make things easier, but there hasn't been much interest.

These are a huge step up from what we had before; however, if it's possible, either cell merging or splitting would be ideal (for the Spells over-header above the individual levels (0-9 as applicable));
*points up* Merging is possible. An example of spell overheaders here.
Quote
and does each column auto-fit to the line with? If so, long Special lines will stretch out the column. Does it have a fixed maximum width for the overall table, after which it forces a new line?
Yes and no - standard for HTML tables.


Anyone have any ideas for table formats? As in, Xs for [table2=X].
« Last Edit: December 05, 2011, 09:30:51 PM by Prime32 »

Offline Garryl

  • DnD Handbook Writer
  • ****
  • Posts: 4503
    • View Profile
Re: New code: Advanced tables
« Reply #14 on: December 05, 2011, 10:03:53 PM »
1Blah
2Blah
blah
3Blah
4Blah
5Blah
3-
41
41
42
42

Nested tables look funky if the lines don't match up perfectly.

All I'm looking for is to be able to enter the cell data vertically instead of horizontally. Would it be hard to add?

Offline SorO_Lost

  • Epic Member
  • ****
  • Posts: 7197
  • Banned
    • View Profile
Re: New code: Advanced tables
« Reply #15 on: December 05, 2011, 10:42:49 PM »
All I'm looking for is to be able to enter the cell data vertically instead of horizontally. Would it be hard to add?
Probably, td doesn't work before tr. And not only due back to back tables tend to have a space between them, but Prime has got them adding an extra line break.

Which I suppose the question of why tables? Using style like you are now you can simply use div and pass many of the same perimeters easy enough.

Offline Childe

  • DnD Handbook Writer
  • ***
  • Posts: 485
  • Even forever must end, I think. ...
    • View Profile
    • Legend RPG, Rule of Cool Gaming
Re: New code: Advanced tables
« Reply #16 on: December 05, 2011, 10:53:06 PM »
*points up* Merging is possible. An example of spell overheaders here.
Quote
and does each column auto-fit to the line with? If so, long Special lines will stretch out the column. Does it have a fixed maximum width for the overall table, after which it forces a new line?
Yes and no - standard for HTML tables.

Anyone have any ideas for table formats? As in, Xs for [table2=X].

I suppose that what I really was looking for was splitting, so my question was faulty. I see the cellspan for merging, but, for instance, if you use unabridged table labels (using your Shaman class table as an example, all credit for this Shaman class to you):

Spells per day

Class
Level
Base
Attack
Bonus

Fort
Save

Ref
Save

Will
Save


Special


0


1


2


3


4


5


6


7
1.+0+2+0+2Soul binding, Spells, Turn undead     3-------
2.+1+3+0+3Domain binding40------
3.+2+4+1+3Vestige focus +141------
4.+3+4+1+4Improved expel 1/day51------
5.+3+4+1+4Trance520-----
6.+4+5+2+5Soul binding (true)621-----
7.+5+5+2+5Bonus feat631-----
8.+6+6+2+6Improved expel 2/day6320----
9.+6+6+3+6Vestige focus +26421----
10.+7+7+3+7Soul binding (2 vestiges)6431----
11.+8+7+3+7Improved Trance65320---
12.+9+8+4+8Improved expel 3/day65421---
13.+9+8+4+8Bonus feat66432---
14.+10+9+4+9Watchful spirit665320--
15.+11+9+5+9Vestige focus +3665431--
16.+12+10+5+10Improved expel 4/day666432--
17.+12+10+5+10Greater Trance6665420-
18.+13+11+6+11Soul binding (3 vestiges)6665431-
19.+14+11+6+11Bonus feat6666532-
20.+15+12+6+12Improved expel 5/day66665420

Cell splitting (as in Word or Open Office or similar editors) would let you split the row above the 0-7 to create a sub-row in which Spells per Day could be written without a buffer between it and the numbers (though you could create a buffer with line breaks as desired). I see that it isn't an issue with the abridged labels, but I'm fond of using the full labels.

As for the other project, are you essentially looking for people to draft up table formats (the table code minus the contents), or are you asking for what tables people would like? I found myself unsure what you were asking.
"You had a tough day at the office. So you come home, make
yourself some dinner, smother your kids, pop in a movie, maybe
have a drink. It's fun, right? Wrong. Don't smother your kids."
- The More You Know

Offline Prime32

  • Over-Underling
  • Retired Admin
  • *****
  • Posts: 2914
    • View Profile
Re: New code: Advanced tables
« Reply #17 on: December 06, 2011, 07:44:47 AM »
I suppose that what I really was looking for was splitting, so my question was faulty. I see the cellspan for merging, but, for instance, if you use unabridged table labels (using your Shaman class table as an example, all credit for this Shaman class to you):
Added row merging via a CELLSPAN2 tag.
Quote

Class
Level
Base
Attack
Bonus

Fort
Save

Ref
Save

Will
Save


Special
Spells per day
01234567
1.+0+2+0+2Soul binding, Spells, Turn undead     3-------
2.+1+3+0+3Domain binding40------
3.+2+4+1+3Vestige focus +141------
4.+3+4+1+4Improved expel 1/day51------
5.+3+4+1+4Trance520-----
6.+4+5+2+5Soul binding (true)621-----
7.+5+5+2+5Bonus feat631-----
8.+6+6+2+6Improved expel 2/day6320----
9.+6+6+3+6Vestige focus +26421----
10.+7+7+3+7Soul binding (2 vestiges)6431----
11.+8+7+3+7Improved Trance65320---
12.+9+8+4+8Improved expel 3/day65421---
13.+9+8+4+8Bonus feat66432---
14.+10+9+4+9Watchful spirit665320--
15.+11+9+5+9Vestige focus +3665431--
16.+12+10+5+10Improved expel 4/day666432--
17.+12+10+5+10Greater Trance6665420-
18.+13+11+6+11Soul binding (3 vestiges)6665431-
19.+14+11+6+11Bonus feat6666532-
20.+15+12+6+12Improved expel 5/day66665420
Quote
As for the other project, are you essentially looking for people to draft up table formats (the table code minus the contents), or are you asking for what tables people would like? I found myself unsure what you were asking.
The "other project" was something like these.
And formats means colours, borders, shadows, rows-that-change-colour-on-mouseover, etc.
« Last Edit: December 06, 2011, 12:39:11 PM by Prime32 »

Offline Childe

  • DnD Handbook Writer
  • ***
  • Posts: 485
  • Even forever must end, I think. ...
    • View Profile
    • Legend RPG, Rule of Cool Gaming
Re: New code: Advanced tables
« Reply #18 on: December 06, 2011, 12:01:16 PM »
The "other project" was something like these.
And formats means colours, borders, shadows, etc.
Okay, so you're looking for people to write those then. I'll put some in for the unabridged label 20-level progressions (various) with some other changes to the visuals when I get a chance. May not be for a few days.

And thanks for adding the cellspan2 tag. That's perfect.
"You had a tough day at the office. So you come home, make
yourself some dinner, smother your kids, pop in a movie, maybe
have a drink. It's fun, right? Wrong. Don't smother your kids."
- The More You Know

Offline Garryl

  • DnD Handbook Writer
  • ****
  • Posts: 4503
    • View Profile
Re: New code: Advanced tables
« Reply #19 on: December 06, 2011, 01:13:00 PM »
When using nested table2s, if an outer table2 has cell borders enabled, all inner tables will also have cell borders, regardless of their parameters.

Edit: I've been trying out nested tables and they really look terrible if you want borders. If you don't want to make column-based tables yourself, Prime, could you advise me on how to go about making such a mod?
« Last Edit: December 06, 2011, 01:40:47 PM by Garryl »