lib/polytexnic/preprocessors/latex.rb
# Processes aside environments.
# In order to get nice framed & shaded aside boxes, we need to
# transform the default aside into a new environment.
Processes aside environments.
In order to get nice framed & shaded aside boxes, we need to
transform the default aside into a new environment.
Processes aside environments . In order to get nice framed & shaded aside boxes we need to transform the default aside into a new environment .
def process_asides(text)
        aside_regex = /\\begin{aside}\n\s*
                       \\label{(.*?)}\s*
                       \\heading{(.*?)}\n
                       (.*?)
                       \\end{aside}/mx
        text.tap do
          text.gsub!(aside_regex) do
            %(\\begin{shaded_aside}{#{$2}}{#{$1}}\n#{$3}\n\\end{shaded_aside})
          end
        end
      end
def process_asides ( text ) aside_regex = / \\ begin{aside} \n \s *
                        \\ label{(.*?)} \s *
                        \\ heading{(.*?)} \n 
                       (.*?)
                        \\ end{aside} /mx text . tap do text . gsub! ( aside_regex ) do %(\\begin{shaded_aside}{#{$2}}{#{$1}}\n#{$3}\n\\end{shaded_aside}) end end end
Processes aside environments.
Processes aside environments .
# Transform asides with labels and headings.
text