Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-02-13 00:06:42

jonlandrum
Member
From: Shi'Kahr
Registered: 2009-11-26
Posts: 35
Website

Add tabs before txp:comment_message? (not a CSS question)

Hi, this is about the code produced by Textpattern. I’ve noticed that paragraphs in comments are indented by one tab character before the opening <p>, and there are two line breaks after the closing </p>. What file do I need to edit to make this produce more than one tab character?


\\//_ Live long and prosper.

Offline

#2 2010-02-13 02:56:57

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: Add tabs before txp:comment_message? (not a CSS question)

Can you post an example of the html output your seeing?


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#3 2010-02-13 03:42:03

jonlandrum
Member
From: Shi'Kahr
Registered: 2009-11-26
Posts: 35
Website

Re: Add tabs before txp:comment_message? (not a CSS question)

Hey, Matt, here’s some sample output: <li> <p>...

This is what I’m using in comments_display: <txp:comments form="comments" wraptag="" break="" />

And this is what the form comments begins with: <li><txp:comment_message />...

There’s a tab character appearing between the <li> and the opening <p> of the comment, but I don’t know where to find it. I’ve temporarily “fixed” it by moving <txp:comment_message /> to its own line, after the Gravatar call, but if there’s a way to adjust how many \t’s Textpattern puts there, I’d love to add a few more so that comments line up with the rest of my code.

Edit: it’s also putting two newline characters at the end of every paragraph, so that there’s an empty line between paragraphs in comments.

Last edited by jonlandrum (2010-02-13 03:44:33)


\\//_ Live long and prosper.

Offline

#4 2010-02-13 03:53:19

jonlandrum
Member
From: Shi'Kahr
Registered: 2009-11-26
Posts: 35
Website

Re: Add tabs before txp:comment_message? (not a CSS question)

Here’s some text from a test comment I posted:
Aenean ut justo felis. </p>

. <p>Phasellus sed justo dolor.
I put the dot on the second line to force the tab to show up.


\\//_ Live long and prosper.

Offline

#5 2010-02-13 15:12:33

nabrown78
Member
From: Northampton, MA, USA
Registered: 2006-10-04
Posts: 294
Website

Re: Add tabs before txp:comment_message? (not a CSS question)

You can choose not to present comments as list, in Preferences. I always do that, and haven’t had this problem. You can always create the list yourself if you do want to use a list.

Offline

#6 2010-02-14 21:30:36

jonlandrum
Member
From: Shi'Kahr
Registered: 2009-11-26
Posts: 35
Website

Re: Add tabs before txp:comment_message? (not a CSS question)

Nora, I may have worded my question wrong. I’m actually putting the <li> in the form myself; I’m not letting TxP do that bit. The question isn’t about the list item, but about the tab character \t that appears before each paragraph of a comment, and the two newline characters \n\n that appear after each paragraph. What I’m looking for is a way to adjust that.

Last edited by jonlandrum (2010-02-14 21:31:06)


\\//_ Live long and prosper.

Offline

#7 2010-02-15 02:35:57

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,315

Re: Add tabs before txp:comment_message? (not a CSS question)

Jonathan, have you tried rah_replace?


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#8 2010-02-15 03:04:31

jonlandrum
Member
From: Shi'Kahr
Registered: 2009-11-26
Posts: 35
Website

Re: Add tabs before txp:comment_message? (not a CSS question)

I have not; I’ll give it a go. It seems that something like this could work:
<txp:rah_replace from="\t,\n\n" to="\t\t\t,\n"><txp:comment_message /></txp:rah_replace>
as long as the plugin doesn’t only affect the comment data itself.


\\//_ Live long and prosper.

Offline

#9 2010-02-15 22:10:34

jonlandrum
Member
From: Shi'Kahr
Registered: 2009-11-26
Posts: 35
Website

Re: Add tabs before txp:comment_message? (not a CSS question)

Didn’t do it. I was wondering about that. There’s got to be a function somewhere, though, that’s putting the tab and line breaks in, but figuring out where it is and writing some code to modify it has turned out to be tougher than I thought.


\\//_ Live long and prosper.

Offline

#10 2010-02-15 22:51:12

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Add tabs before txp:comment_message? (not a CSS question)

jonlandrum wrote:

but if there’s a way to adjust how many \t’s Textpattern puts there, I’d love to add a few more so that comments line up with the rest of my code.

Is the indention such biggie?

Anyways, tabs, like other formating, are caused by Textile markup that is used to format comments.

It seems that something like this could work:

The code will replace \t and \n\n not actual tabs or newlines. Everything used in values are stored as strings.

If tabs, or any other speciality, are required, then they can be used as they are.

<txp:rah_replace from="	" to=" ToNotTab">
	Tab becomes	.
</txp:rah_replace>

as long as the plugin doesn’t only affect the comment data itself.

Replacing stuff from the message will change the message. If the comment contains codeblock bc. with tabs, it will replace those too — of course. But that and only that — the message area, the contained statement.

Last edited by Gocom (2010-02-15 22:55:36)

Offline

#11 2010-02-16 17:46:44

jonlandrum
Member
From: Shi'Kahr
Registered: 2009-11-26
Posts: 35
Website

Re: Add tabs before txp:comment_message? (not a CSS question)

Here’s a screenshot of what I mean, just for clarification:

Note that there is a tab in front of the second paragraph in each comment, and two line breaks after each paragraph. I’ve gotten the first paragraph to line up by indenting <txp:comment_message /> five tabs.

Gocom, no, the indentation isn’t terribly important; everything still renders the same. But I like my code to line up, and if there is a way, I’d love to find out how. If there’s not, I’ll drop it and pretend not to see it! ;~]

Last edited by jonlandrum (2010-02-16 17:48:57)


\\//_ Live long and prosper.

Offline

#12 2010-02-16 21:02:54

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Add tabs before txp:comment_message? (not a CSS question)

Yes, we get what you mean. As I said indention like any other markup in messages are caused by Textile that is used to format the comments.

if there is a way, I’d love to find out how

The answer is in my prev message.

Just remember that replacing and worrying about markup indention:

  1. Only retards like Gocom aka Jukka Svahn use it. Yes, I use the my example myself and it works. Uptil year ago when I stoped using it. It servers no purpose.
  2. It slows the page down and stresses server for no reason.

You should be worried about the initial code layout, not the output layout. It’s always better to have readable page template than frontend markup. That way you can actually manage and update the code.

Last edited by Gocom (2010-02-16 21:08:28)

Offline

Board footer

Powered by FluxBB