It is currently Fri May 16, 2025 3:27 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 36 posts ]  Go to page 1, 2  Next
Author Message
Offline
 Post subject: Diagram Captions Should Be Fixed
Post #1 Posted: Wed Apr 21, 2010 11:00 pm 
Honinbo

Posts: 9552
Liked others: 1602
Was liked: 1712
KGS: Kirby
Tygem: 커비라고해
Diagram captions should be fixed, now. You should be able to post long amounts of text, and it should automatically wrap for you. Here is an example:

viewtopic.php?f=14&t=63&p=185#p185

Please let me know how you like the color scheme and/or general appearance.

_________________
be immersed

Top
 Profile  
 
Offline
 Post subject: Re: Diagram Captions Should Be Fixed
Post #2 Posted: Fri Apr 23, 2010 9:44 pm 
Judan
User avatar

Posts: 5546
Location: Banbeck Vale
Liked others: 1104
Was liked: 1457
Rank: 1D AGA
GD Posts: 1512
Kaya handle: Test
Click Here To Show Diagram Code
[go]$$Wc Thanks Kirby
$$|-------------------
$$|. . . . . . . . . . |
$$|. . . . . . . . . . |
$$|-------------------[/go]

_________________
Help make L19 more organized. Make an index: https://lifein19x19.com/viewtopic.php?f=14&t=5207

Top
 Profile  
 
Offline
 Post subject: Re: Diagram Captions Should Be Fixed
Post #3 Posted: Fri Apr 23, 2010 9:48 pm 
Honinbo

Posts: 9552
Liked others: 1602
Was liked: 1712
KGS: Kirby
Tygem: 커비라고해
No problem.

_________________
be immersed

Top
 Profile  
 
Offline
 Post subject: Re: Diagram Captions Should Be Fixed
Post #4 Posted: Tue Apr 27, 2010 7:45 am 
Gosei
User avatar

Posts: 2011
Location: Groningen, NL
Liked others: 202
Was liked: 1087
Rank: Dutch 4D
GD Posts: 645
Universal go server handle: herminator
I really dislike having the caption text be part of the image.

  • It's bad style from a web standards perspective, because it ignores user settings for fonts, so you're breaking accessibility.
  • It doesn't get indexed by search engines, nor by the forum search function, so it makes it harder to find things.
  • You can't format it with the forum tools, so no italic, bold, or things like :b8: @ :w2: (very useful in captions)

It would be much better, IMO, to put a div tag around the image, set to slightly more than the width of the image for text wrapping purposes, and have the text inside that div, under the image, as normal text.

Top
 Profile  
 
Offline
 Post subject: Re: Diagram Captions Should Be Fixed
Post #5 Posted: Tue Apr 27, 2010 7:58 am 
Honinbo

Posts: 9552
Liked others: 1602
Was liked: 1712
KGS: Kirby
Tygem: 커비라고해
HermanHiddema wrote:
I really dislike having the caption text be part of the image.

  • It's bad style from a web standards perspective, because it ignores user settings for fonts, so you're breaking accessibility.
  • It doesn't get indexed by search engines, nor by the forum search function, so it makes it harder to find things.
  • You can't format it with the forum tools, so no italic, bold, or things like :b8: @ :w2: (very useful in captions)

It would be much better, IMO, to put a div tag around the image, set to slightly more than the width of the image for text wrapping purposes, and have the text inside that div, under the image, as normal text.


So would you like to use any of the forum tags in the caption? If so, do you want the caption input method to remain a part of the diagram code? Right now we use sltxt2png's built in caption parsing, but if we allow for all forum tags, maybe we can do this a different way.

_________________
be immersed

Top
 Profile  
 
Offline
 Post subject: Re: Diagram Captions Should Be Fixed
Post #6 Posted: Tue Apr 27, 2010 8:02 am 
Gosei
User avatar

Posts: 1435
Location: California
Liked others: 53
Was liked: 171
Rank: Out of practice
GD Posts: 1104
KGS: fwiffo
On Sensei's you can put in wiki markup inside diagram captions, so it makes sense to be able to use bbcode markup and smilies and stuff inside the captions here. I can imagine for instance having a caption that says something like "Joseki is :w2: at a. See this Sensei's page for more information".

_________________
KGS 4 kyu - Game Archive - Keyboard Otaku

Top
 Profile  
 
Offline
 Post subject: Re: Diagram Captions Should Be Fixed
Post #7 Posted: Tue Apr 27, 2010 8:05 am 
Gosei
User avatar

Posts: 2116
Location: Silicon Valley
Liked others: 152
Was liked: 330
Rank: 2d AGA
GD Posts: 1193
KGS: lavalamp
Tygem: imapenguin
IGS: lavalamp
OGS: daniel_the_smith
HermanHiddema wrote:
It would be much better, IMO, to put a div tag around the image, set to slightly more than the width of the image for text wrapping purposes, and have the text inside that div, under the image, as normal text.


+1

_________________
That which can be destroyed by the truth should be.
--
My (sadly neglected, but not forgotten) project: http://dailyjoseki.com

Top
 Profile  
 
Offline
 Post subject: Re: Diagram Captions Should Be Fixed
Post #8 Posted: Tue Apr 27, 2010 8:25 am 
Gosei
User avatar

Posts: 2011
Location: Groningen, NL
Liked others: 202
Was liked: 1087
Rank: Dutch 4D
GD Posts: 645
Universal go server handle: herminator
Kirby wrote:
So would you like to use any of the forum tags in the caption? If so, do you want the caption input method to remain a part of the diagram code? Right now we use sltxt2png's built in caption parsing, but if we allow for all forum tags, maybe we can do this a different way.


Ideally, the caption would just be passed back to the bbcode interpreter, yes.

Top
 Profile  
 
Offline
 Post subject: Re: Diagram Captions Should Be Fixed
Post #9 Posted: Tue Apr 27, 2010 9:42 am 
Honinbo

Posts: 9552
Liked others: 1602
Was liked: 1712
KGS: Kirby
Tygem: 커비라고해
HermanHiddema wrote:
Kirby wrote:
So would you like to use any of the forum tags in the caption? If so, do you want the caption input method to remain a part of the diagram code? Right now we use sltxt2png's built in caption parsing, but if we allow for all forum tags, maybe we can do this a different way.


Ideally, the caption would just be passed back to the bbcode interpreter, yes.


Okay, that sounds good... I'll have to think for a little bit about how to implement this.

_________________
be immersed

Top
 Profile  
 
Offline
 Post subject: Re: Diagram Captions Should Be Fixed
Post #10 Posted: Tue Apr 27, 2010 10:08 am 
Gosei
User avatar

Posts: 1435
Location: California
Liked others: 53
Was liked: 171
Rank: Out of practice
GD Posts: 1104
KGS: fwiffo
The caption has already been passed through the bbcode interpreter by the time it gets to your javascript...

Click Here To Show Diagram Code
[go]$$B This is the caption
$$ ------------
$$| . . . 2 . .
$$| . a 1 . b .
$$| . . . . . .[/go]

So you ought to be able to just pull out everything from the first line after the first whitespace and put it in its own tag after the image. One problem is that many of the bbcodes will insert " marks, which will cause you to have invalid javascript and creates injection security issues.

Click Here To Show Diagram Code
[go]$$B This is the caption :w2:
$$ ------------
$$| . . . 2 . .
$$| . a 1 . b .
$$| . . . . . .[/go]


To get around that, I'd put the diagram data in a separate tag and have the javascript pull it out with innerHTML instead of trying to insert it into the javascript itself. E.g.:

Code:
[go]{TEXT}[/go]
replaced by:
Code:
<pre style="display: none;" class="go-diagram">{TEXT}</pre><script type="text/javascript">... javscript code ...</script>

The script is probably getting complicated enough that it might be worth moving into a separate file. Rather than having some inline javascript with each diagram, just loop over all the pre elements with the go-diagram class and process them all at once in a body.onload event. Perhaps we should install jquery to simplify this kind of thing.

Sorry! I should not be back-seat coding. :-)

_________________
KGS 4 kyu - Game Archive - Keyboard Otaku

Top
 Profile  
 
Offline
 Post subject: Re: Diagram Captions Should Be Fixed
Post #11 Posted: Tue Apr 27, 2010 10:40 am 
Honinbo

Posts: 9552
Liked others: 1602
Was liked: 1712
KGS: Kirby
Tygem: 커비라고해
fwiffo wrote:
The caption has already been passed through the bbcode interpreter by the time it gets to your javascript...

...



No problem about backseat coding - we're on the same team ;)

Anyway, I guess that I don't understand exactly how the bbcode parser works.  Are you saying that, if you put tags into the conversion text, they will be parsed later on down the line?

So if I have:
[go1]{TEXT}[/go1] 

and convert it to
[funkytag]{text}[/funkytag]

The "funkytag" code will then be executed?

If it works this way, what happens if I have the following definitions:
1.) [go1]{TEXT}[/go1] --(converts to)--> [funkytag]{TEXT}[/funkytag]
2.) [funkytag]{TEXT}[/funkytag] -->(converts to)--> [go1]{TEXT}[/go1]

_________________
be immersed

Top
 Profile  
 
Offline
 Post subject: Re: Diagram Captions Should Be Fixed
Post #12 Posted: Tue Apr 27, 2010 11:07 am 
Gosei
User avatar

Posts: 1435
Location: California
Liked others: 53
Was liked: 171
Rank: Out of practice
GD Posts: 1104
KGS: fwiffo
No, I'm saying the bbcode parser has already parsed any tags inside diagram code before you even get to do anything with it, and it does it in one pass.

For example, imagine we had a simpler bbcode rule that replaces:
Code:
[go]{TEXT}[/go]
with:
Code:
<pre class="go-diagram">{TEXT}</pre>


Then the following:
Code:
[go]$$B This is [i]a caption[/i] with [url=http://lifein19x19.com]<this link> & [b]bold text[/b][/url]
$$  ----------------------
$$ | . . . . . . . . . . .
$$ | . . . . . . . . . . .
$$ | . . . 5 3 4 . . . 8 .
$$ | . . 1 , 2 6 . . . . .
$$ | . . . . . . . . . . .
$$ | . . 7 . . . . . . . .
$$ | . . . . . . . . . . .[/go]
gets replaced with:
Code:
<pre class="go-diagram">$$B This is <em>a caption</em> with <a href="http://lifein19x19.com">&lt;this link&gt;</a><br /> &amp; <strong>bold text</strong>
$$  ----------------------<br />
$$ | . . . . . . . . . . .<br />
$$ | . . . . . . . . . . .<br />
$$ | . . . 5 3 4 . . . 8 .<br />
$$ | . . 1 , 2 6 . . . . .<br />
$$ | . . . . . . . . . . .<br />
$$ | . . 7 . . . . . . . .<br />
$$ | . . . . . . . . . . .</pre>
or something similar (I'm pretty sure it removes the newlines, but I left them in for readability). You can see it replaced the bbcodes inside your [go] bbcode with the equivalent HTML and escaped special HTML characters like <, > and &. Smilies would also be converted to the appropriate <img> tags.

Your funkytag example would not do anything weird, because it's only a single pass. so [go1] would get converted to [funkytag] but that would be it, and viewers would just see [funkytag]. It wouldn't go into an infinite loop or anything.

My explanation may have been confusing, cause if you click on the "show diagram code" for the first example you'd see the word "caption" in italics because the [i] bbcode I put in there got converted to an <em> (as you can see in the diagram itself). So "show diagram code" is lying because it doesn't unconvert the bbcodes or anything. That's a much hairier problem. I don't know if bbcodes have a mechanism to allow certain text inside your tag to go through unmolested. My guess is that it does not because it would be really easy to create HTML injection vulnerabilities.

_________________
KGS 4 kyu - Game Archive - Keyboard Otaku

Top
 Profile  
 
Offline
 Post subject: Re: Diagram Captions Should Be Fixed
Post #13 Posted: Tue Apr 27, 2010 11:45 am 
Honinbo

Posts: 9552
Liked others: 1602
Was liked: 1712
KGS: Kirby
Tygem: 커비라고해
fwiffo wrote:
No, I'm saying the bbcode parser has already parsed any tags inside diagram code before you even get to do anything with it, and it does it in one pass.

For example, imagine we had a simpler bbcode rule that replaces:
Code:
[go]{TEXT}[/go]
with:
Code:
<pre class="go-diagram">{TEXT}</pre>


Then the following:
Code:
[go]$$B This is [i]a caption[/i] with [url=http://lifein19x19.com]<this link> & [b]bold text[/b][/url]
$$  ----------------------
$$ | . . . . . . . . . . .
$$ | . . . . . . . . . . .
$$ | . . . 5 3 4 . . . 8 .
$$ | . . 1 , 2 6 . . . . .
$$ | . . . . . . . . . . .
$$ | . . 7 . . . . . . . .
$$ | . . . . . . . . . . .[/go]
gets replaced with:
Code:
<pre class="go-diagram">$$B This is <em>a caption</em> with <a href="http://lifein19x19.com">&lt;this link&gt;</a><br /> &amp; <strong>bold text</strong>
$$  ----------------------<br />
$$ | . . . . . . . . . . .<br />
$$ | . . . . . . . . . . .<br />
$$ | . . . 5 3 4 . . . 8 .<br />
$$ | . . 1 , 2 6 . . . . .<br />
$$ | . . . . . . . . . . .<br />
$$ | . . 7 . . . . . . . .<br />
$$ | . . . . . . . . . . .</pre>
or something similar (I'm pretty sure it removes the newlines, but I left them in for readability). You can see it replaced the bbcodes inside your [go] bbcode with the equivalent HTML and escaped special HTML characters like <, > and &. Smilies would also be converted to the appropriate <img> tags.

Your funkytag example would not do anything weird, because it's only a single pass. so [go1] would get converted to [funkytag] but that would be it, and viewers would just see [funkytag]. It wouldn't go into an infinite loop or anything.

My explanation may have been confusing, cause if you click on the "show diagram code" for the first example you'd see the word "caption" in italics because the [i] bbcode I put in there got converted to an <em> (as you can see in the diagram itself). So "show diagram code" is lying because it doesn't unconvert the bbcodes or anything. That's a much hairier problem. I don't know if bbcodes have a mechanism to allow certain text inside your tag to go through unmolested. My guess is that it does not because it would be really easy to create HTML injection vulnerabilities.


I understand, now... It's definitely doable, then.

_________________
be immersed

Top
 Profile  
 
Offline
 Post subject: Re: Diagram Captions Should Be Fixed
Post #14 Posted: Mon May 17, 2010 11:40 am 
Gosei
User avatar

Posts: 2011
Location: Groningen, NL
Liked others: 202
Was liked: 1087
Rank: Dutch 4D
GD Posts: 645
Universal go server handle: herminator
Bump. This hasn't been fixed yet, as far as I can see?

Top
 Profile  
 
Offline
 Post subject: Re: Diagram Captions Should Be Fixed
Post #15 Posted: Wed Jun 02, 2010 1:12 am 
Gosei
User avatar

Posts: 2011
Location: Groningen, NL
Liked others: 202
Was liked: 1087
Rank: Dutch 4D
GD Posts: 645
Universal go server handle: herminator
Bumping yet again. I'm currently avoiding the use of diagram captions in all my posts for this reason, so please fix it :)

Top
 Profile  
 
Offline
 Post subject: Re: Diagram Captions Should Be Fixed
Post #16 Posted: Wed Jun 02, 2010 7:28 am 
Gosei
User avatar

Posts: 1435
Location: California
Liked others: 53
Was liked: 171
Rank: Out of practice
GD Posts: 1104
KGS: fwiffo
I've added this to the todo list.

_________________
KGS 4 kyu - Game Archive - Keyboard Otaku

Top
 Profile  
 
Offline
 Post subject: Re: Diagram Captions Should Be Fixed
Post #17 Posted: Tue Jan 25, 2011 12:34 pm 
Gosei
User avatar

Posts: 2011
Location: Groningen, NL
Liked others: 202
Was liked: 1087
Rank: Dutch 4D
GD Posts: 645
Universal go server handle: herminator
Its been six months :grumpy:

This is really annoying me every time I post something with diagrams.

Also, its broken because of the bbcode/html parsing anyway (See John Fairbairn's post about Boundary Plays for an example).

Can we please please get this fixed? :roll:

Top
 Profile  
 
Offline
 Post subject: Re: Diagram Captions Should Be Fixed
Post #18 Posted: Wed Feb 02, 2011 3:20 am 
Gosei
User avatar

Posts: 2011
Location: Groningen, NL
Liked others: 202
Was liked: 1087
Rank: Dutch 4D
GD Posts: 645
Universal go server handle: herminator
Please! This cannot be hard.

The sltxt2png script does not normally put text into the image like this, so this really can't be much more than just putting back the original sltxt2png and putting the header text in the body of the post...

Top
 Profile  
 
Offline
 Post subject: Re: Diagram Captions Should Be Fixed
Post #19 Posted: Wed Feb 02, 2011 3:17 pm 
Site Admin
User avatar

Posts: 1125
Location: Allegan, MI, USA
Liked others: 18
Was liked: 121
Rank: KGS 9k
Universal go server handle: Jordus
So I fixed that particular example you gave in john fairburns thread of boundary plays.

I am guessing the issue we are having with the diagrams is that certain characters are not parsed correctly causing the title to enter the image? In the post you gave as an example it was parentheses. Is this the issue?

_________________
I'm thinking...

Top
 Profile  
 
Offline
 Post subject: Re: Diagram Captions Should Be Fixed
Post #20 Posted: Wed Feb 02, 2011 3:25 pm 
Tengen
User avatar

Posts: 4511
Location: Chatteris, UK
Liked others: 1589
Was liked: 656
Rank: Nebulous
GD Posts: 918
KGS: topazg
Some characters are parsing badly

Click Here To Show Diagram Code
[go]$$Wcm30 ()&*£
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . O . . . . . , . . . . . , . . . |
$$ | . . . . . . . . . . . . . . . X . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ | . . . . . . . . . . . . . . . . . . . |
$$ ---------------------------------------[/go]

Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 36 posts ]  Go to page 1, 2  Next

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group