From 4fea7a6467a97ab0012a14b548bbcea82c7f041c Mon Sep 17 00:00:00 2001 From: chaoskagami Date: Tue, 26 Jan 2016 00:32:48 -0500 Subject: [PATCH] Fix some rather bad errors when importing --- 4ch-to-mw.py | 8 +- examples/mgn-1/19554306.xml | 188 ++++++++++++++++++------------------ 2 files changed, 98 insertions(+), 98 deletions(-) diff --git a/4ch-to-mw.py b/4ch-to-mw.py index dc6f901..6812e07 100755 --- a/4ch-to-mw.py +++ b/4ch-to-mw.py @@ -135,18 +135,18 @@ def dump_text(out_file, post_list): def dump_mediawiki_markup(out_file, post_list, post_id): f = open(out_file, "wb") f.write(("Thread " + post_id + "").encode('utf-8')) - f.write(("\n").encode('utf-8')) + f.write(("<!-- Autogenerated by 4ch-to-mw.py -->\n").encode('utf-8')) for p in post_list: header = p['name'] + " " + p['time'] + " No." + p['id'] if p['subj'] != "": header = p['subj'] + " " + header - f.write("" + header + "\n") + f.write("<b>" + header + "</b>\n") if p['img'] != "": f.write("[[File:" + p['img'] + "|thumb|left|200x200px]]\n") - f.write("
\n")
+		f.write("<pre style='font-family: sans-serif;'>\n")
 		encoded_msg = p['msg'].replace("&", "&").replace("<", "<").replace(">", ">")
 		f.write((encoded_msg + "\n").encode('utf-8'))
-		f.write("
\n") + f.write("</pre>\n") f.write(("----------------------------------\n").encode('utf-8')) f.write(("
").encode('utf-8')) diff --git a/examples/mgn-1/19554306.xml b/examples/mgn-1/19554306.xml index 69cee00..fb13bd4 100644 --- a/examples/mgn-1/19554306.xml +++ b/examples/mgn-1/19554306.xml @@ -1,7 +1,7 @@ -Thread 19554306 -Deculture 1340192015 No.19554306 +Thread 19554306<!-- Autogenerated by 4ch-to-mw.py --> +<b>Deculture 1340192015 No.19554306</b> [[File:1340192015558.png|thumb|left|200x200px]] -
+<pre style='font-family: sans-serif;'>
 You are a Magical GIrl.
 
 In the past, you seem to have referred to yourself as Murderface.
@@ -13,16 +13,16 @@ One of them being shooting a smiling pink-haired girl in the face, moments after
 You are Chiaki Matsuda, and you are in the seedy bar that's just a few blocks away from your own apartment.
 
 You're not too sure how you ended up here.
-
+</pre> ---------------------------------- -Anonymous 1340192499 No.19554350 -
+<b>Anonymous 1340192499 No.19554350</b>
+<pre style='font-family: sans-serif;'>
 >>19554306
 Check inventory, check physical condition, assess drunkenness, try to remember if we had a job to do, order another drink.
-
+</pre> ---------------------------------- -Deculture 1340192647 No.19554365 -
+<b>Deculture 1340192647 No.19554365</b>
+<pre style='font-family: sans-serif;'>
 Well, you're not exactly sure, but you have an idea. After what had happened in Mami's apartment - and having spent a good chunk of the day helping her clean up - you had decided to step out for a moment. 
 
 Maybe you didn't want to stick around too much. Sure, the food was good, and it felt nice to be around the blonde. But you didn't quite care for the company - namely, the blue-haired bitch glaring at you after every bite. Or the lectures that little rat bastard kept spouting.
@@ -30,11 +30,11 @@ Maybe you didn't want to stick around too much. Sure, the food was good, and it
 You wanted some fresh air, and you ended up where you normally tried your level best to kill your liver.
 
 It's funny how things work out.
-
+</pre> ---------------------------------- -Deculture 1340192987 No.19554396 +<b>Deculture 1340192987 No.19554396</b> [[File:1340192987122.png|thumb|left|200x200px]] -
+<pre style='font-family: sans-serif;'>
 >>19554350
 
 The bar doesn't really have a name. It's just a bar, built there to give people a place to try and drown whatever sorrows they have. It's staffed by a tall, dark-skinned man with the biggest afro you've ever seen, and sharp facial hair you swear is tailored to make his furious scowl look like it's taking up 90% of his face.
@@ -44,17 +44,17 @@ You check your inventory. Everything's pretty much there, same as the last time.
 Oh. You have that envelope Sayaka tossed your way. You haven't opened it yet. It's supposed to be your next assignment.
 
 You're...well, you're not drunk. You could be drunk a bit more, though.
-
+</pre> ---------------------------------- -Anonymous 1340193113 No.19554408 -
+<b>Anonymous 1340193113 No.19554408</b>
+<pre style='font-family: sans-serif;'>
 >>19554396
 Get another drink and make it a double, stuff two cigarettes in our mouth and light them up, head to a private table instead of the bar and open up the envelope.
-
+</pre> ---------------------------------- -Deculture 1340194121 No.19554505 +<b>Deculture 1340194121 No.19554505</b> [[File:1340194121906.png|thumb|left|200x200px]] -
+<pre style='font-family: sans-serif;'>
 >>19554408
 
 You've already drunk your money's worth, but you do have a tab, and Charles still owes you for that time when you solved a particularly nasty problem involving a couple of Yakuzas trying to shoot up the joint. You order a double whisky, and are mere seconds from lighting the cigarettes when you hear the bar doors open behind you, a cheerfully grating voice ringing out. 
@@ -64,16 +64,16 @@ You've already drunk your money's worth, but you do have a tab, and Charles stil
 Sakura Kyoko. This night just turned out a whole lot worse.
 
 What is your reply?
-
+</pre> ---------------------------------- -Anonymous 1340194713 No.19554544 -
+<b>Anonymous 1340194713 No.19554544</b>
+<pre style='font-family: sans-serif;'>
 Offer her a cig and give her the assignment.
-
+</pre> ---------------------------------- -Deculture 1340195406 No.19554613 +<b>Deculture 1340195406 No.19554613</b> [[File:1340195406976.png|thumb|left|200x200px]] -
+<pre style='font-family: sans-serif;'>
 Trying to look as if that slap hadn't almost knocked the lungs out of your body, you grab your glass and drain it of whisky, not caring if it burned like hell on the way down. Motioning to Charles for another refill, you place the cigarettes back into your mouth, lighting them simultaneously, before giving her the most withering look you could ever muster.
 
 She only looks back at you, blankly, somewhat confused, and partly waiting for something to happen.
@@ -85,37 +85,37 @@ Grumbling about one-eyed idiots, you tuck the envelope underneath one arm and gr
 []Kyoko, please, this is not the time.
 []Friends don't set other friends on fire.
 []Your girlfriend almost made a pincushion out my kidneys. Leave me to drink in peace.
-
+</pre> ---------------------------------- -Anonymous 1340195460 No.19554618 -
+<b>Anonymous 1340195460 No.19554618</b>
+<pre style='font-family: sans-serif;'>
 >>19554544
 >give her the assignment
 Nonsense. As much as you'd love to pass your duties on someone else, you'd hate to miss a chance to get Grief Seed. 
 They are the thing that keeps your clock ticking. Cigs, booze and pills are just oiling to make it tick smoother, but Seeds are the thing that really matters. That is, if anything does.
-
+</pre> ---------------------------------- -Anonymous 1340195540 No.19554625 -
+<b>Anonymous 1340195540 No.19554625</b>
+<pre style='font-family: sans-serif;'>
 >>19554613
 >[X]Your girlfriend almost made a pincushion out my kidneys. Leave me to drink in peace.
-
+</pre> ---------------------------------- -Anonymous 1340195814 No.19554651 -
+<b>Anonymous 1340195814 No.19554651</b>
+<pre style='font-family: sans-serif;'>
 >>19554618
 Ah, I do not know how magical girls are powered here. That seems like a thing to do then.
-
+</pre> ---------------------------------- -Anonymous 1340196143 No.19554685 -
+<b>Anonymous 1340196143 No.19554685</b>
+<pre style='font-family: sans-serif;'>
 >>19554651
 Basically Magical Girls get corruption over time and by using Magic, what you do is take a Grief Seed from a defeated Witch and shunt the corruption into their in order to extend your life.
-
+</pre> ---------------------------------- -Deculture 1340196600 No.19554729 +<b>Deculture 1340196600 No.19554729</b> [[File:1340196600348.png|thumb|left|200x200px]] -
+<pre style='font-family: sans-serif;'>
 >>19554625
 
 "W-what? My...my girlfriend? B-but I don't...o-oh, YOU MEAN SAYAKA, HAHAHA! OH, THAT'S RICH, MURDERFACE! WE'RE JUST GOOD FRIENDS, REALLY! AHAHAHA!"
@@ -129,18 +129,18 @@ The forced fake laughter would've been disturbing anyone else in the bar, if the
 "So, uh, what really happened? In Mami's apartment, I mean. One of the Kyuubeys said it was a particularly strong one. How'd you manage that?"
 
 How do you reply?
-
+</pre> ---------------------------------- -Anonymous 1340196603 No.19554731 -
+<b>Anonymous 1340196603 No.19554731</b>
+<pre style='font-family: sans-serif;'>
 >>19554685
 Some sort of arcane corruption, I assume, not just a penchant for booze and pocky?
 
 This stuff about being set on fire wasn't in the previous thread, was it?
-
+</pre> ---------------------------------- -Anonymous 1340196889 No.19554760 -
+<b>Anonymous 1340196889 No.19554760</b>
+<pre style='font-family: sans-serif;'>
 >>19554731
 Magic corruption, yeah.
 
@@ -150,21 +150,21 @@ The same way you kill any other witch, you cause enough brute trauma to a vulner
 It tried to interrupt my breakfast, and I do not take kindly to anyone getting between me and pancakes. 
 
 Give her a cigarette and light up another one.
-
+</pre> ---------------------------------- -Anonymous 1340197070 No.19554777 -
+<b>Anonymous 1340197070 No.19554777</b>
+<pre style='font-family: sans-serif;'>
 >>19554729
 You know QBs, always talk too much. That's the trait I really hate.
 
 As for that thing in Mami's flat, was not really a Witch, just someone given "the kiss", it was too late to save her, so I had to do it the starighforward way. Shoot it 'til it died. Didn't even take that long, really.
 
 How comes you are not chewing anything right now? You always do.
-
+</pre> ---------------------------------- -Deculture 1340197987 No.19554874 +<b>Deculture 1340197987 No.19554874</b> [[File:1340197987266.png|thumb|left|200x200px]] -
+<pre style='font-family: sans-serif;'>
 >>19554760
 >>19554777
 
@@ -179,27 +179,27 @@ After a moment of continuing to ruin your lungs and voice, you grumble out your
 You shrug, and give her a cigarette from your box, letting her light it up with one of your already-spent ones. As she smokes her first cigarette - coughing and hacking loudly after the very first puff, you pull out the papers inside the envelope. There are two, with a photograph of what looks like a young female idol. You're not into that sort of music, but she does look stupid and two-dimensional enough to be one.
 
 Kyuubey has loaned you out as security. Perfect.
-
+</pre> ---------------------------------- -Anonymous 1340198236 No.19554913 -
+<b>Anonymous 1340198236 No.19554913</b>
+<pre style='font-family: sans-serif;'>
 >>19554874
 Fucking security detail. 
 
 What are the details on the job? Who is after her? How long are we on security? Why the fuck should we care about what happens to her? Where are we protecting her, home, work, both? What enemies does she have?
-
+</pre> ---------------------------------- -Anonymous 1340198412 No.19554936 -
+<b>Anonymous 1340198412 No.19554936</b>
+<pre style='font-family: sans-serif;'>
 >>19554874
 Just make up with your girlfriend. Then the weight will fall off, stress makes people fat after all
 
 Read our instructions while she simultaneously ponders the effectiveness of our advice and gets mad at it
-
+</pre> ---------------------------------- -Deculture 1340199338 No.19555050 +<b>Deculture 1340199338 No.19555050</b> [[File:1340199338407.jpg|thumb|left|200x200px]] -
+<pre style='font-family: sans-serif;'>
 >>19554936
 >>19554913
 
@@ -218,30 +218,30 @@ You're asked to report, as soon as you can, to the hotel where she's staying. Yo
 []Ask Kyoko more about these perverts.
 []Call Kyuubey and tell him to get you another assignment, this one reeks.
 []Get another drink before leaving for the hotel.
-
+</pre> ---------------------------------- -Anonymous 1340199486 No.19555069 -
+<b>Anonymous 1340199486 No.19555069</b>
+<pre style='font-family: sans-serif;'>
 >>19555050
 Ask Kyoko about the perverts and acquire more booze
-
+</pre> ---------------------------------- -Anonymous 1340199510 No.19555075 -
+<b>Anonymous 1340199510 No.19555075</b>
+<pre style='font-family: sans-serif;'>
 >>19555050
 [X]Ask Kyoko more about these perverts.
 
 We need to know the threat these people pose, we're a professional.
-
+</pre> ---------------------------------- -Anonymous 1340200319 No.19555191 -
+<b>Anonymous 1340200319 No.19555191</b>
+<pre style='font-family: sans-serif;'>
 >Ask about the perverts, and if she's one of them.
-
+</pre> ---------------------------------- -Deculture 1340201431 No.19555359 +<b>Deculture 1340201431 No.19555359</b> [[File:1340201431195.png|thumb|left|200x200px]] -
+<pre style='font-family: sans-serif;'>
 >>19555191
 >>19555075
 >>19555069
@@ -255,19 +255,19 @@ She finally notices that she's chewing on filter, and hastily spits it out. "Ble
 Rapists. Wonderful, you think as you drain your third...or fourth glass, you can't remember. All you know is that you've dealt with such folk before, and you usually ended up wasting too much ammo.
 
 "Well, are you gonna take it or what? I wouldn't." The eyepatched girl grumbles. "Two grief seeds, but then again, you're not exactly the type to play white knight. I mean, look at you." She laughs. "It's barely dinnertime and you already smell like booze."
-
+</pre> ---------------------------------- -Anonymous 1340201594 No.19555384 -
+<b>Anonymous 1340201594 No.19555384</b>
+<pre style='font-family: sans-serif;'>
 >>19555359
 "Shooting rapists is a reward on itself"
 
 "yeah, I'll take it"
-
+</pre> ---------------------------------- -Deculture 1340203405 No.19555685 +<b>Deculture 1340203405 No.19555685</b> [[File:1340203405275.png|thumb|left|200x200px]] -
+<pre style='font-family: sans-serif;'>
 >>19555384
 
 Kyoko blinks at your reply, before grinning. "Yeah, things never do change. I knew you'd say that, even though this isn't really your type of thing." Stubbing out her cigarette on the table as she sips her drink. "At least this way something exciting'll be in the news. Hey, you think you can execute one of them on camera? That's always good TV, you know. Gives us a bit more exposure."
@@ -281,20 +281,20 @@ You stare as Kyoko is suddenly replaced by a hallucination. The pink-haired girl
 You're not Homura. You're Chiaki. Chiaki Matsuda.
 
 How do you react?
-
+</pre> ---------------------------------- -Anonymous 1340204258 No.19555818 -
+<b>Anonymous 1340204258 No.19555818</b>
+<pre style='font-family: sans-serif;'>
 >>19555685
 
 "Do you know why I drink?", take a shot, "Some people drink to remember, but not me. I drink to forget. And it works. I've forgotten my name, the day of the week, the faces of my parents, even what I did last night. But you? Your stupid face? The thing that drove me to the bottle in the first place? Clear as crystal, every fucking time.
 
 What do you want."
-
+</pre> ---------------------------------- -Deculture 1340205498 No.19556039 +<b>Deculture 1340205498 No.19556039</b> [[File:1340205498132.png|thumb|left|200x200px]] -
+<pre style='font-family: sans-serif;'>
 >>19555818
 
 Despite the horror of something from your recurring nightmares coming out into reality and actually talking to you, you manage to say this perfectly, even managing not to spill any whisky down the front of your costume as you drain your glass.
@@ -309,10 +309,10 @@ She lets out a sigh, and you smell her breath, pungent and sweet with decay and
 
 [] Bullshit. You're just another hallucination. I haven't been sleeping right. Besides, I killed you. You're already dead.
 [] No. Let's go right now. You, me, outside.
-
+</pre> ---------------------------------- -Anonymous 1340223515 No.19557337 -
+<b>Anonymous 1340223515 No.19557337</b>
+<pre style='font-family: sans-serif;'>
 >>19556039
 >[X] Bullshit. You're just another hallucination. I haven't been sleeping right. Besides, I killed you. You're already dead.
 
@@ -322,11 +322,11 @@ She would have never said something like that."
 Also: 
 Music for that scene: 
 http://www.youtube.com/watch?v=AsbzP1AVS4k&feature=relmfu
-
+</pre> ---------------------------------- -Deculture 1340233884 No.19559357 +<b>Deculture 1340233884 No.19559357</b> [[File:1340233884824.png|thumb|left|200x200px]] -
+<pre style='font-family: sans-serif;'>
 >>19557337
 
 The phantasm seems to slightly frown at your words, brow quirking as if this reaction was entirely unexpected - but her expression smoothens out to her previous one, her dark eyes glittering. It's then that she leans forward, smiling once more, her small tongue darting out to lick her lips.
@@ -346,10 +346,10 @@ There's a first time for everything, you suppose.
 "Hey, hey, you alright? Come on, Murderface, don't scare me like that." Kyoko amusingly almost seems concerned about you. "Look, I-I don't know what sort of shit you're taking, but you gotta cut down. Really. Maybe we can even get you some of them patches for the smokes--"
 
 You shrug her off, murmur an apology, and frown as you realize that you've knocked the whisky bottle off the table and into the floor in this particular episode. You glance apologetically at Charles, and he merely nods. It'll be on your tab.
-
+</pre> ---------------------------------- -Deculture 1340234377 No.19559447 -
+<b>Deculture 1340234377 No.19559447</b>
+<pre style='font-family: sans-serif;'>
 You murmur something to Kyoko and make to leave, but she grabs your hand.
 
 "Murderface? Murderface, talk to me. What the hell was that about? What happened there?"
@@ -379,6 +379,6 @@ You stomp off towards the direction you remember that particular Hotel is. Time
 Sorry about my absence, everyone. The cloudflare issues kinda stopped me from updating. I wanted to end it neatly here, though, so the next thread will be able to start better. It'll be at the same time.
 
 Thank you for everyone who participated.
-
+</pre> ----------------------------------
\ No newline at end of file -- 2.39.5