Method: Softcover::BookManifest#remove_frontmatter

Defined in:
lib/softcover/book_manifest.rb

#remove_frontmatter(base_contents, frontmatter) ⇒ Object

Removes frontmatter. The frontmatter shouldn’t be included in the chapter slugs, so we remove it. For example, in

\frontmatter
\maketitle
\tableofcontents
% List frontmatter sections here (preface, foreword, etc.).
\include{chapters/preface}
\mainmatter
% List chapters here in the order they should appear in the book.
\include{chapters/a_chapter}

we don’t want to include the preface.



241
242
243
244
# File 'lib/softcover/book_manifest.rb', line 241

def remove_frontmatter(base_contents, frontmatter)
  base_contents.gsub!(/\\frontmatter(.*)\\mainmatter/m, '')
  $1
end