[Scummvm-git-logs] scummvm master -> c1697cd177eee47dc413273ff9f50b93cfcd5f9f

Mataniko mataniko at gmail.com
Thu Oct 10 20:45:46 CEST 2019


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
c1697cd177 CREDITS: Add yaml output option and make indentation consistent


Commit: c1697cd177eee47dc413273ff9f50b93cfcd5f9f
    https://github.com/scummvm/scummvm/commit/c1697cd177eee47dc413273ff9f50b93cfcd5f9f
Author: Matan Bareket (mataniko at gmail.com)
Date: 2019-10-10T14:45:43-04:00

Commit Message:
CREDITS: Add yaml output option and make indentation consistent

Changed paths:
    devtools/credits.pl


diff --git a/devtools/credits.pl b/devtools/credits.pl
index 5b8f8b2..da051f4 100755
--- a/devtools/credits.pl
+++ b/devtools/credits.pl
@@ -7,7 +7,8 @@
 # - The gui/credits.h header file
 # - The Credits.rtf file used by the Mac OS X port
 # - The credits.xml file, part of the DocBook manual
-# - Finally, credits.xml, for use on the website (different format than the DocBook one)
+# - The credits.xml, for use on the website (different format than the DocBook one)
+# - The credits.yaml, alternative version for use on the website
 #
 # Initial version written by Fingolfin in December 2004.
 #
@@ -27,6 +28,13 @@ my $max_name_width;
 # in terms of 'sections'.
 my $section_level = 0;
 
+# Variables used for yaml output
+my $person_started = 0;
+my $group_started = 0;
+my $group_indent = "";
+my $paragraph_started = 0;
+my $indent = "";
+
 # Count how many sections there have been on this level already
 my @section_count = ( 0, 0, 0 );
 
@@ -37,11 +45,12 @@ if ($#ARGV >= 0) {
 	$mode = "XML-DOC" if ($ARGV[0] eq "--xml-docbook");		# credits.xml (DocBook)
 	$mode = "RTF" if ($ARGV[0] eq "--rtf");		# Credits.rtf (Mac OS X About box)
 	$mode = "STRONGHELP" if ($ARGV[0] eq "--stronghelp");	# AUTHORS (RISC OS StrongHelp manual)
+	$mode = "YAML" if ($ARGV[0] eq "--yaml");	# YAML (Simple format)
 }
 
 if ($mode eq "") {
-	print STDERR "Usage: $0 [--text | --xml-website | --cpp | --xml-docbook | --rtf | --stronghelp]\n";
-	print STDERR " Just pass --text / --xml-website / --cpp / --xml-docbook / --rtf / --stronghelp as parameter, and credits.pl\n";
+	print STDERR "Usage: $0 [--text | --xml-website | --cpp | --xml-docbook | --rtf | --stronghelp | --yaml]\n";
+	print STDERR " Just pass --text / --xml-website / --cpp / --xml-docbook / --rtf / --stronghelp / --yaml as parameter, and credits.pl\n";
 	print STDERR " will print out the corresponding version of the credits to stdout.\n";
 	exit 1;
 }
@@ -250,6 +259,9 @@ sub begin_credits {
 		print "<?xml version='1.0'?>\n";
 		print "<!-- This file was generated by credits.pl. Do not edit by hand! -->\n";
 		print "<credits>\n";
+	} elsif ($mode eq "YAML") {
+		print "# This file was generated by credits.pl. Do not edit by hand!\n";
+		print "credits:\n";
 	} elsif ($mode eq "STRONGHELP") {
 		print "ScummVM - AUTHORS\n";
 		print "# This file was generated by credits.pl. Do not edit by hand!\n";
@@ -348,14 +360,31 @@ sub begin_section {
 			#print "\t\t\t<group>" . $title . "</group>\n";
 			#print "\t\t\t\t<name>" . $title . "</name>\n";
 		}
+	} elsif ($mode eq "YAML") {
+		my $key = "section:\n";
+		$indent = "  " . ("  " x $section_level);
+		if ($section_level eq 1) {
+			$key = "subsection:\n";
+		}
+
+		if ($section_level < 2) {
+			if (@section_count[$section_level] eq 0) {
+				print $indent . $key;
+			}
+
+			print $indent . "-\n";
+			print $indent . "  title: \"" . $title . "\"\n";
+			if ($anchor) {
+				print $indent . "  anchor: \"" . $anchor . "\"\n";
+			}
+		}
 	} elsif ($mode eq "STRONGHELP") {
 		$title = html_entities_to_iso8859_1($title);
 		print "#fH" . ($section_level + 1) . ":" . $title."\n";
 	}
-
 	# Implicit start of person list on section level 2
 	if ($section_level >= 2) {
-		begin_persons($title);
+		begin_persons($title, 1);
 	}
 	@section_count[$section_level]++;
 	$section_level++;
@@ -364,10 +393,13 @@ sub begin_section {
 
 sub end_section {
 	$section_level--;
+	$paragraph_started = 0;
+	$group_started = 0;
 
 	# Implicit end of person list on section level 2
 	if ($section_level >= 2) {
 		end_persons();
+		$group_started = 1;
 	}
 
 	if ($mode eq "TEXT") {
@@ -391,10 +423,21 @@ sub end_section {
 
 sub begin_persons {
 	my $title = shift;
+	my $level = shift;
+
 	if ($mode eq "XML-WEB") {
 		print "\t\t\t<group>\n";
 		print "\t\t\t\t<name>" . $title . "</name>\n";
 		#print "\t\t\t\t<persons>\n";
+	} elsif ($mode eq "YAML") {
+		$group_indent = $level eq 1 ? "      " : "  " . ("  " x $section_level);
+		if ($group_started == 0) {
+			print $group_indent . "group:\n";
+			$group_started = 1;
+		}
+		print $group_indent . "-\n";
+		print $group_indent . "  name: \"" . $title . "\"\n";
+
 	}
 }
 
@@ -408,6 +451,8 @@ sub end_persons {
 		print "\t\t\t</group>\n";
 	} elsif ($mode eq "STRONGHELP") {
 		print "\n";
+	} elsif ($mode eq "YAML") {
+		$person_started = 0;
 	}
 }
 
@@ -431,9 +476,9 @@ sub add_person {
 
 		# Print desc wrapped
 		if (length $desc > 0) {
-		  my $inner_indent = ($section_level * 2 + 1) + $max_name_width + 3;
-		  my $multitab = " " x $inner_indent;
-		  print " - " . substr(wrap($multitab, $multitab, $desc), $inner_indent);
+			my $inner_indent = ($section_level * 2 + 1) + $max_name_width + 3;
+			my $multitab = " " x $inner_indent;
+			print " - " . substr(wrap($multitab, $multitab, $desc), $inner_indent);
 		}
 		print "\n";
 	} elsif ($mode eq "RTF") {
@@ -482,6 +527,18 @@ sub add_person {
 		print "\t\t\t\t\t<alias>" . $nick . "</alias>\n";
 		print "\t\t\t\t\t<description>" . $desc . "</description>\n";
 		print "\t\t\t\t</person>\n";
+	} elsif ($mode eq "YAML") {
+		$indent = $group_indent . "  ";
+
+		if ($person_started eq 0) {
+			print $indent . "person:\n";
+			$person_started = 1;
+		}
+		print $indent . "-\n";
+		$name = "???" if $name eq "";
+		print $indent . "  name: \"" . $name . "\"\n";
+		print $indent . "  alias: \"" . $nick . "\"\n";
+		print $indent . "  description: \"" . $desc . "\"\n";
 	} elsif ($mode eq "STRONGHELP") {
 		my $min_name_width = length $desc > 0 ? $max_name_width : 0;
 		$name = $nick if $name eq "";
@@ -519,6 +576,13 @@ sub add_paragraph {
 		print "  <row><entry namest='start' nameend='job'> </entry></row>\n\n";
 	} elsif ($mode eq "XML-WEB") {
 		print "\t\t<paragraph>" . $text . "</paragraph>\n";
+	} elsif ($mode eq "YAML") {
+		$indent = "  " . ("  " x $section_level);
+		if ($paragraph_started eq 0) {
+			print $indent . "paragraph:\n";
+			$paragraph_started = 1;
+		}
+		print $indent . "- \"" . $text . "\"\n";
 	} elsif ($mode eq "STRONGHELP") {
 		$text = html_entities_to_iso8859_1($text);
 		print "#Wrap On\n";
@@ -1407,8 +1471,8 @@ begin_credits("Credits");
 				add_person("Bas Zoetekouw", "", "Man pages, debian package management, CVS maintenance");
 			end_persons();
 			add_paragraph("Special thanks to Prof. Dr. Gary Nutt ".
-                    "for allowing the FreeSCI VM extension as a ".
-                    "course project in his Advanced OS course.");
+										"for allowing the FreeSCI VM extension as a ".
+										"course project in his Advanced OS course.");
 			add_paragraph("Special thanks to Bob Heitman and Corey Cole for their support of FreeSCI.");
 		end_section();
 
@@ -1443,79 +1507,79 @@ begin_credits("Credits");
 			add_person("Anton Yartsev", "Zidane", "For the original re-implementation of the Z-Vision engine");
 		end_persons();
 
-	add_paragraph(
-    "Tony Warriner and everyone at Revolution Software Ltd. for sharing ".
-    "with us the source of some of their brilliant games, allowing us to ".
-    "release Beneath a Steel Sky as freeware... and generally being ".
-    "supportive above and beyond the call of duty.");
-
-	add_paragraph(
-    "John Passfield and Steve Stamatiadis for sharing the source of their ".
-    "classic title, Flight of the Amazon Queen and also being incredibly ".
-    "supportive.");
-
-	add_paragraph(
-    "Joe Pearce from The Wyrmkeep Entertainment Co. for sharing the source ".
-    "of their famous title Inherit the Earth, for sharing the source of The Labyrinth of Time ".
-    "and for always replying promptly to our questions.");
-
-	add_paragraph(
-    "Aric Wilmunder, Ron Gilbert, David Fox, Vince Lee, and all those at ".
-    "LucasFilm/LucasArts who made SCUMM the insane mess to reimplement ".
-    "that it is today. Feel free to drop us a line and tell us what you ".
-    "think, guys!");
-
-	add_paragraph(
-    "Alan Bridgman, Simon Woodroffe and everyone at Adventure Soft for ".
-    "sharing the source code of some of their games with us.");
-
-	add_paragraph(
-    "John Young, Colin Smythe and especially Terry Pratchett himself for ".
-    "sharing the source code of Discworld I & II with us.");
-
-	add_paragraph(
-    "Emilio de Paz Aragón from Alcachofa Soft for sharing the source code ".
-    "of Drascula: The Vampire Strikes Back with us and his generosity with ".
-    "freewaring the game.");
-
-	add_paragraph(
-    "David P. Gray from Gray Design Associates for sharing the source code ".
-    "of the Hugo trilogy.");
-
-	add_paragraph(
-    "Broken Sword 2.5 team for providing sources of their engine and their great ".
-    "support.");
-
-	add_paragraph(
-    "Neil Dodwell and David Dew from Creative Reality for providing the source ".
-    "of Dreamweb and for their tremendous support.");
-
-	add_paragraph(
-    "Janusz Wiśniewski and Miroslaw Liminowicz from Laboratorium Komputerowe Avalon ".
-    "for providing full source code for Sołtys and Sfinx and letting us redistribute the games.");
-
-	add_paragraph(
-    "Jan Nedoma for providing the sources to the Wintermute-engine, and for his ".
-    "support while porting the engine to ScummVM.");
-
-	add_paragraph(
-    "Bob Bell, Michel Kripalani, Tommy Yune, from Presto Studios for ".
-    "providing the source code of The Journeyman Project: Pegasus Prime.");
-
-	add_paragraph(
-    "Electronic Arts IP Preservation Team, particularly Stefan Serbicki, and Vasyl Tsvirkunov of ".
-    "Electronic Arts for providing the source code of the two Lost Files of Sherlock Holmes games. ".
-    "James M. Ferguson and Barry Duncan for their tenacious efforts to recover the sources.");
-
-	add_paragraph(
-    "The mindFactory team for writing Broken Sword 2.5, a splendid fan-made sequel, and for sharing ".
-    "the source code with us.");
-
-    add_paragraph(
-    "John Romero for sharing the source code of Hyperspace Delivery Boy! with us.");
-
-    add_paragraph(
-    "Steffen Dingel for sharing the source code of the Mission Supernova game with us.");
+		add_paragraph(
+			"Tony Warriner and everyone at Revolution Software Ltd. for sharing ".
+			"with us the source of some of their brilliant games, allowing us to ".
+			"release Beneath a Steel Sky as freeware... and generally being ".
+			"supportive above and beyond the call of duty.");
+
+		add_paragraph(
+			"John Passfield and Steve Stamatiadis for sharing the source of their ".
+			"classic title, Flight of the Amazon Queen and also being incredibly ".
+			"supportive.");
+
+		add_paragraph(
+			"Joe Pearce from The Wyrmkeep Entertainment Co. for sharing the source ".
+			"of their famous title Inherit the Earth, for sharing the source of The Labyrinth of Time ".
+			"and for always replying promptly to our questions.");
+
+		add_paragraph(
+			"Aric Wilmunder, Ron Gilbert, David Fox, Vince Lee, and all those at ".
+			"LucasFilm/LucasArts who made SCUMM the insane mess to reimplement ".
+			"that it is today. Feel free to drop us a line and tell us what you ".
+			"think, guys!");
+
+		add_paragraph(
+			"Alan Bridgman, Simon Woodroffe and everyone at Adventure Soft for ".
+			"sharing the source code of some of their games with us.");
+
+		add_paragraph(
+			"John Young, Colin Smythe and especially Terry Pratchett himself for ".
+			"sharing the source code of Discworld I & II with us.");
+
+		add_paragraph(
+			"Emilio de Paz Aragón from Alcachofa Soft for sharing the source code ".
+			"of Drascula: The Vampire Strikes Back with us and his generosity with ".
+			"freewaring the game.");
+
+		add_paragraph(
+			"David P. Gray from Gray Design Associates for sharing the source code ".
+			"of the Hugo trilogy.");
+
+		add_paragraph(
+			"Broken Sword 2.5 team for providing sources of their engine and their great ".
+			"support.");
+
+		add_paragraph(
+			"Neil Dodwell and David Dew from Creative Reality for providing the source ".
+			"of Dreamweb and for their tremendous support.");
+
+		add_paragraph(
+			"Janusz Wiśniewski and Miroslaw Liminowicz from Laboratorium Komputerowe Avalon ".
+			"for providing full source code for Sołtys and Sfinx and letting us redistribute the games.");
+
+		add_paragraph(
+			"Jan Nedoma for providing the sources to the Wintermute-engine, and for his ".
+			"support while porting the engine to ScummVM.");
+
+		add_paragraph(
+			"Bob Bell, Michel Kripalani, Tommy Yune, from Presto Studios for ".
+			"providing the source code of The Journeyman Project: Pegasus Prime.");
+
+		add_paragraph(
+			"Electronic Arts IP Preservation Team, particularly Stefan Serbicki, and Vasyl Tsvirkunov of ".
+			"Electronic Arts for providing the source code of the two Lost Files of Sherlock Holmes games. ".
+			"James M. Ferguson and Barry Duncan for their tenacious efforts to recover the sources.");
+
+		add_paragraph(
+			"The mindFactory team for writing Broken Sword 2.5, a splendid fan-made sequel, and for sharing ".
+			"the source code with us.");
+
+		add_paragraph(
+		"John Romero for sharing the source code of Hyperspace Delivery Boy! with us.");
+
+		add_paragraph(
+		"Steffen Dingel for sharing the source code of the Mission Supernova game with us.");
 
 	end_section();
 





More information about the Scummvm-git-logs mailing list