[Bps-public-commit] keynote-to-text branch, master, updated. d2b0bedff8a9a476938be280f9b9cc4b7154b9f0

Alex Vandiver alexmv at bestpractical.com
Tue Feb 28 17:27:02 EST 2012


The branch, master has been updated
       via  d2b0bedff8a9a476938be280f9b9cc4b7154b9f0 (commit)
       via  1be42bdd91f76abfe1f60d3f9e04ecf7e23ced66 (commit)
      from  2c94465f6208b44a77115bc7eee1495d7e94aa74 (commit)

Summary of changes:
 keynote-to-text |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)

- Log -----------------------------------------------------------------
commit 1be42bdd91f76abfe1f60d3f9e04ecf7e23ced66
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Feb 28 17:26:46 2012 -0500

    Split out body-printing into a separate sub

diff --git a/keynote-to-text b/keynote-to-text
index 791ac4d..54ff320 100644
--- a/keynote-to-text
+++ b/keynote-to-text
@@ -25,6 +25,13 @@ sub print_slide {
     my $indent = "    " x ($elt->att("key:depth"));
     print $indent . $elt->first_child_text("key:title-placeholder")."\n";
 
+    print_body($elt, $indent);
+
+    $t->purge;
+}
+
+sub print_body {
+    my ($elt, $indent) = @_;
     my $body = $elt->first_child("key:body-placeholder");
     return unless $body;
     my $body_text = $body->first_descendant("sf:text-body");
@@ -37,6 +44,4 @@ sub print_slide {
             print $indent . $subindent . "* ".$e->text."\n";
         }
     }
-
-    $t->purge;
 }

commit d2b0bedff8a9a476938be280f9b9cc4b7154b9f0
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Feb 28 17:27:00 2012 -0500

    Extract speaker notes, as well

diff --git a/keynote-to-text b/keynote-to-text
index 54ff320..ef6929d 100644
--- a/keynote-to-text
+++ b/keynote-to-text
@@ -26,6 +26,7 @@ sub print_slide {
     print $indent . $elt->first_child_text("key:title-placeholder")."\n";
 
     print_body($elt, $indent);
+    print_notes($elt, $indent);
 
     $t->purge;
 }
@@ -45,3 +46,16 @@ sub print_body {
         }
     }
 }
+
+sub print_notes {
+    my ($elt, $indent) = @_;
+
+    my $notes = $elt->first_child("key:notes");
+    return unless $notes;
+    return unless $notes->text =~ /\S/;
+
+    for my $e ($notes->descendants("sf:p")) {
+        next unless $e->text =~ /\S/;
+        print $indent . " [[ ".$e->text." ]]\n";
+    }
+}

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list