added code examples
authorDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 17 Jun 2010 17:15:33 +0000 (19:15 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 17 Jun 2010 17:41:00 +0000 (19:41 +0200)
README
public/code/Cited Author.cleanup.pl [new file with mode: 0644]
public/code/Year.add_century.pl [new file with mode: 0644]
public/code/autor.add_autors_count.pl [new file with mode: 0644]

diff --git a/README b/README
index 80f414b..60f9b7a 100644 (file)
--- a/README
+++ b/README
@@ -65,3 +65,7 @@ array of values if you are creating new columns, even for single value.
     $_ = uc $_; # assigment is needed to modify value!
   }
 
+Code examples are stored in public/code
+
+They use Column name.description.pl notatition so only snippets which have applicable
+column will be shown.
diff --git a/public/code/Cited Author.cleanup.pl b/public/code/Cited Author.cleanup.pl
new file mode 100644 (file)
index 0000000..f709afa
--- /dev/null
@@ -0,0 +1,4 @@
+map {
+       s/^\.+//;
+       $_ = uc $_;
+} @{ $rec->{'Cited Author'} };
diff --git a/public/code/Year.add_century.pl b/public/code/Year.add_century.pl
new file mode 100644 (file)
index 0000000..c5b3c06
--- /dev/null
@@ -0,0 +1,3 @@
+foreach my $year ( @{ $row->{Year} } ) {
+       push @{ $row->{century} }, int($year/100)+1;
+}
diff --git a/public/code/autor.add_autors_count.pl b/public/code/autor.add_autors_count.pl
new file mode 100644 (file)
index 0000000..92b624b
--- /dev/null
@@ -0,0 +1 @@
+$row->{autors_count} = [ $#{ $row->{autor} } + 1 ];