• Hi,

    I have submitted an html document (adapted from html msoffice) as a new article.

    I get after running the display a document which contains in several cases the tag <br /> replacing the CRLF (hexa x0D0A) which should be simply ignored (participating to a clear display of the HTML).

    This introduces lines break which make the article not readable normally.
    Note that the display of the html source into any navigator has no problem at all.

    I could not determine with precision the circumstances but I have that it is always after :

    • tag
    • tag </span>
    • tag <span ….> (with style or others parameters)

    When there are imbricated tags (i.e. span into a span tag, span into a “a” tag, span into a header, a tag into header etc…

    I first have chacked my own plugins (not published, waiting for being able to build a team). By checking the ob of the filter on the_content, I could verify that it was clean.
    Then I think that there is probably a plugin which adds a filter which fails (replacement, shortcode holding, analysis failure of the html syntax.

    For my plugin I have added two code sequences which check the ob input and ob output and reports the tags (<br /> with a preceding chain of chars for identification of the sequence).

    It seems difficult to write the same for all my plugin which activates filters.

    More, this is my first question, I don’t know how to list the filters on the_content in the order of execution.

    Can you help me

    Best regards

    Trebly

    • This topic was modified 5 years, 6 months ago by Trebly.
Viewing 2 replies - 1 through 2 (of 2 total)
  • You can put code like this in your plugin to record all the hooks. I remove gettext and escape because there are way too many of them. I commented out the code for getting the arguments, but you could use that to see what is being passed to a hook. It is quite lengthy if you print all of them (and recursive).

    add_action( 'all', '_action_printer' );
    function _action_printer( $a ){
    	if (strpos('gettext', $a) === false && strpos('escape', $a) === false) {
    	//	$x = func_get_args();
    	//	$x = print_r($x, true);
    		error_log( $a .  "\n", 3, dirname(__FILE__). '/../../debug.log');
    	}
    }

    Or change it to only print when $a === 'the_content'.
    Or you can try to use var_dump on the $wp_filter['the_content'] global, at the right time.

    Thread Starter Trebly

    (@trebly)

    Hi,

    Thank you, this will be very useful.
    During this short time, I have gone on in searching in plugins and compare several operations on html source.

    I found the problem, but I have no immediate solution.

    I go on using tinyMce with the plugin WP-edit-pro better than Gutemberg (Could not find time to test and get the habit of using Gutenberg on my site).

    I just discovered it was a parameter problem in tinymce :
    In my configuration all the text content (remaining when tags are ignored) are treated as if they were enclosed into a whole >pre< tag then all chars normally ignored in html (treated as html editor formatting data) are converted to html encoding by the use of “htmlspecialchars” or “htmlentities”.

    Then what happens is that when you import by copy-paste html into an article in text mode of the editor, your content is treated (for the content: excluding tags) as >pre< element. Then an x0D0A (used to display the tags) to get a readable html code will be converted to tag “<br />” and so on…

    I am searching for the tinymce parameters which can manage “copy-paste” as copy of “html” content and not “>pre<…” block of text…

    I am sure that I will find what is to be defined into the init parameters block of tinyMce.

    What is not normal is that the “text” mode of the editor displays what seems to be html code while it is not by default.

    Since I began to write this answer I have gone to read tinyMce documentation (outside of WP refs). I found in this subject ” default paste filters” defined into the tinyMce init, but the question is that this concept “default paste filters” has no content because searching into the tinymce site and searching google you cannot find the list of these default filters…

    So, I lost two days because there are (the authors) unable to communicate. One of my criteria is that when a concept (semantic group) is used as “default paste filters” the concept must be found into a glossary or using web search motors or a general language dictionary, if not the concept is an auto-reference to a internal concept used by a group of persons (generally the conceptors of the product) with no meaning to the others, the common users… Then the sentence using the concept has no meaning, out of sense for whom is not inside the conceptors team…

    For now I still do not have access to the detailed meaning of “default paste filters”, what are these “default paste filters” ?, where are they described ? need to read the source code of tinyMce ?

    Best regards, thanks again because I will use your code for other purposes .

    Bye

    Trebly

    • This reply was modified 5 years, 6 months ago by Trebly.
    • This reply was modified 5 years, 6 months ago by Trebly.
    • This reply was modified 5 years, 6 months ago by Trebly.
    • This reply was modified 5 years, 6 months ago by Trebly.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Curious replacement of CRLF by tag’ is closed to new replies.