Recent Topics

1 Jun 04, 2005 18:08    

When I try to add named anchors to a post, I get all kinds of problems. Here's the kind of thing I'm trying to do:

Some text that needs a citation (<a href="#footnote">1.</a>)

<a name="footnote">1. a footnote</a>

First it told me that name is not a valid attribute for the a tag. I dug around in _formatting.php and added name to every list that had href. Then it gives me this error (when I try to post the code above):

Invalid post, please correct these errors:

* Found invalid URL: Invalid URL
* Found invalid URL: Invalid URL

Is it really not xhtml valid code? How can I make it believe that those are valid urls?

I think it might me nice to have a little link on the invalid post page that says: Override. If you know the code is valid, or if you want to post it even if it's not valid, it would be nice. We could even make it only available to admins. It would be easier than turning off validation, then turning it back on. It would definitely be easier than mucking around in _formatting.php, which is pretty confusing to me.

2 Jun 06, 2005 19:55

It's really not valid XHTML code.

Named anchors have been deprecated in favor of the ID attribute. Instead of

<p><a name="footnote"></a>Footnote...</p>

you should use

<p id="footnote">Footnote...</p>

page.html#footnote will properly access either one.

What's the URL that's invalid? Is it just because there's an A tag without a HREF?

3 Jun 06, 2005 21:10

I guess I still have a lot to learn about XHTML. I tried your code, but I get

Invalid post, please correct these errors:

* Tag p may not have attribute id

I assume that I can add that in the _formatting.php file. But even then, if I try to add this link:

<a href="#footnote">1.</a>

It's giving me the invalid url message. I can't put the full url in because I'll lose all of the GET data in the permalink.

4 Jun 06, 2005 22:04

Use

<a id="name"></a>

5 Jun 06, 2005 22:08

Invalid post, please correct these errors:

* Tag a may not have attribute id

6 Jun 06, 2005 23:54

Ah, the xhtml-checkup is a bit broken - or there's a reason for this behavior...

7 Jun 07, 2005 00:01

Is there any way to edit the XHTML checker? add things to skip over?

8 Jun 07, 2005 01:39

The file you need to edit is conf/_formatting.php. It's not easy to edit. And I've only had partial success with it. As usual, back it up before you start editing it. It's also possible to disable the validator entirely.

10 Jun 08, 2005 19:59

I got it to work.

In thumbing around the _formatting.php I found this:

'a' => A_attrs.' charset type href hreflang rel rev shape coords target', // Transitional

Looked like the attributes that the checker would allow for the a tag, so I added "id" and "name":

'a' => A_attrs.' charset type href id name hreflang rel rev shape coords target', // Transitional

Now it works fine. Take a look:

[url=http://www.hundiejo.com/philosophy/index.php/a/2005/04/25/philosophy_computers_and_bad_writing]Final for Capstone[/url]

Update: I added "to" and "from" anchors for the footnotes so that readers can go back to where the footnote is in the document after reading the note.

12 Jun 09, 2005 22:31

Hacking _formatting.php to allow the ID attrib on an empty A tag isn't really the way to go.

Look in conf/_formatting.php for this bit:

// Allowed Attribute classes
define('A_coreattrs', 'class title id');
define('A_i18n', 'lang xml:lang dir');
define('A_attrs', A_coreattrs.' '.A_i18n);

That defines ID as one of the A_coreattrs, and then defines A_attrs as the union of A_coreattrs and A_i18n.

Then, there's this bit:


// Array showing allowed attributes for tags
$allowed_attribues = array
(
	// 'div' => A_attrs,								// Strict
	'div' => A_attrs.' '.A_TextAlign,		// Transitional

	// 'p' => A_attrs,								// Strict
	'p' => A_attrs.' '.A_TextAlign,		// Transitional

So, P elements should be allowed to have ID attribs. Not sure why you're having a problem with that. My blog lets me do that just fine. Have you altered _formatting.php before? What version are you using?

The reason why <a id="footnote"></a> is a bad solution is because the A element isn't the footnote, so that "solution" violates a basic principle of semantic markup.

The P element, at the bottom of the page or wherever, actually is the footnote, so it makes more sense to simply identify it as such, with the ID attrib so that the browser can anchor to it with a hyperlink. See?

As for needing the full URL, yes that's somewhat of a PITA. Anyone wanna figger out what has to happen to get around that? I just use the post permalink url with the hash, since that's probably the page that it'll show up on anyhow.

14 Jun 10, 2005 17:25

In the most recent release of B2Evo this is what is in that section of conf_formatting... note no mention of "id"

first instance..

/ Allowed Attribute classes
define('A_coreattrs', 'class title');
define('A_i18n', 'lang xml:lang dir');
define('A_attrs', A_coreattrs.' '.A_i18n);
define('A_TextAlign', 'align');									// Transitional only
define('A_cellhalign', 'align char charoff');
define('A_cellvalign', 'valign');

second instance..

// Allowed Attribute classes
define('C_A_coreattrs', 'class title');
define('C_A_i18n', 'lang xml:lang dir');
define('C_A_attrs', C_A_coreattrs.' '.C_A_i18n);
define('C_A_cellhalign', 'align char charoff');
define('C_A_cellvalign', 'valign');

Is "id" supposed to be there??

15 Jun 10, 2005 20:09

I'm not sure why it was apparently removed (i'm not using the most recent b2evo release - haven't yet had a chance to port all my hacks up to that version.)

It could be simply that ID attribs need to be unique on the document, and we have no way to ensure that's the case.

In any event, you can simply add it to the A_coreattrs definition, rather than defining it just for A tags.

16 Jun 11, 2005 01:00

it could be simply that ID attribs need to be unique on the document

From a standards point of view that is correct and how it should be

I really think personman should be looking at the possibilities of using the <cite></cite> tag in some way.

A detailed post and discussion on quotes and citations can be found at [URL=http://www.456bereastreet.com/archive/200411/quotations_and_citations_quoting_text/]Quotations and citations: quoting text | 456 Berea Street[/URL] and may be some use in providing an alternative solution.

Anchors within posts seems to be a real problem


Form is loading...