Advertisement
rmloveland

Untitled

Feb 18th, 2017
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.66 KB | None | 0 0
  1. for my $e ($dom->find('structured-macro[name="include"]')->each) {
  2.   my $include = $e->find('page[ri:content-title$=.]')->[0];
  3.   DEBUG("include contents: < $include >");
  4.  
  5.   my ($title, $space_key);
  6.  
  7.   $include =~ /content-title="(?<title>[_a-zA-Z0-9\,\:\- ]+)"/;
  8.   $title = $+{title};
  9.  
  10.   $include =~ /ri:space-key="(?<space_key>[a-zA-Z]+)"?/;
  11.   $space_key = $+{space_key};
  12.   $space_key //= 'sp';
  13.  
  14.   DEBUG("include extracted fields: < space: $space_key title: $title >");
  15.  
  16.   my $cmd = qq[get-page-source --called '$title' --from 'AppNexus:$space_key'];
  17.   my $included_content = `$cmd`;
  18.   $included_content =~ s/^Source\n//;
  19.   $e->replace($included_content);
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement