Correct semantic markup for WYSIWYG

Do not post support requests, bug reports or feature requests. Discuss phpBB here. Non-phpBB related discussion goes in General Discussion!
Suggested Hosts
Post Reply
edu81
Registered User
Posts: 26
Joined: Sun Jun 21, 2009 6:18 pm
Location: Spain

Correct semantic markup for WYSIWYG

Post by edu81 » Fri Aug 30, 2013 10:49 am

Hi, the current WYSIWYG don´t support correct semantic markup.

For example, for highlighted text, writes <span style="font-weight: bold">, instead <strong>
Other example, for the paragraphs, uses <br>, instead of <p> ....

Anybody knows a semantic editor for phpbb3?
Last edited by edu81 on Fri Aug 30, 2013 11:06 am, edited 1 time in total.

User avatar
Arty
Former Team Member
Posts: 16654
Joined: Wed Mar 06, 2002 2:36 pm
Name: Vjacheslav Trushkin
Contact:

Re: Correct semantic markup for WYSIWYG

Post by Arty » Fri Aug 30, 2013 10:51 am

You can replace that in styles/prosilver/template/bbcode.html
Vjacheslav Trushkin / Arty.
Free phpBB 3.1 styles | New project: Iconify - modern SVG framework

edu81
Registered User
Posts: 26
Joined: Sun Jun 21, 2009 6:18 pm
Location: Spain

Re: Correct semantic markup for WYSIWYG

Post by edu81 » Fri Aug 30, 2013 11:12 am

Is strange, for example, In bbcode.html I view:


<!-- BEGIN b_open --><strong><!-- END b_open -->
<!-- BEGIN b_close --></strong><!-- END b_close -->


But, highlighted text still show <span style="font-weight: bold">

Thanks for your help.

User avatar
Arty
Former Team Member
Posts: 16654
Joined: Wed Mar 06, 2002 2:36 pm
Name: Vjacheslav Trushkin
Contact:

Re: Correct semantic markup for WYSIWYG

Post by Arty » Fri Aug 30, 2013 11:15 am

Right. Its one of hardcoded bbcodes. I'm not sure why its even in bbcode.html then, looks like a bug.

Edit this code in includes/bbcode.php

Code: Select all

			$bbcode_hardtpl = array(
				'b_open'	=> '<span style="font-weight: bold">',
				'b_close'	=> '</span>',
				'i_open'	=> '<span style="font-style: italic">',
				'i_close'	=> '</span>',
				'u_open'	=> '<span style="text-decoration: underline">',
				'u_close'	=> '</span>',
				'img'		=> '<img src="$1" alt="' . $user->lang['IMAGE'] . '" />',
				'size'		=> '<span style="font-size: $1%; line-height: normal">$2</span>',
				'color'		=> '<span style="color: $1">$2</span>',
				'email'		=> '<a href="mailto:$1">$2</a>'
			);
Vjacheslav Trushkin / Arty.
Free phpBB 3.1 styles | New project: Iconify - modern SVG framework

edu81
Registered User
Posts: 26
Joined: Sun Jun 21, 2009 6:18 pm
Location: Spain

Re: Correct semantic markup for WYSIWYG

Post by edu81 » Fri Aug 30, 2013 11:52 am

Ok, now works!

Thank you very much!

Any idea for replacing the "<br>" tag, for "<p>" tag?

example:

Code: Select all

"<p>paragraph</p><p>other paragraph</p>"
instead of:

Code: Select all

"paragraph<br>other paragraph"

User avatar
Arty
Former Team Member
Posts: 16654
Joined: Wed Mar 06, 2002 2:36 pm
Name: Vjacheslav Trushkin
Contact:

Re: Correct semantic markup for WYSIWYG

Post by Arty » Fri Aug 30, 2013 12:09 pm

It won't work because there are nested quote, code, attachments and possibly other block level elements that can't be placed inside <p>
Vjacheslav Trushkin / Arty.
Free phpBB 3.1 styles | New project: Iconify - modern SVG framework

User avatar
Lumpy Burgertushie
Registered User
Posts: 66724
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: Correct semantic markup for WYSIWYG

Post by Lumpy Burgertushie » Fri Aug 30, 2013 2:10 pm

besides , <p> and <br /> are two different things.

<br /> denotes a simple line break/new line and <p> denotes a paragraph

robert
I'm baaaaaccckkkk. still doing work on donation basis. PM your needs.

Premium phpBB 3.2 Styles by PlanetStyles.net

If a tree falls in the forest and nobody is there, does it make a sound?

Pony99CA
Registered User
Posts: 4783
Joined: Thu Sep 30, 2004 3:13 pm
Location: Hollister, CA
Name: Steve
Contact:

Re: Correct semantic markup for WYSIWYG

Post by Pony99CA » Fri Aug 30, 2013 8:49 pm

Arty wrote:Right. Its one of hardcoded bbcodes. I'm not sure why its even in bbcode.html then, looks like a bug.
I thought that I read over on Area51 that putting it there allowed styles to override the formatting of the standard BBCodes.

Steve
Silicon Valley Pocket PC (http://www.svpocketpc.com)
Creator of manage_bots and spoof_user (ask me)
Need hosting for a small forum with full cPanel & MySQL access? Contact me or PM me.

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51863
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Correct semantic markup for WYSIWYG

Post by Brf » Fri Aug 30, 2013 8:53 pm

Pony99CA wrote:
Arty wrote:Right. Its one of hardcoded bbcodes. I'm not sure why its even in bbcode.html then, looks like a bug.
I thought that I read over on Area51 that putting it there allowed styles to override the formatting of the standard BBCodes.

Steve

Only if it is not hardcoded. Though I am pretty sure you can override the hardcoded ones by setting the proper bits in this:

Code: Select all

# Defining a different template bitfield
template_bitfield = lNg=
in template.cfg

Pony99CA
Registered User
Posts: 4783
Joined: Thu Sep 30, 2004 3:13 pm
Location: Hollister, CA
Name: Steve
Contact:

Re: Correct semantic markup for WYSIWYG

Post by Pony99CA » Fri Aug 30, 2013 8:59 pm

Lumpy Burgertushie wrote:besides , <p> and <br /> are two different things.

<br /> denotes a simple line break/new line and <p> denotes a paragraph
I think that his point is that paragraphs here (usually indicated by leaving a blank line to indicate a new paragraph) aren't surrounded by <p> and </p> tags; instead, the blank lines are indicated by <br /> tags.

That seems reasonable as the software can't "guess" whether the user wanted a new paragraph or just some blank lines.

Steve
Silicon Valley Pocket PC (http://www.svpocketpc.com)
Creator of manage_bots and spoof_user (ask me)
Need hosting for a small forum with full cPanel & MySQL access? Contact me or PM me.

Pony99CA
Registered User
Posts: 4783
Joined: Thu Sep 30, 2004 3:13 pm
Location: Hollister, CA
Name: Steve
Contact:

Re: Correct semantic markup for WYSIWYG

Post by Pony99CA » Fri Aug 30, 2013 9:05 pm

edu81 wrote:Hi, the current WYSIWYG don´t support correct semantic markup.

For example, for highlighted text, writes <span style="font-weight: bold">, instead <strong>
Just FYI, phpBB doesn't have WYSIWYG. You mean that BBCodes don't (always) generate semantic markup.

Also, I would not say that the markup is "incorrect" even. The tags clearly specify B (for Bold) and I (for Italics), not S (for Strong) or E (for Emphasis). Therefore, they are presentational tags, not semantic ones, and the markup is correct. ;) If anything, bbcode.html has incorrect markup using STRONG and EM tags.

Steve
Silicon Valley Pocket PC (http://www.svpocketpc.com)
Creator of manage_bots and spoof_user (ask me)
Need hosting for a small forum with full cPanel & MySQL access? Contact me or PM me.

edu81
Registered User
Posts: 26
Joined: Sun Jun 21, 2009 6:18 pm
Location: Spain

Re: Correct semantic markup for WYSIWYG

Post by edu81 » Sat Aug 31, 2013 4:30 pm

That seems reasonable as the software can't "guess" whether the user wanted a new paragraph or just some blank lines.
With many markup editors It is not necessary to guess, example:

If you press "enter", you're creating a paragraph.
If you press "shift+enter", you're creating a line break (blank lines)

example: http://files.wymeditor.org/wymeditor-1. ... basic.html
Just FYI, phpBB doesn't have WYSIWYG. You mean that BBCodes don't (always) generate semantic markup.
You are right.

I hope, that next major release of phpbb3, has a new simple editor with correct markup features. (Anyway I will try make a mod for this :? )

Have a correct semantic markup is good for accessibility, SEO and quality of forum content.

Thanks to all.

User avatar
Lumpy Burgertushie
Registered User
Posts: 66724
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: Correct semantic markup for WYSIWYG

Post by Lumpy Burgertushie » Sat Aug 31, 2013 4:37 pm

"correct semantic markup" is often open to interpretation.

my opinion is that it will have little to no affect on "accessibility, SEO and quality of forum content"

depending on exactly what markup you are talking about.

the ones you mention here would certainly have zero affect on SEO or the quality of forum content.
and even accessibility is doubtful since most readers still work just fine with b and i etc.


robert
I'm baaaaaccckkkk. still doing work on donation basis. PM your needs.

Premium phpBB 3.2 Styles by PlanetStyles.net

If a tree falls in the forest and nobody is there, does it make a sound?

User avatar
DionDesigns
Registered User
Posts: 515
Joined: Sun Feb 26, 2012 11:22 pm
Location: Uncertain due to momentum.
Contact:

Re: Correct semantic markup for WYSIWYG

Post by DionDesigns » Sat Aug 31, 2013 6:06 pm

edu81 wrote:With many markup editors It is not necessary to guess, example:

If you press "enter", you're creating a paragraph.
If you press "shift+enter", you're creating a line break (blank lines)
You seem to be under the (mistaken) impression that phpBB is a word processor. Posts in phpBB contain many types of elements, not just paragraphs. Your post above is a good example of this.

You also seemed to miss the following:
Arty wrote:It won't work because there are nested quote, code, attachments and possibly other block level elements that can't be placed inside <p>
This is why you will doubtfully ever see <p> tags used for post content in phpBB.
edu81 wrote:Have a correct semantic markup is good for accessibility, SEO and quality of forum content.
That's some pretty powerful snake oil you're using. Better be careful. ;)

Pony99CA
Registered User
Posts: 4783
Joined: Thu Sep 30, 2004 3:13 pm
Location: Hollister, CA
Name: Steve
Contact:

Re: Correct semantic markup for WYSIWYG

Post by Pony99CA » Wed Sep 04, 2013 9:57 pm

DionDesigns wrote:You also seemed to miss the following:
Arty wrote:It won't work because there are nested quote, code, attachments and possibly other block level elements that can't be placed inside <p>
This is why you will doubtfully ever see <p> tags used for post content in phpBB.
To be fair, with a more powerful editor, opening any of those tags could close an open P tag. There is some talk of doing things like that over at Area 51. For example, see the Integrate s9e\TextFormatter RFC topic (toward the end).

However, until we have a better formatter (and possibly a WYSIWYG editor), I don't think that it's a big deal right now.

Steve
Silicon Valley Pocket PC (http://www.svpocketpc.com)
Creator of manage_bots and spoof_user (ask me)
Need hosting for a small forum with full cPanel & MySQL access? Contact me or PM me.

Post Reply

Return to “phpBB Discussion”