RolePlay onLine RPoL Logo

, welcome to RPoL Development

14:20, 28th March 2024 (GMT+0)

Easy Tables and Grids.

Posted by jase
matthewfenn
member, 306 posts
www.nj-pbem.com
Northern Journey PBeM DM
Sat 4 May 2013
at 10:08
  • msg #74

Re: Easy Tables and Grids.

I'm not being picky.  The pipes make better tables in general I think.  The added feature I'd like to be able to see overall is the ability to force a column width...
jase
admin, 3080 posts
Cogito, ergo procuro.
Carpe stultus!
Sat 4 May 2013
at 11:01

Re: Easy Tables and Grids.

matthewfenn:
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.

Use "\n".
Greybeard
member, 4 posts
Sat 4 May 2013
at 14:20
  • msg #76

Re: Easy Tables and Grids.

Sorry if this has already been covered, but when can we expect to see these changes implemented in the rest of the forums (I'm actually interested in using the tables on the character sheets).

Thanks for all the hard work you put into the site. I think it's awesome.

-Greybeard
jase
admin, 3082 posts
Cogito, ergo procuro.
Carpe stultus!
Mon 6 May 2013
at 05:18

Re: Easy Tables and Grids.

In reply to Greybeard (msg # 76):

The reason I posted the proposed layout here was to make sure it worked, didn't interfere with other layouts, and provided the flexibility and capabilities that were desired.

Though I'm happy to increase the capabilities of it at a later time, I don't want to find myself in a situation where the framework we've decided upon limits our options.  For example, the fact we don't have the entire table wrapped in some [smarttable] tag means that the detection routine relies solely upon the pipe symbol at the start of each line... which means that each line is a new table row.

I think I digress ... It'll be rolled out once I'm satisfied those who'll use it are satisfied!  (c;
jmkool
member, 252 posts
aka'd as The Kool
Mon 6 May 2013
at 05:28
  • msg #78

Re: Easy Tables and Grids.

I've discovered that you can use some pretty short shorthand for the easy grid, so that's something I'll be using!  On the tables, though, I find that you have to put the cell size notation (rows.columns) after the header or text alignment notation.  Just thought I'd mention.

And, as a matter of fact, I will second the request for fixing the width of a single cell.  Perhaps a way to fix a cell at a certain % of the table's width?  Notation could be triggered with % followed by a number?  Don't know how this would conflict with cell size notation.
jmkool
member, 253 posts
aka'd as The Kool
Mon 6 May 2013
at 05:30
  • msg #79

Re: Easy Tables and Grids.

I will follow up with a second possibility.  Perhaps a means of forcing all columns to equal width would be sufficient?  Different widths can then be achieved by spanning multiple columns.
jase
admin, 3084 posts
Cogito, ergo procuro.
Carpe stultus!
Mon 6 May 2013
at 05:30

Re: Easy Tables and Grids.

In reply to jmkool (msg # 78):

Come up with a proposal.
jmkool
member, 254 posts
aka'd as The Kool
Mon 6 May 2013
at 05:39
  • msg #81

Re: Easy Tables and Grids.

How about this:

Right after the closing pipe on the first row, before the table width notation, an = sign forces all columns to be equal width.  So the first row would be something like:

|= woo, header cell! | Other cell! |=40%

Will that do?
jase
admin, 3085 posts
Cogito, ergo procuro.
Carpe stultus!
Mon 6 May 2013
at 05:56

Re: Easy Tables and Grids.

In reply to jmkool (msg # 81):

Column widths have to add up to 100%, so no.  Even if you used 50%, there's no number that will work for tables with 3, 6, 7, 8 etc columns.

This also limits it so the columns have to be the same width.
jmkool
member, 255 posts
aka'd as The Kool
Mon 6 May 2013
at 06:05
  • msg #83

Re: Easy Tables and Grids.

My bad, the idea was that the = notation forced all the columns to be the same width (finding whatever percentage works) while the 40% was to indicate the total width of the table (a function that already exists, I believe).

As I mentioned above in a post, the 'same width' problem can be solved (at least I intend) by making certain cells span multiple columns, making a column twice (or more) as wide as the others,
This message was last edited by the user at 06:07, Mon 06 May 2013.
jase
admin, 3086 posts
Cogito, ergo procuro.
Carpe stultus!
Mon 6 May 2013
at 06:38

Re: Easy Tables and Grids.

Simple, but are equal column lengths (or multiples thereof with spanning) really what people are after?
matthewfenn
member, 308 posts
www.nj-pbem.com
Northern Journey PBeM DM
Mon 6 May 2013
at 07:07
  • msg #85

Re: Easy Tables and Grids.

jase:
matthewfenn:
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.

Use "\n".
Ah!  That does the trick!  Thanks!
Jase:
Come up with a proposal.
Hmmm...

Just to refresh, this is the syntax proposed so far:
  • "=" denotes a header cell (TH)
  • "^" means centre aligned
  • ">" means right aligned
  • "<" means left aligned
  • A number means a columns span of that many columns.
  • An additional full stop plus a number after the above means row span.
How about a new symbol - say % followed by a number - for example:
|%50 First wide column |%25 Shorter 2nd column | shorter 3rd column |50%

That would give a table that was 50% of the screen width wide, with the first column 40% of the screen width and the second and third 20% each.  Note, last column doesn't need a number because it would be whatever was left to add up to 100% of the table width.  I would also suggest having the ability to set column widths be exclusive of spanning columns at the same time.
This message was last edited by the user at 07:09, Mon 06 May 2013.
rogar308
member, 333 posts
Gaming is good!
Got RPOL in my soul
Mon 6 May 2013
at 13:24
  • msg #86

Re: Easy Tables and Grids.

It is massively confusing to me to state the percentages are one number and then have them be a different number.

---

Generally speaking, I don't want all my table columns to be the same width. I want the column width usually equal to the size of the data in it. Barring that, some width that I can specify either exact or as a % that's easy to understand.
jmkool
member, 256 posts
aka'd as The Kool
Mon 6 May 2013
at 18:06
  • msg #87

Re: Easy Tables and Grids.

Let's see if I can explain my concept in more depth.

If all columns are equal width, you can make a 'column' (being all the cells in a column) span multiple columns (being what the code sees as a column).  For example, you have two columns, and you want one to be twice as wide as the other; you make your first column of cells be two cells wide, so the code thinks there are three, and divides accordingly, you just don't see column 2 because it's included in column 1.

Perhaps, as the example above, you want three cells, one to be half the width, each other to be a quarter.  Again, make your first column 2 cells wide, and the code thinks: 4 columns!  The first cell is thus 2/4 of the width, and the second and third are each 1/4.

This 'fractions' method seems most flexible to me, as it also allows for widths like 3/7, or 4/9.  You could even make two almost equal columns, one at a width of 3, the other at 2.  This divides them into 3/5 and 2/5 of the width, respectively.
rogar308
member, 334 posts
Gaming is good!
Got RPOL in my soul
Mon 6 May 2013
at 18:46
  • msg #88

Re: Easy Tables and Grids.

I believe I understand what you are getting at just though I'm not sure why you want it. Personally, I don't think I have a need for it but I also understand that there may be others that do since many of us use the site somewhat differently and that is all well and good. For my use though, I'd like just a simple '|' delimited table that doesn't have a fixed width. I suppose anything in addition to that would be a bonus.
jmkool
member, 257 posts
aka'd as The Kool
Mon 6 May 2013
at 18:51
  • msg #89

Re: Easy Tables and Grids.

I'm not saying we need it.  To me, it's more intuitive than the percentage method, and I'd find occasion to use it, but no complaints if it gets shot down.  I'm making a proposal, and I'm interested to see who likes it.
jase
admin, 3088 posts
Cogito, ergo procuro.
Carpe stultus!
Tue 7 May 2013
at 02:24

Re: Easy Tables and Grids.

I still think setting individual widths, with something like matthewfenn's example, would be far more flexible and easier to use.

As for that example, it'll be problematic if you want to set spanning (after the %).  I think just "50%" would be easier, or ".50%" if it's after a span amount (span afterwards would just be "50%2.2").
jase
admin, 3089 posts
Cogito, ergo procuro.
Carpe stultus!
Tue 7 May 2013
at 17:23

Re: Easy Tables and Grids.

| Header 1.1      | Header 1.2  | Header 1.3   |10% 1.4 |50%
|-------------------------------------------------------|
|50%>Header 2.1   |25% Cell 2.2 |^Cell 2.3     |
|10%>2.3 Cell 3.1               | Cell 3.3     |< 3.4   |
                                |1.3 Cell\n4.3 |^ 4.4   |
                                               |
| 6.1             | 6.2                        | 6.4



Header 1.1Header 1.2Header 1.31.4
Header 2.1Cell 2.2Cell 2.3 
Cell 3.1Cell 3.33.4
Cell
4.3
4.4
 
6.16.26.4


I've now made it far more flexible with the formatting codes, though it's no longer as finicky as to what it'll gobble up.  It'll grab any combination of the alignment, colspan, rowspan and width codes and make what it can out of them.  The codes will be considered finished on either a space, or at the end of the =><^ options (or after it's grabbed about 15 characters).

So valid options are something like:
  • 50%>2.2 (trailing space compulsory)
  • >2.2.50% (trailing space compulsory)
  • 2.2>50% (trailing space compulsory)
  • 2.2.50%> (trailing space optional)
  • >2.2=50% (trailing space compulsory) (right aligned, 2 colspan, 2 rowspan, header, 50% width)
  • 2.2>50%= (trailing space optional)

Any attempt to set the width of a column that's already had it's width set will be ignored (cell 3.1 above has a 10% width, but this is ignored as 2.1 already set the width of column 1 to 50%).  Cells with a colspan are an exception to this, I'm not going to go so far as to check that the colspan=2 for cols 1 and 2 is less than colspan=3 for cols 1, 2 and 3.

Colspan, rowspan and width must all be one or two digits.  So no colspan=100 or cell width=100%.  Valued of 0 are also ignored.

If, for some reason, your cell data is going to be something like <<<50%>>> or ===2.2=== then put a space before the text, which (as previously mentioned) I'd suggest you get into the habit of anyway.
jmkool
member, 258 posts
aka'd as The Kool
Wed 8 May 2013
at 03:09
  • msg #92

Re: Easy Tables and Grids.

*nod nod*

I may come to agree that this is better than my suggestion.  Looks good.
matthewfenn
member, 310 posts
www.nj-pbem.com
Northern Journey PBeM DM
Wed 8 May 2013
at 18:50
  • msg #93

Re: Easy Tables and Grids.

Superb!

And just to refresh my MTG two-headed giant example again:

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)
(-)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)

Yup, that is great!

So - will it have to wait till the next general release to make it available elsewhere?  :-)
jase
admin, 3093 posts
Cogito, ergo procuro.
Carpe stultus!
Thu 9 May 2013
at 16:38
  • msg #94

Re: Easy Tables and Grids.

Another addition:  We can now set the alignment of a column with the divider row (the one with all the dashes).  If you don't want the bolded/emphasised header row then just start the table with the divider row (even though it's then no longer actually dividing anything).

| Header 1.1      | Header 1.2 | Header 1.3   | 1.4  |50%
|<50%-------------|--------25%>|-----^--------|10%---|
|Header 2.1       | Cell 2.2   |<Cell 2.3     |
|2.3 Cell 3.1                  | Cell 3.3     |< 3.4 |
                               |1.3 Cell\n4.3 |^ 4.4 |
                                              |
| 6.1             | 6.2                       | 6.4



Header 1.1Header 1.2Header 1.31.4
Header 2.1Cell 2.2Cell 2.3 
Cell 3.1Cell 3.33.4
Cell
4.3
4.4
 
6.16.26.4

Note that when you're doing column span, the alignment might not turn up how you expect it (depending upon whether you focus on where the column starts or where it finishes).  You may want/expect cell 3.1 to be right aligned, but it starts at column 1, so it gets the alignment from there.  You can override the alignment of individual cells (see cell 2.3 as an example).

Widths can also be set with the divider row.  The divider row can only have pipes (|), dashes and the alignment codes and width (which means even spaces aren't allowed).  It doesn't actually matter whre you put the codes in between the pipes, as illustrated in the example.

Unless their alignment is set within the cell or via the whole column, table data (td) are left aligned, table headers (th) are centre aligned.  Not sure if that's how it should be by default..?

I think I should stop fiddling with this now, it's getting to be a massive routine.
rogar308
member, 340 posts
Gaming is good!
Got RPOL in my soul
Thu 9 May 2013
at 17:05
  • msg #95

Re: Easy Tables and Grids.

Well how about using the 'dice roller' to generate your tables? So you could have 2d4 be like 2 rows of 4 columns each. Maybe even 1d5+1d3 for 1 row of 5 columns followed by 1 row of 3 columns. I'd save this for next April 1st but I'm sure it will be long gone from my memory by then.
matthewfenn
member, 313 posts
www.nj-pbem.com
Northern Journey PBeM DM
Fri 10 May 2013
at 06:46
  • msg #96

Re: Easy Tables and Grids.

Confess I'm not sure what rogar is on about.

Another thought Jase,  how about something to set vertical alignment, especially in those cells that span rows?
Skald
moderator, 419 posts
Whatever it is,
I'm against it
Fri 10 May 2013
at 06:55
  • msg #97

Re: Easy Tables and Grids.

rogar's just joking.  I was about to suggest something similar with an end game of using Easy Grid as a random dungeon generator.  <evil grin>

On a more serious note, it'd also be nice to be able to shade individual cells (same colour as the header, let's not get carried away here) ... perhaps # as the tag ?
matthewfenn
member, 315 posts
www.nj-pbem.com
Northern Journey PBeM DM
Fri 10 May 2013
at 08:40
  • msg #98

Re: Easy Tables and Grids.

Well, easy enough to shade a specific square with an "=", but not so easy to always get the code to display exactly the table you expect...  I almost got the table I want, but it's added a little empty nub sticking out on the right hand side that I can't get rid of!

A1B1C1D1
ABC2D2
3
4
A3BC3
4
BCD5

Incidentally Jase, the [Code][/Code] tags don't seem to work when put around the table code here...
Sign In