Skip to content

Instantly share code, notes, and snippets.

@jackjennings
Last active August 29, 2015 13:56
Show Gist options
  • Save jackjennings/9216090 to your computer and use it in GitHub Desktop.
Save jackjennings/9216090 to your computer and use it in GitHub Desktop.
text = %Q(%%BEGIN_GROUP_TEXT_7
%BEGIN_TEASER
The research on reversibly expandable structures focused ...
%END_TEASER
%BEGIN_EXPANDED
... to understand how to realize structures that can vary in shape and size, was translated into several US patents registered under the name of Charles Hoberman. These patents include precise drawings detailing the overall spatial formations as well as the form and dimension of individual joints and trusses. The exhibited patent 5,024,031 presents a summary of Hoberman’s approach, including spheres and iris domes.
%END_EXPANDED
%%END_GROUP_TEXT
%%BEGIN_GROUP_TEXT_7
%BEGIN_TEASER
The research on reversibly expandable structures focused ...
%END_TEASER
%BEGIN_EXPANDED
... to understand how to realize structures that can vary in shape and size, was translated into several US patents registered under the name of Charles Hoberman. These patents include precise drawings detailing the overall spatial formations as well as the form and dimension of individual joints and trusses. The exhibited patent 5,024,031 presents a summary of Hoberman’s approach, including spheres and iris domes.
%END_EXPANDED
%%END_GROUP_TEXT)
regexp = /%%BEGIN_GROUP_TEXT_(\d*).*?%BEGIN_TEASER(.*?)%END_TEASER.*?%BEGIN_EXPANDED(.*?)%END_EXPANDED.*?%%END_GROUP_TEXT/m
text.gsub!(regexp,
'<div class="div-\1">
<div class="teaser">\2</div>
<div class="expanded">\3</div>
</div>')
puts text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment