MyBB Community Forums

Full Version: indent whole paragraphs
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I'm currently in the proccess of updating old IPB 2.1.7 Boards to newer version then migrating to myBB 1.8.35.
We're fixing issues here and there, and one of them disturbs us a bit more.
We discovered tha myBB is unable to natively treat indented text; :o

as you can see in the link below, our old boards make a heavy use of the [indent] tag, often nested :
myst-aventure.com

So we aim to replace this [indent] bbCode by a [indent] myCode to get the same result.
As far as now, our researches have been unsuccesful.

I created a [indent] myCode :
Regex : \[indent\](.*?)\[/indent\]
Replacement : <div style="text-indent: 50px">$1</div>
It only works for small sentences, shorter than 2 lines. If the paragraph is longer, no indent is applied.

I tried to change the replacement to :
<div style="text-indent: 50px hanging">$1</div>
No good. Sad

So I modified the replacement to
<div class="indent">$1</div>
and added a indent class to the global.css file :
indent {
    color: #a98;
    text-align: left;
    padding-left: 50px;
}
Not better, Firefox inspector shows that these attributes are striked. :o

For a last test, I modified the Replacement by
<div style="left-padding=50px">$1</div>
w/o more success...

I dont understand why it doesn't work. Any clue ?
(2023-07-21, 12:05 PM)Riven de gailande Wrote: [ -> ]So I modified the replacement to
<div class="indent">$1</div>
and added a indent class to the global.css file :
indent {
    color: #a98;
    text-align: left;
    padding-left: 50px;
}
Not better, Firefox inspector shows that these attributes are striked. :o

For a last test, I modified the Replacement by
<div style="left-padding=50px">$1</div>
w/o more success...

I dont understand why it doesn't work. Any clue ?

The selector for class="indent" would be .indent (with a dot) in CSS files; inline style syntax for that property would be padding-left: 50px (different word order, using a colon).
--snip--snip--
(2023-07-21, 07:04 PM)Devilshakerz Wrote: [ -> ]The selector for class="indent" would be .indent (with a dot) in CSS files; inline style syntax for that property would be padding-left: 50px (different word order, using a colon).
Thank you for your reply, will try this ASAP and get back here for results. Smile
Many thanks, I finally decided to use a simple myCode using your syntax and no css.

Quote:Regex
\[indent\](.*?)\[/indent\]
Replacement
<div style="margin-left: 40px;">$1</div>

and it works like a Charm.

Me happy! Smile

I guess I was in too much of a hurry. Sad

If I only use one indent level, it works fine. But as soon as I try to nest a second one, it is not applied...

This works:
[indent]Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi. Proin porttitor, orci nec nonummy molestie, enim est eleifend mi, non fermentum diam nisl sit amet erat. Duis semper.
Duis arcu massa, scelerisque vitae, consequat in, pretium a, enim. Pellentesque congue. Ut in risus volutpat libero pharetra tempor. Cras vestibulum bibendum augue. Praesent egestas leo in pede. Praesent blandit odio eu enim. Pellentesque sed dui ut augue blandit sodales. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aliquam nibh. Mauris ac mauris sed pede pellentesque fermentum. Maecenas adipiscing ante non diam sodales hendrerit.[/indent]

But not that:
[indent]Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi. Proin porttitor, orci nec nonummy molestie, enim est eleifend mi, non fermentum diam nisl sit amet erat. Duis semper.
[indent]Duis arcu massa, scelerisque vitae, consequat in, pretium a, enim. Pellentesque congue. Ut in risus volutpat libero pharetra tempor. Cras vestibulum bibendum augue. Praesent egestas leo in pede. Praesent blandit odio eu enim. Pellentesque sed dui ut augue blandit sodales. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aliquam nibh. Mauris ac mauris sed pede pellentesque fermentum. Maecenas adipiscing ante non diam sodales hendrerit.[/indent][/indent]

Is there a way rto circumvent this issue?
MyCode is not nest ready. I know that YourCode plugin allows nesting (and much more), you can try that.
(2023-07-24, 12:27 PM)Taylor M Wrote: [ -> ]MyCode is not nest ready. I know that YourCode plugin allows nesting (and much more), you can try that.
Thanks alot, will test this one ASAP.
Hi, as I suspected, I can't install yet YouCode as my server runs php 5.2 (too old for the plugin). Can't upgrade php for now as I also run other projects wich need php to be this old...

I'll give it a try when my other projects are done and mark this thread as Solved as it's not an issue of the plugin.
As an alternative you can create nest ready indent mycodes by adding numbers.

Do the same as [indent] but name it [indent2] and [indent3] and so on.
Thanks for the tip.
Unfortunatly, I won't be able to use it as we're migrating from a 50k+ posts IP Board and won't check every single post to fix it.