OSDN Git Service

support div.column
authorhylom <hylom@users.sourceforge.jp>
Thu, 19 Nov 2009 11:49:13 +0000 (20:49 +0900)
committerhylom <hylom@users.sourceforge.jp>
Thu, 19 Nov 2009 11:49:13 +0000 (20:49 +0900)
sfmag2wiki/Makefile
sfmag2wiki/html2sfjpwiki.py
sfmag2wiki/sfmag_html2wiki2.sh [new file with mode: 0755]

index c08b991..19c1aa1 100644 (file)
@@ -3,6 +3,10 @@
 TARGET=wiki.txt
 UPLOAD=/Users/hylom/otptools/sfmag2wiki/s2wupload.pl
 ATTACH=/Users/hylom/otptools/sfmag2wiki/s2wattach.pl
+CONV=/Users/hylom/otptools/sfmag2wiki/sfmag_html2wiki.py
+FETCHDIR=/Users/hylom/otptools/sfmag2wiki/fetch
+OUTDIR=/Users/hylom/otptools/sfmag2wiki/tree3
+DIRNAME:=$(shell basename $$PWD)
 
 attachments=$(wildcard *.png *jpg *.gif)
 targets=wiki.txt.cache $(patsubst %,%.cache, $(attachments))
@@ -40,4 +44,7 @@ clean:
        rm -f *.cache
 
 prep:
-       for i in *;do [ -d $$i ] && ln -sf ../Makefile $$i/Makefile; done
\ No newline at end of file
+       for i in *;do [ -d $$i ] && ln -sf ../Makefile $$i/Makefile; done
+
+update:
+       @echo $(CONV) $(FETCHDIR)/$(subst -,/,$(DIRNAME)).body.html $(FETCHDIR) $(OUTDIR)
index 97d850f..499a83d 100644 (file)
@@ -35,6 +35,7 @@ class Html2SfjpWiki(HTMLParser.HTMLParser):
         self._inner = {}
         self._url_r_map = {}
         self._pre_data = ""
+        self._in_column = False
 
     def set_url_replace_list(self, fname):
         f = open(fname, "r")
@@ -373,6 +374,13 @@ class Html2SfjpWiki(HTMLParser.HTMLParser):
         if ("class", "navigation") in attrs:
             self._in_div = 1
             self._block = True
+        elif ("class", "column") in attrs:
+            self._in_div = 1
+            self._in_column = True
+            self._put("""{{{ html
+<div class="column">
+}}}
+""")
         elif self._in_div > 0:
             self._in_div += 1
 
@@ -382,6 +390,14 @@ class Html2SfjpWiki(HTMLParser.HTMLParser):
 
         if self._in_div == 0:
             self._block = False
+
+        if self._in_column:
+            self._in_column = False
+            self._put("""{{{ html
+</div>
+}}}
+""")
+
         
     def _h_start_pre(self, tag, attrs):
         pass
diff --git a/sfmag2wiki/sfmag_html2wiki2.sh b/sfmag2wiki/sfmag_html2wiki2.sh
new file mode 100755 (executable)
index 0000000..e1bfcdb
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh
+CONV=./sfmag_html2wiki.py
+dir=$1
+out=$2
+list=$3
+if [ "$list" == "" ]; then
+    echo "$0 <input_directory> <output_directory> <list>"
+    exit
+fi
+
+for url in `cat $list`
+do
+    rpath=${url#http://sourceforge.jp/magazine}
+    #echo find $dir/$rpath -name "body.html" -exec $CONV {} $dir $out \;
+    find $dir/$rpath -name "body.html" -exec $CONV {} $dir $out \;
+done
+
+
+#cat $dir/navigation.txt > $dir/navi.txt
\ No newline at end of file