Support » Plugin: Sectionize » [Plugin: Sectionize] id generation may produce illegal name or id

  • The code generationg the identifier (id) for the section may produce illegal or confusing name not starting with [a-z] and not followed by only allowed characters. Actually, when a title contains special chars like “élément” it makes use of RFC2396 %xy chars not allowed as identifiers.
    As stated in the (work in progress) regarding identifiers in HTML5 :
    http://dev.w3.org/html5/spec/elements.html#concept-id
    IDs may follow sames rules as RFC2396 but it is not decided and is not actually handled nor by Firefox4 (see https://bugzilla.mozilla.org/show_bug.cgi?id=643275) nor by Opera 11)

    As recalled in the HTML5 working drafts:
    “Identifiers are opaque strings. Particular meanings should not be derived from the value of the id attribute”

    Sectionize should not generate id from heading text but use sequence or random numbers.

    Thus I suggest the following approach using the existing counter in generating id :

    117c117
    < $id = apply_filters(‘sectionize_id’, $id_prefix . $sanitizedTitle, $id_prefix, $headingText);

    > $id = apply_filters(‘sectionize_id’, $id_prefix . strval($i), $id_prefix, strval($i));

    http://wordpress.org/extend/plugins/sectionize/

  • The topic ‘[Plugin: Sectionize] id generation may produce illegal name or id’ is closed to new replies.