aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscripts/parse-help-patches.pl198
1 files changed, 125 insertions, 73 deletions
diff --git a/scripts/parse-help-patches.pl b/scripts/parse-help-patches.pl
index b3ad33bb..4d4d577e 100755
--- a/scripts/parse-help-patches.pl
+++ b/scripts/parse-help-patches.pl
@@ -16,41 +16,99 @@ my $printText = "";
my %classnames = ();
my %xyhash = ();
-my $library = "";
-my $name = "";
+my $libraryName = "";
+my $objectclassName = "";
my $fileName = "";
-#------------------------------------------------------------------------------#
-# THE OUTPUT FORMAT
-#------------------------------------------------------------------------------#
-format OBJECTCLASS =
-
-
-==Inlets==
-
-
-
-==Outlets==
-
-
-
-==Arguments==
+my $pageName = "";
+my $abbreviationName = "";
+my $descriptionName = "";
+my $categoryName = "";
+my $datatypeName = "";
+#------------------------------------------------------------------------------#
+# TRANSLATION VARIABLES
+#------------------------------------------------------------------------------#
-==Messages==
+# wikipedia terms
+my $stub = "";
+my $template = "";
+my $category = "";
+my $infobox = "";
+my $topLevel = ""; #
+# pdpedia terms
+my $objectclass = "";
+# page headers
+my $inlets = "";
+my $outlets = "";
+my $arguments = "";
+my $messages = "";
-{{objectclass-stub}}
+# infobox
+my $name = "";
+my $description = "";
+my $abbreviation = "";
+my $library = "";
+my $author = "";
+my $developer = "";
+my $releaseVersion = "";
+my $releaseDate = "";
+my $dependencies = "";
+my $license = "";
+my $website = "";
+my $programmingLanguage = "";
+my $platform = "";
+my $operatingSystem = "";
+my $language = "";
+my $dataType = "";
+my $distributions = "";
+my $status = "";
-[[Category:objectclass]]
-.
+#------------------------------------------------------------------------------#
+# Portuguese
+
+# wikipedia terms
+$stub = "Esboço";
+$template = "Template";
+$category = "Categoria";
+$infobox = "Infobox";
+
+# pdpedia terms
+$objectclass = "Classe do objecto";
+
+# page headers
+$inlets = "Entradas";
+$outlets = "Saídas";
+$arguments = "Argumentos";
+$messages = "Mensagens";
+
+# infobox
+$name = "Nome";
+$description = "Descrição";
+$abbreviation = "Abreviatura";
+$library = "Biblioteca";
+$author = "Autor";
+$developer = "Programador";
+$releaseVersion = "Versão actual";
+$releaseDate = "Data de lançamento";
+$dependencies = "Dependências";
+$license = "Licença";
+$website = "Website";
+$programmingLanguage = "Linguagem de programação";
+$platform = "Plataforma";
+$operatingSystem = "Sistema operativo";
+$language = "Linguagem";
+$dataType = "Tipo de dado";
+$distributions = "Distribuições";
+$status = "Estado";
#------------------------------------------------------------------------------#
# PARSE CSV
#------------------------------------------------------------------------------#
-my $csvfile = '/Users/hans/Desktop/wiki_files_hacked/objectlist.csv';
+my $csvfile = '/Users/hans/Desktop/TODO/wiki_files_hacked/objectlist.csv';
my $csv = Text::CSV_PP->new();
my %csvhash = ();
@@ -72,18 +130,14 @@ close CSV;
# PARSE HELP FILES
#------------------------------------------------------------------------------#
-foreach (`/sw/bin/find /Users/hans/Desktop/wiki_files_hacked/5.reference/ -type f -name '*.pd'`) {
+foreach (`/sw/bin/find /Users/hans/Desktop/TODO/wiki_files_hacked/5.reference/ -type f -name '*.pd'`) {
chop;
$fileName = "";
- if (m|.*/5\.reference/([a-zA-Z0-9_-]+)/(.+)-help\.pd|) {
+ if( (m|.*/5\.reference/([a-zA-Z0-9_-]+)/(.+)-help\.pd|) || (m|.*/5\.reference/([a-zA-Z0-9_-]+)/(.+)\.pd|) ) {
# print("$1 , $2\t");
- $library = lc($1);
- $name = $2;
- $fileName = $_;
- } elsif (m|.*/5\.reference/([a-zA-Z0-9_-]+)/(.+)\.pd|) {
-# print("$1 , $2 (no -help)\t");
- $library = lc($1);
- $name = $2;
+ if( $1 eq 'zflatspace' ) { $libraryName = "flatspace";}
+ else {$libraryName = lc($1); }
+ $objectclassName = $2;
$fileName = $_;
}
@@ -104,7 +158,6 @@ foreach (`/sw/bin/find /Users/hans/Desktop/wiki_files_hacked/5.reference/ -type
@lines = split(';\n', $_);
-
foreach (@lines) {
if (m|^#X text ([0-9]+) ([0-9]+) (.*)|) {
$xyhash{ $2 }{ $1 } = $3;
@@ -112,7 +165,6 @@ foreach (`/sw/bin/find /Users/hans/Desktop/wiki_files_hacked/5.reference/ -type
}
$lineCount++;
}
-
for ($column = -300; $column < 1501; $column += 300) {
foreach my $yKey ( sort {$a <=> $b} keys(%xyhash) ) {
foreach my $xKey ( keys(%{$xyhash{$yKey}}) ) {
@@ -125,56 +177,56 @@ foreach (`/sw/bin/find /Users/hans/Desktop/wiki_files_hacked/5.reference/ -type
$lastColumn = $column;
}
- my $abbreviation = "";
- my $description = "";
- my $category = "";
- my $datatype = "";
- my $myColumns = $csvhash{$library}{$name};
+ my $myColumns = $csvhash{$libraryName}{$objectclassName};
my @myColumns;
if($myColumns) { @myColumns = split(',', $myColumns); }
-# print("csvhash{$library}{$name}: $csvhash{$library}{$name}\n");
- if($myColumns[0]) {
- if($myColumns[2]) { $abbreviation = $myColumns[2] }
- if($myColumns[3]) { $description = $myColumns[3] }
- if($myColumns[4]) { $category = $myColumns[4] }
- if($myColumns[5]) { $datatype = $myColumns[5] }
-# print("MYCOLUMNS: $myColumns[0] $myColumns[1] $myColumns[2] $myColumns[3] $myColumns[4] $myColumns[5]\n");
+ if($myColumns[2]) { $abbreviationName = $myColumns[2]; } if( $classnames{$objectclassName} ) {
+ $pageName = "${objectclassName}_(${libraryName})";
+ } else {
+ $pageName = "${objectclassName}";
}
+
- mkdir($library);
- if( $classnames{$name} ) {
- open(OBJECTCLASS, ">$library/${name}_(${library}).txt");
+ mkdir($libraryName);
+ if( $classnames{$objectclassName} ) {
+ $pageName = "${objectclassName}_(${libraryName})";
} else {
- open(OBJECTCLASS, ">$library/${name}.txt");
+ $pageName = "${objectclassName}";
}
- print(OBJECTCLASS "{{Infobox Objectclass\n");
- print(OBJECTCLASS "| name = $name\n");
- if($abbreviation) {
- print(OBJECTCLASS "| abbreviation = $abbreviation\n");}
- if($description) {
- print(OBJECTCLASS "| description = $description\n");}
- if($datatype) {
- print(OBJECTCLASS "| data type = $datatype\n");}
- print(OBJECTCLASS "| library = [[$library]]\n");
- print(OBJECTCLASS "| author = {{$library author}}\n");
- print(OBJECTCLASS "| license = {{$library license}}\n");
- print(OBJECTCLASS "| status = {{$library status}}\n");
- print(OBJECTCLASS "| website = {{$library website}}\n");
- print(OBJECTCLASS "| release date = {{$library release date}}\n");
- print(OBJECTCLASS "| distributions = {{$library distributions}}\n");
- print(OBJECTCLASS "| language = English\n");
- print(OBJECTCLASS "| platform = [[GNU/Linux]], [[Mac OS X]], [[Windows]]\n");
+ open(OBJECTCLASS, ">$libraryName/${pageName}.txt");
+ print(OBJECTCLASS "{{Infobox $objectclass\n");
+ print(OBJECTCLASS "| $name = $objectclassName\n");
+ if($abbreviationName) {
+ print(OBJECTCLASS "| $abbreviation = $abbreviationName\n");}
+ print(OBJECTCLASS "| $description = \n");
+ print(OBJECTCLASS "| $dataType = \n");
+ print(OBJECTCLASS "| $library = [[$libraryName]]\n");
+ print(OBJECTCLASS "| $author = {{$libraryName " . lc(${author}) . "}}\n");
+ print(OBJECTCLASS "| $license = {{$libraryName " . lc(${license}) . "}}\n");
+ print(OBJECTCLASS "| $status = {{$libraryName " . lc(${status}) . "}}\n");
+ print(OBJECTCLASS "| $website = {{$libraryName " . lc(${website}) . "}}\n");
+ print(OBJECTCLASS "| $releaseVersion = {{$libraryName " . lc(${releaseVersion}) . "}}\n");
+ print(OBJECTCLASS "| $releaseDate = {{$libraryName " . lc(${releaseDate}) . "}}\n");
+ print(OBJECTCLASS "| $distributions = {{$libraryName " . lc(${distributions}) . "}}\n");
+ print(OBJECTCLASS "| $platform = [[GNU/Linux]], [[Mac OS X]], [[Windows]]\n");
print(OBJECTCLASS "}}\n\n");
- print(OBJECTCLASS "\n$printText\n");
- write(OBJECTCLASS);
- print(OBJECTCLASS "[[Category:$library]]\n");
- if($category) {
- print(OBJECTCLASS "[[Category:$category]]\n");
- }
+# print(OBJECTCLASS "\n$printText\n\n\n");
+ print(OBJECTCLASS "==$inlets==\n\n\n");
+ print(OBJECTCLASS "==$outlets==\n\n\n");
+ print(OBJECTCLASS "==$arguments==\n\n\n");
+ print(OBJECTCLASS "==$messages==\n\n\n");
+ print(OBJECTCLASS "{{${objectclass}-${stub}}} \n\n");
+ print(OBJECTCLASS "[[$category:$objectclass]]\n");
+ print(OBJECTCLASS "[[$category:$libraryName]]\n");
+# if($category) {
+# print(OBJECTCLASS "[[$category:$categoryName]]\n");
+# }
+ print(OBJECTCLASS "\n\n");
+ print(OBJECTCLASS "[[en:$pageName]]\n");
print(OBJECTCLASS "\n\n");
close(OBJECTCLASS);
- $classnames{$name} = 1;
+ $classnames{$objectclassName} = 1;
}
}