Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

/r/equesting BBCode decompiler

Name: frozenanus !divz2ANUSY 2011-07-11 21:09

Project type
Open to everyone

Description
I need a program that will accept a link to a /prog/ post as input, and as produce as output the plain-text/BBCode that would be submitted as a post to reproduce the post in question.

Compensation
$0.03 / hour

Time left
Indefinite

Tags
* bbcode
* /prog/-utility

Name: Anonymous 2011-07-11 21:14

Someone wrote one in Haskell, but he didn't post the code.

Name: Anonymous 2011-07-11 22:32

>>2
Even is he did post it, nobody in the world would be able to read it.

Name: Anonymous 2011-07-12 1:53

IMAGEBOARDS

Name: Anonymous 2011-07-12 2:40

Will you accept ones written in befunge?

Name: Anonymous 2011-07-12 3:43

>>5
yes

Name: Anonymous 2011-07-13 0:14

bampu n_n

Name: !NcY8ScbS3o!j4RQ25NcFwf/eU9 2011-07-13 8:27

>>1
I'll write you one if you payme enough;) give me a cool tripcode [spoiler](both my graphics cards are [sup][sub][u]awful![/i][/sub][/sup], so even if I reimplement DES in OpenCL I can't do anything with it)[/spoiler].  It will have full quote block reproduction support and so on.  You must however agree to strip the quoting code prior to publishing the source on /anus/ (if that is your desire), for only expert programmers are allowed to quote expertly.  Do you accept my conditions?

Name: !NcY8ScbS3o!j4RQ25NcFwf/eU9 2011-07-13 8:28

>>1
Well, I guess that doesn't reflect well upon my credibility. Take two.

I'll write you one if you payme enough;) give me a cool tripcode (both my graphics cards are awful!, so even if I reimplement DES in OpenCL I can't do anything with it).  It will have full quote block reproduction support and so on.  You must however agree to strip the quoting code prior to publishing the source on /anus/ (if that is your desire), for only expert programmers are allowed to quote expertly.  Do you accept my conditions?

Name: Anonymous 2011-07-13 8:45



Name: Anonymous 2011-07-13 10:29

Should it take HTML as input?

Name: Anonymous 2011-07-13 10:37

>>11
Yes.  And output the BBCode which, when processed by 4chan, would produce HTML equivalent to the input post.

Name: Anonymous 2011-07-13 11:45

>>12 with all the weird world4ch bugs?

Name: Anonymous 2011-07-13 12:51

>>13
As long as it is functionally and visually equivalent, I guess it shouldn't matter.

Name: Anonymous 2011-07-13 13:32

             THE BBCODE DECOMPILATION PROBLEM

                       by Anonymous,
                  Faculty of Programming,
                       dis.4chan.org

                         ABSTRACT

       Since allowing message board users to post raw HTML
  in their messages represented too much of a risk, BBCode
  was designed as a way of limiting the objects that could
  be  posted.  Browsers do not understand  BBCode directly,
  so BBCode  is often  translated to  HTML server-side. On
  some boards[1] it is impossible to retrieve the original
  BBCode; it is precisely this limitation that has sparked
  scientific  interest  in the  field  of  Beebeecodology.
  Previous works published by Sussman et al.[2][3][7] have
  demonstrated that  BBCode to HTML  conversion is not  an
  injective  function.  As  a  result  of our  independent
  research,  we  have  mathematically proved  that  BBCode
  decompilation is equivalent to N-SAT,  and as such it is
  NP-complete.

Name: tdd fag 2011-07-13 13:50

Define a test suite with coverage of at least 3 cases, with the html and the bb code. Each case should be of different complexity.

Having done that, the rest should be very straightforward.

Name: Anonymous 2011-07-13 13:53

Here's some shit from 2007/2008:

module Language.BBCode.Disassemble (disassembleBBCode) where
import Language.BBCode
import Language.BBCode.Render
import Text.ParserCombinators.Parsec
import Data.List

html = many (try htmlHardBreak <|> try htmlBreak <|> htmlElement <|> htmlText)
htmlText = many1 (noneOf "<") >>= return . Text
htmlHardBreak = (string "<br clear=all>") >> (return (Element "br" []))
htmlBreak = (string "<br/>\n") >> (return (Text "\n"))
htmlElement = do
  (s, as) <- try htmlOpenElement
  content <- html
  htmlCloseElement s
  case lookup "class" as of
    Just c  -> return $ Element c content
    Nothing -> return $ Element s content
htmlOpenElement = do try $ char '<'
                     s <- many1 $ noneOf "/ >"
                     as <- manyTill (space >> spaces >> htmlAttribute) (char '>')
                     return (s, as)
htmlCloseElement s = do try $ string $ "</" ++ s ++ ">"
htmlAttribute = do key <- many1 $ noneOf "="
                   char '='
                   c <- oneOf "\"'"
                   value <- many $ noneOf (if c == '"' then "\"" else "'")
                   char c
                   return (key, value)

eval :: BBCode -> [BBCode]
eval (Element "a" x) = concatMap eval x
eval (Element "quote" x) = Text "> " : concatMap eval x
eval (Element s x) = (Element s (concatMap eval x)) : []
eval (Text x) = (Text (subst "&gt;" ">" x)) : []

subst _ _ [] = []
subst a b ax@(x:xs) = if isPrefixOf a ax
                        then b ++ (subst a b (drop (length a) ax))
                        else x : subst a b xs

disassembleBBCode bb = case parse html "" bb of
                         Left  e  -> error $ show e
                         Right bs -> concatMap eval bs

test :: IO ()
test = do
  testcase <- readFile "bbcode.txt"
  putStrLn $
    concatMap showBBCode $
    disassembleBBCode testcase

Name: Anonymous 2011-07-13 15:06

monadth are for faggotth

Name: Anonymous 2011-07-13 16:48

>>15
Forget it, it's #P complete.

Name: Anonymous 2011-07-13 18:29

>>17
Haskell?

Name: Anonymous 2011-07-13 21:26

>>20
U MENA HASKAL

Name: Anonymous 2011-07-13 22:57

read the sage field

Name: Anonymous 2011-07-13 23:40

>>22
I read the Email field instead

Name: Anonymous 2011-07-13 23:40

13 July 2011

   The US Government is due to establish a Federal Programming Administration (FPA) over the next few weeks. During this time, government officials will be screening individuals for administrative positions and will be laying the groundwork for guidelines which all software companies will soon be required to follow.
   Under these guidelines, all computer code will be required to meet a level of quality. "Obviously, there is a lot of code in the market already," explains government technical expert Ryan Jennings. "Thus, the FPA will only screen software by a complaint-by-complaint basis." Jennings goes on to describe a couple of the guidelines. "In the future, programs will have to start up in less than a couple of seconds. The programs themselves have to be programmed in one of the many enterprise languages which are widespread in use, such as Java, VB.NET, and PHP. Remember, a positive user experience is everything here and the FPA will ensure that it happens."
   US Congress is due to pass a set of laws in the future which will halt the distribution of computer software deemed "low-quality" by the FPA. According to Jennings, "The goal here is to lower and eventually eliminate the already high amount of poor quality software. Top issues in the agenda include the elimination of functional programming, a sub-par programming practice, and particularly open-source software. Open-source software is seen as destructive to the economy so we already have plans to ban its production." The screening process is estimated to be completed in a few days. "It's only a matter of time, but I'm certain this is going to work out. I really see a bright future in the computer industry."

Name: Anonymous 2011-07-14 7:39

I guess OP went AWOL.

Name: Anonymous 2011-07-14 7:40

Name: Anonymous 2011-07-15 17:17

progress report

Name: !NcY8ScbS3o!j4RQ25NcFwf/eU9 2011-07-15 18:22

>>27
I haven't done shit because OP didn't agree to my conditions.

Name: Anonymous 2011-07-15 18:46

>>8
YOU MAKE ME HATE HUMANITY

Name: !NcY8ScbS3o!j4RQ25NcFwf/eU9 2011-07-15 19:21

>>29
So, do we have a deal?

Don't change these.
Name: Email:
Entire Thread Thread List