# Parsing partial quotes from nested quotes?

**URL:** https://meta.discourse.org/t/parsing-partial-quotes-from-nested-quotes/117660
**Category:** Feature
**Created:** [5월 14, 2019, 6:45오전 UTC](https://meta.discourse.org/t/parsing-partial-quotes-from-nested-quotes/117660 "2019-05-14T06:45:58Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![ryanerwin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ryanerwin/32/94589_2.png) [@ryanerwin](https://meta.discourse.org/u/ryanerwin)
#### Post date: [5월 14, 2019, 6:45오전 UTC](https://meta.discourse.org/t/parsing-partial-quotes-from-nested-quotes/117660/1 "2019-05-14T06:45:58Z")

</div>

Had the following situation pop up today:

User A:

> And yes… It’s been dark times lately… Cursing is just what helps release the stress

User B:

> > Post from User A:  
> > And yes… It’s been dark times lately… Cursing is just what helps release the stress
> 
> Also, he doesn’t discriminate to one form of communication… Just check his Tweets… He can also write it as he speaks it…

User C (Quotes User A, but via User B’s post):

> > **Post from User B**  
> > And yes… It’s been dark times lately… Cursing is just what helps release the stress
> 
> So much hatred. Have you thought about going and talking to someone?

User B:

> Hey User C! Somehow it looks like I wrote that!

User C:

> > Post from User B:  
> > Hey User C! Somehow it looks like I wrote that!
> 
> I am so lost User B, who did what?

User C wasn’t malicious… They are just a less sophisticated user.

Suggestion here that when a quote only refers to a nested quote, the quoting used should refer to the original quote rather than the nested quote.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [5월 14, 2019, 8:54오전 UTC](https://meta.discourse.org/t/parsing-partial-quotes-from-nested-quotes/117660/2 "2019-05-14T08:54:02Z")

</div>

This is going to be hard to do, considering we can do this ⬇

> [@system](#):
>
> Suggestion here that when a quote only refers to a nested quote, the quoting used should refer to the original quote rather than the nested quote.

Why not teach your users to quote the original post instead of a quote insite another post? They can also quote from multiple posts if they want.

---

<div class="post-metadata">

### Author: ![ryanerwin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ryanerwin/32/94589_2.png) [@ryanerwin](https://meta.discourse.org/u/ryanerwin)
#### Post date: [5월 14, 2019, 9:22오전 UTC](https://meta.discourse.org/t/parsing-partial-quotes-from-nested-quotes/117660/3 "2019-05-14T09:22:33Z")

</div>

> [@zogstrip](#):
>
> This is going to be hard to do, considering we can do this

Interesting… I had always assumed the quote was actually validated… Didn’t realize that I could just have a pretend quote free for all…

> [@zogstrip](#):
>
> Let’s pretend Zogstrip said something that he never said…

> [@On another topic](https://meta.discourse.org/t/84530/1):
>
> Or could just be putting some horribly offensive words into Discobot’s mouth here…

Makes for a good litmus test… If someone purposely abuses quotes in that way, you know who to ban 😉

Since the quotes aren’t validated, I see your point…

Thanks for considering 🤝

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [5월 14, 2019, 9:39오전 UTC](https://meta.discourse.org/t/parsing-partial-quotes-from-nested-quotes/117660/4 "2019-05-14T09:39:29Z")

</div>

We do validate the quotes (kinda), and attach a `.quote-modified` class to any which have been amended. Let’s see if it figures out the nested quotes:

> [@ryanerwin](#):
>
> This is going to be hard to do, considering we can do this

Hmmm, no it doesn’t. I guess ‘technically’ that content is still part of @ryanerwin’s post. Quite tricky to resolve though. As @zogstrip already said the best way is to try and get your users to quote the original post.

---

<div class="post-metadata">

### Author: ![ryanerwin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ryanerwin/32/94589_2.png) [@ryanerwin](https://meta.discourse.org/u/ryanerwin)
#### Post date: [5월 14, 2019, 9:52오전 UTC](https://meta.discourse.org/t/parsing-partial-quotes-from-nested-quotes/117660/5 "2019-05-14T09:52:56Z")

</div>

> [@david](#):
>
> As @zogstrip already said the best way is to try and get your users to quote the original post

They do quote correctly most of the time. For casual users, nested quotes can be pretty complicated… The “Quote whole post” button is very rarely used for us.

It’s just the real example that came up today, where an innocent but not extremely sophisticated user was just trying to make a quote, and the quote appeared as though it was from a different user…

That’s why I posted it here.

Mods can of course manually edit the post to fix it. And this can’t come up too terribly often. Just a thought to avoid an awkward situation that comes up occasionally 😉

 ![image](https://global.discourse-cdn.com/meta/original/3X/7/8/78aa18a25d4c402f3a459e2fe24d3e3e23be8d7a.png)

Here’s the actual post (names removed).  
You can see how that being attributed to the opposite party in a debate comes across as pretty strange.

NOTE: feel free to delete the image in this post if it’s over the line for meta TOS… Just thought it best to provide a real example.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [12월 22, 2019, 7:13오후 UTC](https://meta.discourse.org/t/parsing-partial-quotes-from-nested-quotes/117660/6 "2019-12-22T19:13:48Z")

</div>

@eviltrout 만약 수정이 엄청나게 복잡하거나/또는 어려우지 않다면, 누군가 이 작업을 맡아주었으면 좋겠어요. 하지만 _매우_ 복잡하다면 그냥 포기합시다.

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [12월 22, 2019, 11:26오후 UTC](https://meta.discourse.org/t/parsing-partial-quotes-from-nested-quotes/117660/7 "2019-12-22T23:26:12Z")

</div>

기억이 맞다면, 비슷한 문제(발췌문에서 중첩된 태그를 매칭하는 JavaScript 문제)를 조사해 본 적이 있었는데, 후행 탐색(look-behind) 정규 표현식이 필요해서 막혀 있었습니다. 하지만 저보다 정규 표현식에 능한 누군가가 허용 가능한 해결책을 찾아낼 수 있다면 놀라지 않을 것입니다.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [12월 23, 2019, 12:11오전 UTC](https://meta.discourse.org/t/parsing-partial-quotes-from-nested-quotes/117660/8 "2019-12-23T00:11:15Z")

</div>

중첩이 필요하지 않습니다. 위쪽으로 이동하면서 가장 가까운 인용 헤더 블록을 찾으면 됩니다.

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [12월 23, 2019, 4:38오후 UTC](https://meta.discourse.org/t/parsing-partial-quotes-from-nested-quotes/117660/10 "2019-12-23T16:38:05Z")

</div>

@nbianca가 최근에 비슷한 내용을 살펴본 적이 있어서, 이 작업에 좋은 후보가 될 것 같습니다.

---

<div class="post-metadata">

### Author: ![nbianca](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nbianca/32/157984_2.png) [@nbianca](https://meta.discourse.org/u/nbianca)
#### Post date: [1월 28, 2020, 12:26오후 UTC](https://meta.discourse.org/t/parsing-partial-quotes-from-nested-quotes/117660/11 "2020-01-28T12:26:36Z")

</div>

이 기능이 구현되어 이제 의도대로 작동합니다. 인용문을 다시 인용하면 원본 게시물의 정보가 유지됩니다. 위의 인용문 중 하나로 직접 시도해 보세요. 😊

> <https://github.com/discourse/discourse/commit/7b7e1717f2c1579ae7de9d344a7e7cbc63f8fffc>
>
> Let's say post #2 quotes post number #1. If a user decides to quote the
> quote i…n post #2, it should keep the information of post #1
> ("user\_1, post: 1, topic: X"), instead of replacing with current post
> info ("user\_2, post: 2, topic: X").

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [1월 29, 2020, 1:25오전 UTC](https://meta.discourse.org/t/parsing-partial-quotes-from-nested-quotes/117660/12 "2020-01-29T01:25:03Z")

</div>

> [@david](#):
>
> 이미 가장 좋은 방법을 말했네요

🎉 여기에서 가져온 결과, 작동하는 것 같습니다:

 ![image](https://global.discourse-cdn.com/meta/original/3X/4/9/4914ce3a9cb91035bd25d0a7558b247a3f26eb32.png)

---

<div class="post-metadata">

### Author: ![nbianca](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nbianca/32/157984_2.png) [@nbianca](https://meta.discourse.org/u/nbianca)
#### Post date: [2월 1, 2020, 4:00오후 UTC](https://meta.discourse.org/t/parsing-partial-quotes-from-nested-quotes/117660/13 "2020-02-01T16:00:13Z")

</div>

이 주제는 4일 후 자동으로 닫혔습니다. 더 이상 새 답변을 남길 수 없습니다.
