No more Nested quotes

Snitz™ Forums 2000
https://forum.snitz.com/forumTopic/Posts/67201?pagenum=1
05 November 2025, 10:42

Topic


SiSL
No more Nested quotes
04 June 2008, 19:00


Ok been long time since I've had with the mods, here is my little mod (I'm not sure if it has been made before)

NMNQ MOD 1.0
This mod removes internal quotes of a quoted post. In other words, when you quote a message that has quoted another, you won't get previously quoted message inside, therefor removes cluttering chain quotes (ofcourse if done on purpose that's whole another reason)

Download: No More Nested Quotes
INSTALL
It is very simple process really. Two files modified.

inc_func_posting.asp
Find following line:
Code:
function CleanCode(fString)


around line 88 and above this line add following:

Code:
Function CleanQuotes(fString)
if fString <> "" AND IsNull(fstring) = False Then
set re = new RegExp
re.pattern = "\[quote(?:(?!\[quote)([\s\S]))+?(\[/quote\]\n\r|\\n|\)"
re.ignorecase = true
re.global = true

set matches = re.execute(fstring)
totalMatches = matches.count
if totalMatches <> 0 Then
Do While totalMatches <> 0
For each match in matches
fstring = re.Replace(fstring,"")
Next
if totalMatches = 0 Then
Exit Do
End If
set matches = re.execute(fString)
totalMatches = matches.count
Loop
End If
set matches = nothing
set re=nothing

CleanQuotes = fstring
Else
CleanQuotes = fstring
End If
End Function

Done with the inc_func_posting.asp...
post.asp
now open post.asp Find following line around Line 328:

Code:
TxtMsg = TxtMsg & "[br]" & rs("R_MESSAGE") & vbNewline

Replace it with following:

Code:
TxtMsg = TxtMsg & "[br]" & CleanQuotes(rs("R_MESSAGE")) & vbNewline


Following change is OPTIONAL. Generally topics are not quoted, but may be quote stuff inside, so you may not add it if you find it necessary or not. But here it goes: Find following line around line 355 :

Code:
TxtMsg = TxtMsg & "[br]" & rs("T_MESSAGE") & vbNewline

Replace it with following :

Code:
TxtMsg = TxtMsg & "[br]" & CleanQuotes(rs("T_MESSAGE")) & vbNewline


And voila ;) Now you won't get anymore annoying quote in quote in quote in quote over and over...

http://www.chip.com.tr/forum

Credits: Thanks to Carefree for taking risks to test this piece of code and preparing the file for download and MarcelG for all previous tries.<

 

Replies ...


AnonJr
04 June 2008, 21:41


I do believe that I've seen it done around here before - or at least I've seen some discussion on it.
Having said that, your solution does appear to be a bit more elegant than what I remember seeing.<
MarcelG
05 June 2008, 02:10


Looks pretty clean and well documented! Nice work SiSL! This certainly looks like one I should implemented on oxle! <
Carefree
05 June 2008, 03:10


I like it. I always ended up having to manually delete 95% of the quotes (when it was necessary for me to quote someone) so the message stayed readable. Maybe you should have called it "No More Nested Quotes".<
MarcelG
05 June 2008, 06:26


SiSL, it doesn't seem to work as I expected.
Imagine a post like this, with multiple quotes in the post:
(between the *****'s)

***** You said this:
other bla
Remember? ***** Eg. the quotes are not removed when there's more than one in R_MESSAGE...question
Example: http://oxle.com/topic.asp?tid=5313 (demo/demo when prompted for a password)<
bobby131313
05 June 2008, 09:58


I removed the reply with quote icon looooong ago for this reason. Hell I had one member with over 250 posts or so and I couldn't find one of his post that didn't quote an entire post whether it already had multiples or not.<
MarcelG
05 June 2008, 14:35


SiSL, I've been looking at it for a while now, but my understanding of RegExp's hasn't grown....it still looks jibberish to me. Do you have any idea?<
SiSL
05 June 2008, 23:29


Yup, it does not work on multi quotes seperated by another thing sadly. RegEx can't parse in this way.
If Snitz used to seperate quotes such as
2...2
or similiar to that, it could be done.

However, this only resolves such:

---
Qute
- Quote
-- Quote


text

stuff...
Ofcourse this could be done in some more extensive coding by manually adding quotes numbers and remove from there. Yet I may check more what I can do for such quotes<
SiSL
06 June 2008, 00:19


Originally posted by Carefree
Maybe you should have called it "No More Nested Quotes".

Good idea :p Changed it before it is too late<
phy1729
06 June 2008, 00:25


Is the problem that when you have
text1
quote2

Edit: Didn't mean for the quote tags to parse but I think the meaning is clear<
SiSL
07 June 2008, 19:15


Fixed Function, can you retry Marcel?
I decided to replace quotes by double <br> and finally converting it back to vbNewLine<
Carefree
08 June 2008, 04:33


Still the same issue, SiSL.
quote:
--------------------------------------------------------------------------------
you said
quote:
--------------------------------------------------------------------------------
Originally posted by Administrator


quote:
--------------------------------------------------------------------------------
this is a test of nested quotes
--------------------------------------------------------------------------------



--------------------------------------------------------------------------------

and I said .... --------------------------------------------------------------------------------
<
MarcelG
08 June 2008, 04:58


SiSL ; this updated version doesn't seem to work at all; even with just a single quote, the quote isn't replaced. http://oxle.com/topic.asp?tid=5316 (demo/demo)

I've reverted to your previous version.<
SiSL
08 June 2008, 09:06


Sorry guys, final change , please test it out this time... On my tests, it looks like I nailed it, but ofcourse, need your opinions.<
MarcelG
08 June 2008, 12:24


The two quotes part works now, but no longer if they're nested : when quoting a quote with one quote in it, the outer quote isn't replaced : http://oxle.com/topic.asp?tid=5316#44221
<
SiSL
08 June 2008, 15:01


Interestingly it works at me, not sure why it does at you, double checked here...<
MarcelG
08 June 2008, 15:14


That's strange indeed....<
Carefree
08 June 2008, 17:05


Doesn't work here, either. No change from the original behaviour.<
SiSL
08 June 2008, 17:09


/sigh..

May be I should check with un-modded version. Thanks guys, I'll let you know. (Hope you are changing entire function, not the lines btw :p)<
MarcelG
09 June 2008, 03:44


Yep, I'm replacing the entire fuction each time (however, I am replacinng your "<br id='quote' />" with "[cq]" (a custom forumcode meant for cleaned quote.)<
SiSL
09 December 2008, 16:43


Alright, time for yet-another-public test :)

Replaced original function... Did not wanted to go into Do-Loop however, this came to mind with a shining idea after ages... So wanted you guys to re-test

Now function works as following:

Takes anything matches [quote]...[/quote] pattern where there is no "[quote" between... So repeats until there is no quote left to clean... You can change to "<br>" or something if you like in the replace part. <
Carefree
09 December 2008, 17:37


I'll test it as soon as you provide a link to the mod.<
SiSL
09 December 2008, 17:38


There is no link, just the first post without any files. May be I should just make it HTML and put to SnitzBitz as well..<
Carefree
09 December 2008, 17:56


Well, here's how it looks:
quote :
Originally posted by Craig


quote :
Originally posted by Craig


quote :
Originally posted by PhillyVet


Hello everyone. Welcome to this new and creative website for pros and beginners. Staff here will be available and are very friendly. Watchout for the big man.


Let's see if this fixes nested quotes.
Cross your fingers, everyone.

Each double-space, etc.; is from a different quotation. It didn't change anything on my end.<
bobby131313
09 December 2008, 18:02


Having said that, your solution does appear to be a bit more elegant than what I remember seeing.

I just removed the button. tongue<
SiSL
09 December 2008, 20:25


And final change should deal with "Quotes can also have line-breaks" problem... Along with dealing with leftover Quote breaks often done by users...
Now I should do same with [code] tags so they don't remove forum codes.<
Carefree
11 December 2008, 22:31


Didn't realize you'd updated it again. I installed the new version and ... it works. Each new quote (reply) only uses the latest reply in the quotation, everything else is stripped off.
WTGbigsmile<
SiSL
12 December 2008, 00:44


Hey Thanks for trying it out! :)

Glad it worked this time and FINALLY and thanks for the installation file, I really suck at preparing those :)
<
Carefree
12 December 2008, 20:23


Any time<
© 2000-2021 Snitz™ Communications