1
0
mirror of https://github.com/KanjiVG/kanjivg.git synced 2026-04-22 13:30:42 +02:00

Remove obsolete files

This commit is contained in:
Alexandre Courbot
2011-07-23 23:00:33 +09:00
parent 9426be3356
commit f056bce44d
3 changed files with 1 additions and 106 deletions

View File

@@ -1,52 +0,0 @@
#!/usr/bin/python2
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 Alexandre Courbot
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Take all the individual SVG files and merge them into a single file suitable
# for release. This file only includes non-variant kanji.
import os, datetime, re
from kanjivg import licenseString
__datadir = "kanji"
__idMatchString = "<g id=\"kvg:StrokePaths_"
if __name__ == "__main__":
allfiles = os.listdir(__datadir)
files = []
for f in allfiles:
if len(f) == 9: files.append(f)
del allfiles
files.sort()
out = open("kanjivg.xml", "w")
out.write('<?xml version="1.0" encoding="UTF-8"?>\n')
out.write("<!--\n")
out.write(licenseString)
out.write("\nThis file has been generated on %s, using the latest KanjiVG data\nto this date." % (datetime.date.today()))
out.write("\n-->\n")
out.write("<kanjivg>\n")
for f in files:
data = open(os.path.join(__datadir, f)).read()
data = data[data.find("<svg "):]
data = data[data.find(__idMatchString) + len(__idMatchString):]
kidend = data.find("\"")
data = "<kanji id=\"kvg:kanji_%s\">" % (data[:kidend],) + data[data.find("\n"):data.find('<g id="kvg:StrokeNumbers_') - 5] + "</kanji>\n"
out.write(data)
out.write("</kanjivg>\n")
out.close()
print("%d kanji emitted" % len(files))

View File

@@ -1,53 +0,0 @@
#!/usr/bin/python2
# -*- coding: utf-8 -*-
import os, codecs, xml.sax, datetime, sys
from kanjivg import *
def createSVG(out, kanji):
out.write('<?xml version="1.0" encoding="UTF-8"?>\n')
out.write("<!-- ")
out.write(licenseString)
out.write("\nThis file has been generated on %s, using the latest KanjiVG data to this date." % (datetime.date.today()))
out.write("\n-->\n\n")
out.write("""<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" [
<!ATTLIST g
xmlns:kanjivg CDATA #FIXED "http://kanjivg.tagaini.net"
kanjivg:element CDATA #IMPLIED
kanjivg:variant CDATA #IMPLIED
kanjivg:partial CDATA #IMPLIED
kanjivg:original CDATA #IMPLIED
kanjivg:part CDATA #IMPLIED
kanjivg:number CDATA #IMPLIED
kanjivg:tradForm CDATA #IMPLIED
kanjivg:radicalForm CDATA #IMPLIED
kanjivg:position CDATA #IMPLIED
kanjivg:radical CDATA #IMPLIED
kanjivg:phon CDATA #IMPLIED >
<!ATTLIST path
xmlns:kanjivg CDATA #FIXED "http://kanjivg.tagaini.net"
kanjivg:type CDATA #IMPLIED >
]>
<svg xmlns="http://www.w3.org/2000/svg" width="109" height="109" viewBox="0 0 109 109" style="fill:none;stroke:#000000;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;">
""")
#<defs>
#<marker id="Triangle"
#viewBox="0 0 10 10" refX="0" refY="5"
#markerUnits="strokeWidth"
#markerWidth="4" markerHeight="3"
#orient="auto" stroke="none" fill="#ff0000">
#<path d="M 0 0 L 10 5 L 0 10 z" />
#</marker>
#</defs>
kanji.toSVG(out)
out.write("</svg>\n")
if __name__ == "__main__":
handler = KanjisHandler()
xml.sax.parse(sys.argv[1], handler)
kanjis = handler.kanjis.values()
for kanji in kanjis:
out = codecs.open("data/" + str(kanji.id) + ".svg", "w", "utf-8")
createSVG(out, kanji)

View File

@@ -3,7 +3,7 @@ d=`date +%Y%m%d`
outFileOne="kanjivg-$d.xml.gz"
outFileAll="kanjivg-$d-all.zip"
zip -r $outFileAll kanji
python createsinglerelease.py
python kvg.py release
gzip -c kanjivg.xml >$outFileOne
scp $outFileOne $outFileAll gnurou@gnurou.org:/srv/http/kanjivg/upload/Main/
ssh gnurou@gnurou.org "ln -sf $outFileOne /srv/http/kanjivg/upload/Main/kanjivg-latest.xml.gz"