Recent Topics

1 Dec 11, 2005 18:29    

Hi, hope I can find a solution on this board. My users request to indent the first line of each paragraph automatically, which I can only do for the first paragraph when .bText is defined as text-indent: 2em; in ccs. but not anything below the first para since <br> is used for line break. is there anyway I can make this work for any paragraph by css?

thank you for help!

be well,

keleding

2 Jan 11, 2005 05:21

Having you tried adding something like this to the style sheet?


/* paragraph indentation */
p.bText {
     text-indent: 15px;
}

3 Dec 07, 2005 10:14

It does not work to me.

I also like an indent EVERY time I press "enter" key.

Any idea?

Thanks,

Francesco

4 Dec 11, 2005 12:32

Hi Francesco,

Your main problem is that unless you hit enter twice the auto p will not actually start a new paragraph.

Add this code to the top of your css and it'll indent your paragraphs :-

.storycontent p{
text-indent:1em;
}

¥

5 Dec 11, 2005 13:10

Thank you, Yabba; but the problem remains. With that piece of code, it intends only the first line.
If I press "enter" twice, I get a space within the text; indeed, what I want is simply an indent every time I press "enter" ONCE. Is it possible?

6 Dec 11, 2005 14:33

Ok, if you want to indent the whole paragraph, change text-indent:1em to padding-left:1em;

If you want it to indent the first line of every paragraph then you either need to press enter twice so that auto-p creates a new paragraph, or, you need to turn auto-p off and use <p></p> tags around your paragraphs.

¥

7 Dec 11, 2005 17:14

Uhm, I didn't manage to explain myself :)

I want to indent ONLY the first line that I create everytime I press "enter" once.

I mean
this one indented
and this one too,
and so on.

Not the whole paragraph, nor only the first line of a paragraph (if that means I have to break a line in the text).
Just like the books, you know? (see [url=http://books.google.com/books?ie=UTF-8&hl=en&id=ilSZ8X5ZmvoC&dq=il+corpo+galimberti&prev=http://books.google.com/books%3Fq%3Dil%2Bcorpo%2Bgalimberti&lpg=PA48&pg=PA49&sig=8FZep92ZcBbFbydPpvG2lLETm5I]an example[/url]; you must have a google account, but I think you have one)

Am I clear now?

Thank you guy,

Francesco

8 Dec 11, 2005 17:54

Hi Francesco,

Sorry to dissapoint you, but I don't have a Goggle account :p

About the nearest you could get to what you want is to have a renderer plugin convert all <br /> to <br />&nbsp;&nbsp;

¥

9 Dec 11, 2005 18:04

Ok, I think now you can watch what I linked.

So: the renderer plugin idea is not bad at all; since I don't know anything about doing it by myself, shall I ask into the "request a plugin or hack" subforum?

Thanks,

Francesco

10 Dec 11, 2005 18:29

Hi,

in order to have a better indentation, I'd like to have a little hack that transforms a <br /> to <br />&nbsp;&nbsp;

So, everytime I hit "enter" key, I'll get a little indentation (that's exactly what happens in books formatting).

Any hint?

Thanks in advance,

Francesco

11 Dec 11, 2005 18:32

Hi Francesco,

Wow, I suddenly appear to be able to follow your link ;)

Ok, if that's the effect you want, you'd still have to press enter twice, you could just add :-

.storycontent p{
text-indent:1em;
margin:0;
}

A plugin wouldn't be to hard, unfortunately all I have installed at the moment is Pheonix alpha/post alpha so I can't just rattle one off for you.

If you want to make it a request then the request subforum is deffinately the place to post.

¥

12 Dec 11, 2005 18:45

Request just left there.

About your hint, it works great. The only flaw I encoutered is that I can't divide a paragraph any longer (a blank line between 2 paragraphs); in fact, if I press several times "enter" key, it doesn't break the line anymore (I think it's because of "margin: 0").

Btw, waiting for the plugin, it's a great hint I'll sure use!

Thanks (another free-beer),

Fra

13 Dec 11, 2005 19:09

Damn, if I keep this up I can come to Rome with you ...... pretty sure my G/F's already left, but what the hell :p

Your problem is caused by the margin:0 , a cure for that is to press enter for indent and press enter space enter for paragraphs.
¥

*edit*
sorry, thats enter enter for indent and enter space enter enter for paras.

14 Dec 11, 2005 20:15

Take a look into /plugins/renderers/. There's the auto-P plugin.

Just copy that and adopt it to match your needs. You could set it to apply always for example.

The text-replacing part would actually simply be:

str_replace( '<br />', '&nbsp;&nbsp;<br />', $text );

See the other plugins for details.

With Phoenix the plugin system will be refactored, so I don't want to dig into the old ones for now, sorry.

15 Dec 11, 2005 22:55

Hi blue,

I already use Phoenix (great!), and I found the file you told me exactly where it should be. The only thing I don't know is how to put the code-line you gave me...

Yabba: that trick doesn't work out for me :( Did you mean to press "enter", then "space", then "enter" and "enter" again in a sequence? I did this way, and it resulted simply in an indented line.

Thank you all guys for your amazing support: I won't forget it!

16 Dec 12, 2005 01:24

Ok, I've hacked together a plugin. It should work with Phoenix-Alpha and Phoenix-Beta (to be released), where the Plugins are refactored again (slightly) to improve performance and allow Settings to be used.

I'm not sure though if it's what you mean, as it just puts a 2 non-breaking spaces (by default) after each <br> tag that has a non-whitespace character after it.

get it from: http://codeprobe.de/pub/b2evo/_indent_br.plugin.phps (and save it with ".php" extension into /plugins/ folder)

17 Dec 12, 2005 09:28

If those hieroglyphics do what you say, I will be absolutely satisfied ;)

Just another thing: how shall I use it, in order to get it work?

Thanks a lot!

18 Dec 12, 2005 16:30

Put it into /plugins/, aktivate it in "Settings / Plugins", choose it as renderer for a new item or edit items/posts to use it as renderer (fieldset in the lower right on the "Write" tab).

19 Dec 12, 2005 16:36

I saved it as "_indentation.plugin.php" and putted into /plugins.
When I go into settings => plugins, the backoffice shows me this writing:

Parse error: parse error, unexpected T_STRING, expecting ')' in /web/htdocs/www.silenzi.com/home/plugins/_indentation.plugin.php on line 41

What's wrong?

20 Dec 12, 2005 17:06

It's because of the "=>" getting replaced by arrow smileys. I've linked it. See first post.

21 Dec 12, 2005 17:18

Man, you rock! This plugin is state-of-the-art :) You should implement as a core item ;)
A feedback: what's for the first line of the post? It don't get indented :\ Is there something you can do?
And: is there a way to set this option as default, to be applied to every post (even to past posts would be great)?

Thanks, really!

Francesco

22 Dec 12, 2005 17:53

Sure. Re-download it. I've changed the preg_replace() to also insert the $indent string after any opening <p> tags.

23 Dec 12, 2005 19:46

very last thing: on my [url=http://www.silenzi.com] blog [/url] I use LEAF skin, that uses a grey block to make blockquotes.
I suppose that code makes a "top margin:1" (or something like that), because now I get a double br on the top when I use blockquotes, and just one at the end.
What a shitty explanation: better to go to my website and look yourself what I'm trying to explain ;)
So: any hint to solve this issue? I tried digging into my .css, but I didn't manage to find anything related to blockquote thing.

24 Dec 12, 2005 20:00

Try :-
text text text<blockquote>

;)

¥

25 Dec 12, 2005 20:20

uh? Could you explain that more clearly? I think I didn't catch the sense (if it isn't a joke, of course) :)
My english is so rude, so I still often run into misunderstandings :\ I hope you'll understand!

26 Dec 12, 2005 20:57

Sorry Francesco, I keep making abreviated posts

Ok, you asked for <enter> to be converted to <enter>+<space>+<space> thats what is causing your problem with your <blockquote>

A <blockquote> always starts on a new line, so the <enter><space><space> above it is shown as a gap, ie :-
text text text<enter>
<space><space>
<blockquote>

So, if you put the blockquote (with no <enter> )after your text, it'll be on a newline without the gap, ie :-
text text text<blockquote> looks like :-
text text text<noenter>
<blockquote>

If that's not clear then I'm gonna plead the fact that I'm blonde :p

¥

27 Dec 12, 2005 21:13

I already use your syntax, i.e. (for my last post):

scorso:<blockquote> Diecimila euro di ammenda e l' ammonizione.

and it results in a double space before, and just one after. How it could be?!

28 Dec 12, 2005 21:53

From a very brief read of Blueyed' plugin, try changing this line in the plugin code :-
var $priority = 80;
to:-
var $priority = 10;

¥

29 Dec 12, 2005 21:56

uselessy tried. It didn't work out :°

30 Dec 12, 2005 22:03

lol, damn, it's never the easy anaswers :p

if you don't get answer sooner, when I get chance later I'll have a real look and see if we can solve this (sorry, gotta go pretend to have a real life for a tad ;) ).

¥

31 Dec 12, 2005 22:07

You want WHAT?! A real life?! Buddy, you're gonna look TOO MUCH assumptive, don't you? Go back to your keyboard and code out a flawless piece of code. Only after that I'll open the window and let some good hoxygen enter the room. IF you only behave good.

;)

Obviously, check it out only when you're free, and thank you for all the support you gave me.

32 Dec 12, 2005 23:55

There is a bug with the Auto-P plugin, at least if you don't put <blockquote> not on a new line.

And I've produced a bug myself in the indent_br plugin. Just get the new one (or put brackets around the "<p>": "'~(<p>)~i', // an opening paragraph").

I'll write a unit testcase for the Auto-P plugin and try to fix it. You might be set when writing like:

text text
<blockquote>Your quote</blockquote>
text text

But that will produce another problem: it will create a <p> inside the <blockquote> (I guess that is expected), but the indent_bt plugin will indent the beginning of the <p> (inside the <blockquote>). If that is what you want, fine. If not, just complain.. ;)

33 Dec 13, 2005 01:08

ou want WHAT?! A real life?! Buddy, you're gonna look TOO MUCH assumptive, don't you? Go back to your keyboard and code out a flawless piece of code. Only after that I'll open the window and let some good hoxygen enter the room. IF you only behave good.

:p

¥

34 Dec 13, 2005 10:15

State-of-the-art. Thank you so much, guys :)))))
I can afford to set my <blockquote> that way and get its test "paragraphed" into the blockquote. Simply fuckin' genius :D

Francesco

P.S.: Free beer, of course.

35 Feb 09, 2006 23:44

Hi, folks. I believe that I'm in the same boat as papzadsl here was, as I wish for every new line to be interpreted as a new paragraph (and for that paragraph to be indented) by the Auto-P feature, and while I don't doubt that inserting the non-breaking spaces will create a perfectly acceptable indent, I would rather maintain as much control of my page's appearance through CSS as possible. So, the only text indents that I want to see on my page are the ones generated by the text-indent style, which, I suppose leads me to my plea:

I'm basically incompenent with PHP (bet you didn't see that one coming ;) ) and need to figure out how to alter the _auto_p.renderer.php file so that it 1) doesn't insert <br /> tags, and 2) will insert <p> and </p> tags surrounding strings which follow a single line break. Currently of course, it will only actually generate the paragraph tags after a double line break, which is the problem that I believe both papzadsl and I were having. Stopping Auto-P from generating <br /> tags wasn't much of a feat, requiring only that I set the variable $br to false in the line

	var $br = true; 	// optionally make line breaks

However, I still need to force it to render paragraph tags after single line breaks. This may seem counterintuitive, but it meets my needs. The renderer seems to work by seeking out all double line breaks, which are represented by \n\n, are they not? It also converts double <br />'s to \n\n and possibly converts two or more \n's so they are just \n\n, I'm really not sure, but that all seems to happen here:

$pee = preg_replace('|<br />\s*<br />|', "\n\n", $pee);	// Change double BRs to double newlines

// Space things out a little:
$pee = preg_replace('!(<(?:table|thead|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|p|h[1-6])[^>]*>)!', "\n$1", $pee); 
$pee = preg_replace('!(</(?:table|thead|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|p|h[1-6])>)!', "$1\n", $pee);

$pee = preg_replace("/(\r\n|\r)/", "\n", $pee); // cross-platform newlines 

$pee = preg_replace("/\n\n+/", "\n\n", $pee); // take care of duplicates

The offending line, which actually converts the \n\n's to <p> tags and ensures that a </p> follows the ensuing paragraph, seems to be:

// make paragraphs, including one at the end :
$pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "\t<p>$1</p>\n", $pee);

But those operators and escape characters are all Greek to me, and I can't make heads or tails of the code, let alone figure out how to alter it so it creates new paragraphs from single line breaks and not double line breaks. Could one of the resident code gurus share some of your insight, please?


Form is loading...