Added an alternate syntax to [about], so you can now use:

[entry]
name = ...
[/entry]

This allows maintaining extra information about each contributor
(comment, email, wikiname are the likely candidates). Using the text
tag stays fully valid and there's no need to use [entry] if the extra
info is not important.
This commit is contained in:
Elias Pschernig 2007-07-29 20:07:45 +00:00
parent bc939ccf1b
commit 5bec20ad51
3 changed files with 1412 additions and 669 deletions

View file

@ -25,17 +25,27 @@
#textdomain wesnoth
[about]
title = _ "Campaign Designer"
text = "David White (sirp)"
[entry]
name = "David White (sirp)"
[/entry]
[/about]
[about]
title = _ "Current Maintainer"
text = "Scott Klempner"
[entry]
name = "Scott Klempner"
[/entry]
[/about]
[about]
title = _ "Artwork and Graphics Designers"
text = "Francisco Muñoz (fmunoz)
Richard Kettering (Jetryl)
Neoriceisgood (?)"
[entry]
name = "Francisco Muñoz (fmunoz)"
[/entry]
name = "Richard Kettering (Jetryl)"
[entry]
[/entry]
[entry]
name = "Neoriceisgood (?)"
[/entry]
[/about]
# [about]
# title = _ "Miscellaneous"

File diff suppressed because it is too large Load diff

View file

@ -28,6 +28,38 @@ namespace about
static std::map<std::string , std::string> images;
static std::string images_default;
// Given a vector of strings, and a config representing an [about] section,
// add all the credits lines from the about section to the list of strings.
std::string add_lines(std::vector<std::string> &res, config const &c) {
std::string title=c["title"];
if(title.size()) {
title = N_("+" + title);
res.push_back(title);
}
std::vector<std::string> lines = utils::split(c["text"], '\n');
for(std::vector<std::string>::iterator line = lines.begin();
line != lines.end(); line++) {
if((*line)[0] == '+' && (*line).size()>1){
*line = N_("+ " + (*line).substr(1,(*line).size()-1));
} else {
*line = "- " + *line;
}
if(line->size()) {
if ((*line)[0] == '_')
*line = gettext(line->substr(1,line->size()-1).c_str());
res.push_back(*line);
}
}
config::child_list entries = c.get_children("entry");
config::child_list::const_iterator entry;
for(entry = entries.begin(); entry != entries.end(); entry++) {
res.push_back("- "+(**entry)["name"]);
}
}
std::vector<std::string> get_text(std::string campaign) {
std::vector< std::string > res;
@ -36,48 +68,12 @@ std::vector<std::string> get_text(std::string campaign) {
for(config::child_list::const_iterator cc = children.begin(); cc != children.end(); ++cc) {
//just finished a particular campaign
if(campaign.size() && campaign == (**cc)["id"]){
std::string title=(**cc)["title"];
if(title.size()){
title = N_("+" + title);
res.push_back(title);
}
std::vector<std::string> lines=utils::split((**cc)["text"],'\n');
for(std::vector<std::string>::iterator line=lines.begin();
line != lines.end(); line++){
if((*line)[0] == '+' && (*line).size()>1){
*line = N_("+ " + (*line).substr(1,(*line).size()-1));
}else{
*line = "- " + *line;
}
if(line->size()){
if ((*line)[0] == '_')
*line = gettext(line->substr(1,line->size()-1).c_str());
res.push_back(*line);
}
}
add_lines(res, **cc);
}
}
for(config::child_list::const_iterator acc = children.begin(); acc != children.end(); ++acc) {
std::string title=(**acc)["title"];
if(title.size()){
title = N_("+" + title);
res.push_back(title);
}
std::vector<std::string> lines=utils::split((**acc)["text"],'\n');
for(std::vector<std::string>::iterator line=lines.begin();
line != lines.end(); line++){
if((*line)[0] == '+' && (*line).size()>1){
*line = N_("+ " + (*line).substr(1,(*line).size()-1));
}else{
*line = "- " + *line;
}
if(line->size()){
if ((*line)[0] == '_')
*line = gettext(line->substr(1,line->size()-1).c_str());
res.push_back(*line);
}
}
add_lines(res, **acc);
}
return res;
@ -117,9 +113,15 @@ void set_about(const config& cfg){
}
std::vector<std::string> lines=utils::split(AA["text"],'\n');
for(std::vector<std::string>::iterator line=lines.begin();
line != lines.end(); line++){
line != lines.end(); line++){
text+=" "+(*line)+"\n";
}
config::child_list entries = AA.get_children("entry");
config::child_list::const_iterator entry;
for(entry = entries.begin(); entry != entries.end(); entry++) {
text+=" "+(**entry)["name"]+"\n";
}
if(!AA["images"].empty()){
if(images[campaign].empty()){
@ -128,7 +130,7 @@ void set_about(const config& cfg){
images[campaign]+=","+AA["images"];
}
}
}
}
temp["text"]=text;
about_list.add_child("about",temp);
}