Textpattern CMS support forum

You are not logged in. Register | Login | Help

#11 2019-08-27 12:20:09

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 3,547
Website

Re: <img> sometimes in a <p> tag ... sometimes not ... !?

Kjeld wrote #319161:

It worked!

Thanks for confirming that. I’ve updated the plugin on GitHub and in the post above.


TXP Builders – finely-crafted code, design and txp

Offline

#12 2019-08-27 12:23:09

Kjeld
Member
From: Tokyo, Japan
Registered: 2005-02-05
Posts: 253
Website

Re: <img> sometimes in a <p> tag ... sometimes not ... !?

Just a final note on this plugin. Instead of transforming a double line between paragraphs into </p><p>, it transformed it into <br /><br />).

This may not be what some users may hope for…


JapaneseStreets.com – Japanese street fashion (mostly txp)
Old Photos of Japan – Japan between 1860 and 1940 (100% txp)
MeijiShowa – Stock photos of Japan between 1860 and 1940 (100% txp)

Offline

#13 2019-08-27 17:06:53

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 3,547
Website

Re: <img> sometimes in a <p> tag ... sometimes not ... !?

Kjeld wrote #319164:

Just a final note on this plugin. Instead of transforming a double line between paragraphs into </p><p>, it transformed it into <br /><br />).

Hmm, strange. It should just run each article through textile. The only thing I changed in Netcarver’s original plugin was to use the new method of calling textile: (here). Maybe the standard use of textile is not correct, or maybe it’s a problem with textile (possibly in combination with your specific situation).

Maybe a dev can shed some light on this?


TXP Builders – finely-crafted code, design and txp

Offline

#14 2019-08-28 01:17:22

Kjeld
Member
From: Tokyo, Japan
Registered: 2005-02-05
Posts: 253
Website

Re: <img> sometimes in a <p> tag ... sometimes not ... !?

jakob wrote #319167:

Hmm, strange. It should just run each article through textile. The only thing I changed in Netcarver’s original plugin was to use the new method of calling textile: (here). Maybe the standard use of textile is not correct, or maybe it’s a problem with textile (possibly in combination with your specific situation).

Maybe a dev can shed some light on this?

Possibly my particular situation has something to do with it.

I removed all <br /><br /> tags from the posts using a mySQL function in PHPmyAdmin. This left two empty lines in the articles. I assumed that the plugin would replace these empty lines with </p><p> because that is what Textile creates in the database when I just save such an article in txp itself.

One mystery solved, and a new one raises its head… 😅


JapaneseStreets.com – Japanese street fashion (mostly txp)
Old Photos of Japan – Japan between 1860 and 1940 (100% txp)
MeijiShowa – Stock photos of Japan between 1860 and 1940 (100% txp)

Offline

#15 2019-08-28 08:09:16

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 3,547
Website

Re: <img> sometimes in a <p> tag ... sometimes not ... !?

Kjeld wrote #319173:

Possibly my particular situation has something to do with it.

I removed all <br /><br /> tags from the posts using a mySQL function in PHPmyAdmin. This left two empty lines in the articles. I assumed that the plugin would replace these empty lines with </p><p> because that is what Textile creates in the database when I just save such an article in txp itself.

Hmm, this is what comes of taking over plugin orphans without being a pro. I’m not entirely sure why that’s happening. After making a backup of the textpattern table, sed_textile_upgrade simply runs every article through textile again. It doesn’t actually do anything extra of its own accord.

My update switches it from the old pre tip v4.6 Textile method to the current method (in this changeset) and it is conceivable I have not specified the correct settings, but I think it is correct. I’ve simply used the regular Textile->parse method (e.g. here and here) without setting any special options. When I look at the article saving routine in textpattern, it additionally sets the option Lite to false (e.g. here) but as far as I can tell that is already the default setting (here).

If you want to try and see if you get better results by forcing ‘Lite’ to off, you could try altering lines 82 and 86 of the sed_textile_upgrade plugin code as follows (inserting ->setLite(false)):

L82: $set[] = "Body_html    = '" . doSlash( $textile->setLite(false)->parse( $info['Body']    ) ) . "'";
L86: $set[] = "Excerpt_html = '" . doSlash( $textile->setLite(false)->parse( $info['Excerpt'] ) ) . "'";

You’ll probably need to first restore your backup textpattern table to be able to repeat the process on your original articles.


TXP Builders – finely-crafted code, design and txp

Offline

#16 2019-08-28 09:00:17

Kjeld
Member
From: Tokyo, Japan
Registered: 2005-02-05
Posts: 253
Website

Re: <img> sometimes in a <p> tag ... sometimes not ... !?

jakob wrote #319174:

Hmm, this is what comes of taking over plugin orphans without being a pro. I’m not entirely sure why that’s happening. After making a backup of the textpattern table, sed_textile_upgrade simply runs every article through textile again. It doesn’t actually do anything extra of its own accord.

My update switches it from the old pre tip v4.6 Textile method to the current method (in this changeset) and it is conceivable I have not specified the correct settings, but I think it is correct. I’ve simply used the regular Textile->parse method (e.g. here and here) without setting any special options. When I look at the article saving routine in textpattern, it additionally sets the option Lite to false (e.g. here) but as far as I can tell that is already the default setting (here).

If you want to try and see if you get better results by forcing ‘Lite’ to off, you could try altering lines 82 and 86 of the sed_textile_upgrade plugin code as follows (inserting ->setLite(false)):

L82: $set[] = "Body_html = '" . doSlash( $textile->setLite(false)->parse( $info['Body'] ) ) . "'";...

You’ll probably need to first restore your backup textpattern table to be able to repeat the process on your original articles.

Wow, thanks for all the input, Jakob. I will keep this in mind for future use.


JapaneseStreets.com – Japanese street fashion (mostly txp)
Old Photos of Japan – Japan between 1860 and 1940 (100% txp)
MeijiShowa – Stock photos of Japan between 1860 and 1940 (100% txp)

Offline

Board footer

Powered by FluxBB