Giter Club home page Giter Club logo

Comments (11)

 avatar commented on July 1, 2024 1

Nono I mean split into list, strip the strings in it, then join the list with separator newline (and quote sign I suppose).

Though by all means dropping newlines alltogether is also an option

from blottertrax.

 avatar commented on July 1, 2024

I can't see the comment so I don't understand the problem, but a double newline shouldnt cause that issue. In my experience \n>\n> will correctly be identified as a new paragraph in the quote by reddit. Any chance I could have a screenshot of the comment?

from blottertrax.

martijnboers avatar martijnboers commented on July 1, 2024

Artist: https://www.last.fm/music/Mischief+Brew

image

from blottertrax.

 avatar commented on July 1, 2024

This looks like it could be a code block? that would be caused by a series of spaces in the beginning of the line (at least 4)
I am almost certain it is not a nested quote, though I don't know new reddit

from blottertrax.

Nedlinin avatar Nedlinin commented on July 1, 2024

from blottertrax.

 avatar commented on July 1, 2024

hm i did some more testing and im not quite sure, I dont think its possible to have code block in quote?

Could someone with access do a getSubmission request on the comment and get the raw body data from the api?

from blottertrax.

Nedlinin avatar Nedlinin commented on July 1, 2024

The summary is:

"Mischief Brew was an anarchist folk-punk band. A wicked concoction by Erik Petersen – a musical feast falling somewhere between the categories of pirate punk, Celtic folk, gypsy swing, devilish jazz, American olde-tyme and country. It’s good music to stomp, kick, pogo, jitterbug, waltz, drink, twist and shout to – whether the performance is solo acoustic or with a backing band of accordion, drums, and mandolin.\n\n Erik started making music at a young age <a href=\"https://www.last.fm/music/Mischief+Brew\">Read more on Last.fm</a>"

Github doesn't format this properly either but the key piece is that the \n\n is followed by 12 spaces.

Perhaps we run it through

re.sub("\n+", "\n>", re.sub('\s+',' ', description))

I think that'll clobber both the extra lines (replacing them with a single quote for our need) as well as stripping excess spaces from the text body.

from blottertrax.

 avatar commented on July 1, 2024

using native split function, then strip and join also can. It's not going to get rid of mid-text double space, but it will handle the main issue and should be faster than regex

from blottertrax.

Nedlinin avatar Nedlinin commented on July 1, 2024

@TcMaX : I think that would remove newlines as well though wouldn't it?

Edit: Although considering we are getting the short description it might not be that bad. We could split, strip, join then append > to the front (for reddit markdown) and call it a day. The resulting paragraph shouldn't be so long we really care about the newlines anyway.

from blottertrax.

 avatar commented on July 1, 2024

So something like

summarySplit = summary.split('\n') strippedList = list(map(str.strip, summarySplit)) newSummary = '\n>'.join(strippedList)

Completely untested, but something in this ballpark. I think it'd be a fair bit faster than regex

EDIT: I really did try to newline things in this code block, it didn't work.

from blottertrax.

 avatar commented on July 1, 2024

image
seems to work. obviously first one no quote but thats easy fix

from blottertrax.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.