update for new website. generates CREDITS, credits.inc and blanket-permission.inc.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24102 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Joost Verburg 2008-04-03 17:29:27 +00:00
parent a110ee7a92
commit 15bb8065b9

View File

@ -10,13 +10,13 @@ author Angus Leeming
Full author contact details are available in file CREDITS Full author contact details are available in file CREDITS
This script both stores and manipulates the raw data needed to This script both stores and manipulates the raw data needed to
create CREDITS, credits.php and blanket-permission.php create CREDITS, credits.inc and blanket-permission.inc
Usage: Usage:
$ python generate_contributions.py \ $ python generate_contributions.py \
CREDITS \ CREDITS \
credits.php \ credits.inc \
blanket-permission.php blanket-permission.inc
where the arguments are the names of the generated files. where the arguments are the names of the generated files.
''' '''
@ -65,7 +65,7 @@ class contributer:
def as_php_credits(self, wrapper): def as_php_credits(self, wrapper):
return ''' return '''
contrib("%s", $output=$output.credits_contrib("%s",
"%s", "%s",
"%s"); "%s");
''' % ( xml_escape(self.name), ''' % ( xml_escape(self.name),
@ -75,7 +75,7 @@ contrib("%s",
def as_php_blanket(self): def as_php_blanket(self):
return ''' return '''
contrib("%s", $output=$output.blanket_contrib("%s",
"%s", "%s",
"%s", "%s",
"%s", "%s",
@ -133,69 +133,59 @@ just drop some e-mail to lyx@lyx.org. Thanks.
return "".join(results) return "".join(results)
def header(title, file): def header():
return '''<?php return '''<?php
// WARNING! This file is autogenerated. // WARNING! This file is autogenerated.
// Any changes to it will be lost. // Any changes to it will be lost.
// Please modify generate_contributions.py direct. // Please modify generate_contributions.py direct.
'''
// What's the title of the page?
$title = "%s";
// Who is the author?
$author="lyx-devel@lists.lyx.org";
// Full name of this file (relative path from LyX home page)
$file_full="about/%s";
include("start.php");
?>
''' % ( title, file )
def footer(): def footer():
return ''' return '''
<?php
include("end.php");
?>
''' '''
def as_php_credits(contributers, file): def as_php_credits(contributers, file):
results = [] results = []
results.append(header("CREDITS", file)) results.append(header())
results.append(''' results.append('''
<?
function contrib($name, $email, $msg) {
echo " function credits_contrib($name, $email, $msg) {
$output=$output. "
<dt> <dt>
<b>${name}</b> <b>${name}</b>
"; ";
if (isset($email) && $email != "") if (isset($email) && $email != "")
echo " <i>&lt;${email}&gt;</i>"; $output=$output. " <i>&lt;${email}&gt;</i>";
$msg = ereg_replace("\\n *", "\\n ", ltrim($msg)); $msg = ereg_replace("\\n *", "\\n ", ltrim($msg));
echo " $output=$output. "
</dt> </dt>
<dd> <dd>
${msg} ${msg}
</dd>"; </dd>";
return $output;
} }
?> function credits_output() {
<p> $output=$output."<p>
If your name doesn't appear here although you've done If your name doesn't appear here although you've done
something for LyX, or your entry is wrong or incomplete, something for LyX, or your entry is wrong or incomplete,
just drop an e-mail to the just drop an e-mail to the
<a href="mailto:lyx-devel@lists.lyx.org">lyx-devel</a> <a href=\\"mailto:lyx-devel@lists.lyx.org\\">lyx-devel</a>
mailing list. Thanks. mailing list. Thanks.
</p> </p>
<dl><?php''') <dl>";
''')
wrapper = textwrap.TextWrapper(width=60, subsequent_indent=" ") wrapper = textwrap.TextWrapper(width=60, subsequent_indent=" ")
@ -203,9 +193,12 @@ echo "
if len(contributer.credit) != 0: if len(contributer.credit) != 0:
results.append(contributer.as_php_credits(wrapper)) results.append(contributer.as_php_credits(wrapper))
results.append('''?> results.append('''
$output=$output."</dl>";
</dl> return $output;
}
''') ''')
results.append(footer()) results.append(footer())
return "".join(results) return "".join(results)
@ -214,13 +207,13 @@ echo "
def as_php_blanket(contributers, file): def as_php_blanket(contributers, file):
results = [] results = []
results.append(header("Permissions", file)) results.append(header())
results.append(''' results.append('''
<?
function contrib($name, $email, $msg_title, $msg_ref, $date) {
echo " function blanket_contrib($name, $email, $msg_title, $msg_ref, $date) {
$output=$output. "
<dt> <dt>
<b>${name}</b> <b>${name}</b>
@ -232,50 +225,58 @@ echo "
if (isset($msg_ref) && $msg_ref != "") { if (isset($msg_ref) && $msg_ref != "") {
$msg_ref = htmlspecialchars("$msg_ref"); $msg_ref = htmlspecialchars("$msg_ref");
echo "<a href=\\"http://marc.info/?l=lyx-devel&amp;${msg_ref}\\">${msg_title}</a>"; $output=$output. "<a href=\\"http://marc.info/?l=lyx-devel&amp;${msg_ref}\\">${msg_title}</a>";
} else { } else {
echo "${msg_title}"; $output=$output. "${msg_title}";
} }
echo "&quot; $output=$output. "&quot;
of $date. of $date.
</dd>"; </dd>";
return $output;
} }
?> function blanket_output() {
<p> $output=$output."<p>
The following people hereby grant permission to licence their The following people hereby grant permission to license their
contributions to LyX under the contributions to LyX under the
<a href="http://www.opensource.org/licenses/gpl-license.php"> <a href=\\"http://www.opensource.org/licenses/gpl-license.php\\">
Gnu General Public Licence</a>, version 2 or later. Gnu General Public License</a>, version 2 or later.
</p> </p>
<dl><?php''') <dl>";
''')
for contributer in contributers: for contributer in contributers:
if contributer.licence == "GPL": if contributer.licence == "GPL":
results.append(contributer.as_php_blanket()) results.append(contributer.as_php_blanket())
results.append('''?> results.append('''
</dl> $output=$output."</dl>";
$output=$output."
<p> <p>
The following people hereby grant permission to licence their The following people hereby grant permission to license their
contributions to LyX under the contributions to LyX under the
<a href="http://www.opensource.org/licenses/artistic-license.php"> <a href=\\"http://www.opensource.org/licenses/artistic-license.php\\">
Artistic Licence</a>. Artistic License</a>.
</p> </p>
<dl> <dl>";
<?php''') ''')
for contributer in contributers: for contributer in contributers:
if contributer.licence == "Artistic": if contributer.licence == "Artistic":
results.append(contributer.as_php_blanket()) results.append(contributer.as_php_blanket())
results.append('''?> results.append('''
</dl> $output=$output."</dl>";
return $output;
}
''') ''')
results.append(footer()) results.append(footer())