November 2, 2007 at 12:03 AM
Recently, I was challenged by the task of managing the overflow of the post on this site, for example in the following post: Visual Studio 2005 Class Diagram for Web Site. The problem is that there is no easy way to shorten the text and add ellipsis to the end, because the actual html of the post has complex structure. So, I decided to parse the code to a graph and work on this graph until it satisfies the condition. In this case, the condition was to have the length of the source not greater than some constant N, for example, N=1000 characters. So, I wrote the following class and validated it using several test cases.