[xiph-cvs] r6732 - in websites-ngen: . xiph.org xiph.org/contribute xiph.org/contribute/metadata
comatoast at xiph.org
comatoast at xiph.org
Thu May 20 02:07:08 PDT 2004
Author: comatoast
Date: 2004-05-20 05:07:07 -0400 (Thu, 20 May 2004)
New Revision: 6732
Added:
websites-ngen/xiph.org/aftermaintext.es.inherit
websites-ngen/xiph.org/beforecontent.es.include
websites-ngen/xiph.org/contribute/metadata/index.markdown
websites-ngen/xiph.org/css.es.include
websites-ngen/xiph.org/css.es.inherit
websites-ngen/xiph.org/index.de.markdown
websites-ngen/xiph.org/lang.include
Removed:
websites-ngen/xiph.org/aftermaintext.include
websites-ngen/xiph.org/contribute/xiph-specific.markdown
Modified:
websites-ngen/wrapup.py
websites-ngen/xiph.org/contribute/index.markdown
websites-ngen/xiph.org/contribute/metadata/
Log:
Multilingual support seemingly done. Now, we only need decent copy to have the translators translate.
Modified: websites-ngen/wrapup.py
===================================================================
--- websites-ngen/wrapup.py 2004-05-20 03:53:31 UTC (rev 6731)
+++ websites-ngen/wrapup.py 2004-05-20 09:07:07 UTC (rev 6732)
@@ -22,8 +22,11 @@
import os, re, sys, glob, os.path, time, datetime
import pdb
from ConfigParser import SafeConfigParser
+
MARKDOWN_COMMAND = "perl Markdown.pl" # could also be "perl Markdown.pl"
TITLE_REGEX = re.compile(r"<h1.*>(.*)</h1>")
+LANGUAGE_EXTRACTOR = re.compile(r"^.*\.(.{2,5})\..*$") # anything from â.es.â to â.zh-TW.â
+
class MarkdownWrapper(object):
"""
Important attributes:
@@ -63,7 +66,7 @@
.afterContentInherit -- stuff to include after the content div
"""
- def __init__(self, sourceFilename, destFilename=None, lang=None):
+ def __init__(self, sourceFilename, destFilename=None):
self.sourceFilename = sourceFilename
if destFilename:
self.destFilename = destFilename
@@ -80,8 +83,11 @@
if match: #TODO: needs decent error handling
self.title = "Xiph.Org: " + match.group(1)
- self.lang = lang
- if self.lang == None: self.lang == 'en-US'
+ self.lang = 'en-US'
+ lm = LANGUAGE_EXTRACTOR.match(sourceFilename)
+ if lm:
+ self.lang = lm.group(1)
+
self.inHeadInherit = ''
self.inHeadInclude = ''
@@ -89,6 +95,8 @@
self.cssInherit = ''
self.cssInclude = ''
+ self.langInclude = ''
+
self.beforeContentInherit = ''
self.beforeContentInclude = ''
@@ -100,50 +108,77 @@
# Now we need to stuff these attributes from their respective files.
- inheritables = "inhead css beforecontent aftermaintext aftercontent".split()
+ prefixes = "inhead css beforecontent aftermaintext aftercontent".split()
+ inheritables = prefixes[:]
inheritables = [i + ".inherit" for i in inheritables]
- includables = "inhead css beforecontent aftermaintext aftercontent".split()
+ includables = prefixes[:]
includables = [i + ".include" for i in includables]
# this if cascade is ugly, ugly, ugly, ugly. Suggestions, please.
-
- for baseFilename in inheritables:
+ def makeSearchers(baseList, ext):
+ ret = []
+ for base in baseList:
+ s = r"^.*" + base + r".*" + ext + r"$"
+ ret.append(re.compile(s))
+ return tuple(ret)
+
+ languagedPrefixes = prefixes[:]
+ if self.lang != 'en-US':
+ languagedPrefixes = [x + r'\.' + self.lang + r'\.' for x in languagedPrefixes]
+ (INHEAD_INHERIT,
+ CSS_INHERIT,
+ BEFORECONTENT_INHERIT,
+ AFTERMAINTEXT_INHERIT,
+ AFTERCONTENT_INHERIT) = makeSearchers(languagedPrefixes, "inherit")
+ (INHEAD_INCLUDE,
+ CSS_INCLUDE,
+ BEFORECONTENT_INCLUDE,
+ AFTERMAINTEXT_INCLUDE,
+ AFTERCONTENT_INCLUDE) = makeSearchers(languagedPrefixes, "include")
+
+ for baseFilename in prefixes[:]:
+ if self.lang != 'en-US':
+ baseFilename += ".%s" % self.lang
+ baseFilename += ".inherit"
filename = getParallelFile(self.sourceFilename, baseFilename)
filename = getParentedFile(filename)
if not filename: continue
-
if os.path.isfile(filename):
contents = file(filename).read()
- if filename.endswith('inhead.inherit'):
+ if INHEAD_INHERIT.search(filename):
self.inHeadInherit = contents
- if filename.endswith('css.inherit'):
+ if CSS_INHERIT.search(filename):
self.cssInherit = contents
- if filename.endswith('beforecontent.inherit'):
+ if BEFORECONTENT_INHERIT.search(filename):
self.beforeContentInherit = contents
- if filename.endswith('aftermaintext.inherit'):
+ if AFTERMAINTEXT_INHERIT.search(filename):
self.afterMainTextInherit = contents
- if filename.endswith('aftercontent.inherit'):
+ if AFTERCONTENT_INHERIT.search(filename):
self.afterContentInherit = contents
+ for baseFilename in prefixes[:]:
+ if self.lang != 'en-US':
+ baseFilename += ".%s" % self.lang
+ baseFilename += ".include"
- for baseFilename in includables:
filename = getParallelFile(self.sourceFilename, baseFilename)
# notice the complete lack of getParentedFile()
if not filename: continue
-
if os.path.isfile(filename):
contents = file(filename).read()
- if filename.endswith('inhead.include'):
+ if INHEAD_INCLUDE.search(filename):
self.inHeadInclude = contents
- if filename.endswith('css.include'):
+ if CSS_INCLUDE.search(filename):
self.cssInclude = contents
- if filename.endswith('beforecontent.include'):
+ if BEFORECONTENT_INCLUDE.search(filename):
self.beforeContentInclude = contents
- if filename.endswith('aftermaintext.include'):
+ if AFTERMAINTEXT_INCLUDE.search(filename):
self.afterMainTextInclude = contents
- if filename.endswith('aftercontent.include'):
+ if AFTERCONTENT_INCLUDE.search(filename):
self.afterMainTextInclude = contents
-
+ langFilename = getParallelFile(self.sourceFilename, "lang.include")
+ if langFilename and os.path.isfile(langFilename):
+ self.langInclude = file(langFilename).read()
def renderToFile(self):
outfile = file(self.destFilename, "w")
try:
@@ -166,6 +201,7 @@
ret += self.cssInclude
ret += "</head>\n"
ret += "<body>\n"
+ ret += self.langInclude
ret += self.beforeContentInherit
ret += self.beforeContentInclude
ret += "<div id='content'>\n"
@@ -178,6 +214,7 @@
ret += "</html>\n"
return ret
+
def markdown(filename):
"""Returns an HTML snippet from a filename in Markdown format."""
ret = ""
@@ -272,17 +309,16 @@
self.date = date
self.sections = sections
- def __str__(self):
- return str(self.__dict__)
-
+ def __cmp__(self, other):
+ return cmp(self.date)
+
class NewsDispenser:
- def __init__(self, optionsFile, printableDateFormat="%A, %B %d, %Y"):
+ def __init__(self, optionsFile):
"""Make a very simple list of news posts. This is not final code."""
config = SafeConfigParser({'sections': 'general'})
config.read(os.path.join("news", "options.ini"))
- self.printableDateFormat = printableDateFormat
FILENAME_DATE_FORMAT = "on%Y-%m-%dat%H%M"
self.newsItems = []
@@ -290,9 +326,7 @@
# okay, now we want to go through the sections and associate each with their newspost.
for section in config.sections(): # section is string
ni = NewsItem()
- l = []
ni.date = time.strptime(section, FILENAME_DATE_FORMAT)
- o = {}
for key, value in config.items(section):
if key == 'author':
ni.author = value
@@ -307,20 +341,17 @@
def dump(self):
return self.newsItems[:]
-
-class NewsFormatter:
- def __init__(self, newsItems):
- pass
- def formatOne(self, newsItem):
- pass
-
- def formatAll(self):
+ def getItems(startDate, endDate):
"""
- turns the news items into a formatted string, which is then returned.
+ Return news items from
"""
- pass
+class NewsFormatter:
+ def __init__(self, newsItems): pass
+ def formatOne(self, newsItem): pass
+ def formatAll(self): pass
+
class HTMLNewsFormatter(NewsFormatter):
""" This is just one HTML news formatter of possibly many, really."""
def __init__(self, newsItems, dateFormat="%A, %B %d, %Y"):
@@ -341,8 +372,6 @@
for ni in self.newsItems:
ret += self.formatOne(ni)
return ret
-
-
class AtomNewsFormatter(NewsFormatter):
@@ -387,10 +416,7 @@
destFile = os.path.splitext(filename)[0] + ".html"
destPath = getParallelFile(srcPath, destFile)
print srcPath
-
- lang = 'en-US'
- if ".es." in srcPath: lang = "es"
- mw = MarkdownWrapper(srcPath, destPath, lang)
+ mw = MarkdownWrapper(srcPath, destPath)
mw.renderToFile()
if ".svn" in dirnames:
dirnames.remove('.svn') # don't transform things in .svn directories
@@ -402,7 +428,6 @@
fh = open('xiph.org\\atom.xml', 'w')
fh.write(s)
fh.close()
-
if __name__ == '__main__':
doSite()
Added: websites-ngen/xiph.org/aftermaintext.es.inherit
===================================================================
--- websites-ngen/xiph.org/aftermaintext.es.inherit 2004-05-20 03:53:31 UTC (rev 6731)
+++ websites-ngen/xiph.org/aftermaintext.es.inherit 2004-05-20 09:07:07 UTC (rev 6732)
@@ -0,0 +1,3 @@
+<div id='copyright'>
+ © 2004 <a href='/'>Xiph.org</a>
+</div>
Deleted: websites-ngen/xiph.org/aftermaintext.include
===================================================================
--- websites-ngen/xiph.org/aftermaintext.include 2004-05-20 03:53:31 UTC (rev 6731)
+++ websites-ngen/xiph.org/aftermaintext.include 2004-05-20 09:07:07 UTC (rev 6732)
@@ -1,5 +0,0 @@
-<div id='languages'>
- <a href='./' title='English' hreflang='en-US'>en</a> |
- <a href='es' title='Español' hreflang='es' >es</a> |
- <a href='de' title='Deutsch' hreflang='de' >de</a>
-</div>
Added: websites-ngen/xiph.org/beforecontent.es.include
===================================================================
--- websites-ngen/xiph.org/beforecontent.es.include 2004-05-20 03:53:31 UTC (rev 6731)
+++ websites-ngen/xiph.org/beforecontent.es.include 2004-05-20 09:07:07 UTC (rev 6732)
@@ -0,0 +1,19 @@
+<div id='sidebar'>
+<ul>
+<!-- he olvido todo que aprendà en mi secundario -->
+<li class='forusers'>
+ <a href='/forusers/'>
+ <strong>Por Usarios</strong><br>
+ Mejorar tu collección de música.
+ <em class='reset'> </em>
+ </a>
+</li>
+<li class='vorbis'>
+ <a href='/vorbis/'>
+ <strong>Vorbis</strong><br>
+ Compresión <i>lossy</i> para música.
+ <em class='reset'> </em>
+ </a>
+</li>
+</ul>
+</div>
Modified: websites-ngen/xiph.org/contribute/index.markdown
===================================================================
--- websites-ngen/xiph.org/contribute/index.markdown 2004-05-20 03:53:31 UTC (rev 6731)
+++ websites-ngen/xiph.org/contribute/index.markdown 2004-05-20 09:07:07 UTC (rev 6732)
@@ -86,3 +86,15 @@
[free software]: http://www.gnu.org/philosophy/free-sw.html "Free as in freedom, mind you"
[VorbisGain]: http://sjeng.org/vorbisgain.html
[donate]: /donate/
+
+(the following was simply removed out of another file)
+
+Enhancing For Xiph
+------------------
+
+Assuming your audio player already supports Vorbis and FLAC, what can you do to enhance it
+further? Here are a number of corner cases that you could tryâ¦
+
+## Ensure that your application supports UTF-8 comments properly.
+Many older tagging standards did not specify an encoding; Vorbis-style comment headers do.
+Your ability to handle UTF-8 may be dependent on the libraries at your disposal
<p>Property changes on: websites-ngen/xiph.org/contribute/metadata
___________________________________________________________________
Name: svn:ignore
+ index.html
<p>Added: websites-ngen/xiph.org/contribute/metadata/index.markdown
===================================================================
--- websites-ngen/xiph.org/contribute/metadata/index.markdown 2004-05-20 03:53:31 UTC (rev 6731)
+++ websites-ngen/xiph.org/contribute/metadata/index.markdown 2004-05-20 09:07:07 UTC (rev 6732)
@@ -0,0 +1,10 @@
+Adding Better Metadata Support
+==============================
+
+One of the ways you can make Vorbis and FLAC better is by improving metadata support.
+
+## Use modern libraries.
+One of the best things you can do to ensure that proper Unicode support is possible for an
+application is to use good libraries that have handled all the difficult parts. What this means
+is that if your favorite application uses GTK 1, one of the best things you could do is to port
+it to GTK 2, where youâll be able to take advantage of Pangoâs superior Unicode support.
Deleted: websites-ngen/xiph.org/contribute/xiph-specific.markdown
===================================================================
--- websites-ngen/xiph.org/contribute/xiph-specific.markdown 2004-05-20 03:53:31 UTC (rev 6731)
+++ websites-ngen/xiph.org/contribute/xiph-specific.markdown 2004-05-20 09:07:07 UTC (rev 6732)
@@ -1,9 +0,0 @@
-Enhancing For Xiph
-==================
-
-Assuming your audio player already supports Vorbis and FLAC, what can you do to enhance it
-further? Here are a number of corner cases that you could tryâ¦
-
-## Ensure that your application supports UTF-8 comments properly.
-Many older tagging standards did not specify an encoding; Vorbis-style comment headers do.
-Your ability to handle UTF-8 may be dependent on the libraries at your disposal
Added: websites-ngen/xiph.org/css.es.include
===================================================================
--- websites-ngen/xiph.org/css.es.include 2004-05-20 03:53:31 UTC (rev 6731)
+++ websites-ngen/xiph.org/css.es.include 2004-05-20 09:07:07 UTC (rev 6732)
@@ -0,0 +1,3 @@
+ <style type='text/css'>
+ @import url(/CSS/sidebar-additions.css);
+ </style>
Added: websites-ngen/xiph.org/css.es.inherit
===================================================================
--- websites-ngen/xiph.org/css.es.inherit 2004-05-20 03:53:31 UTC (rev 6731)
+++ websites-ngen/xiph.org/css.es.inherit 2004-05-20 09:07:07 UTC (rev 6732)
@@ -0,0 +1,3 @@
+ <style type='text/css'>
+ @import url(/CSS/all.css);
+ </style>
Added: websites-ngen/xiph.org/index.de.markdown
===================================================================
--- websites-ngen/xiph.org/index.de.markdown 2004-05-20 03:53:31 UTC (rev 6731)
+++ websites-ngen/xiph.org/index.de.markdown 2004-05-20 09:07:07 UTC (rev 6732)
@@ -0,0 +1,4 @@
+Willkommen in Xiph.Org
+======================
+
+Ich kann Glas essen, ohne mir weh zu tun.
Added: websites-ngen/xiph.org/lang.include
===================================================================
--- websites-ngen/xiph.org/lang.include 2004-05-20 03:53:31 UTC (rev 6731)
+++ websites-ngen/xiph.org/lang.include 2004-05-20 09:07:07 UTC (rev 6732)
@@ -0,0 +1,5 @@
+<div id='languages'>
+ <a href='./' title='English' hreflang='en-US'>en</a> |
+ <a href='es' title='Español' hreflang='es' >es</a> |
+ <a href='de' title='Deutsch' hreflang='de' >de</a>
+</div>
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list