Skip to content

Commit

Permalink
Merge branch 'master' of github.com:imazen/repositext
Browse files Browse the repository at this point in the history
  • Loading branch information
jhund committed Jul 23, 2016
2 parents d8f2734 + dc7dca9 commit f912748
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
5 changes: 5 additions & 0 deletions lib/kramdown/converter/latex_repositext.rb
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@ def convert_p(el, opts)
before << "\\begin{RtSong}\n"
after << "\n\\end{RtSong}"
end
if el.has_class?('song_break')
# render in RtSong environment
before << "\\begin{RtSongBreak}\n"
after << "\n\\end{RtSongBreak}"
end
if el.has_class?('stanza')
# render in RtStanza environment
before << "\\begin{RtStanza}\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,12 @@ def extract_paragraph_styles(doc)
doc.strip.split(/\n/).map { |line|
line =~ PARAGRAPH_STYLE_REGEX ? line : ''
}.inject([]) { |m,e|
# Remove .omit classes. They are expected to be different between
# Remove .omit and .indent_for_eagle classes. They are expected to be different between
# primary and foreign languages.
r = e.gsub(/\s*\.omit\s*/, ' ')
r = e.gsub(/\s*\.indent_for_eagle\s*/, ' ')
r.gsub!(/\s*\.omit\s*/, ' ')
# Normalize .song_break to .song because we expect them to be differnt between English and foreign
r.gsub!(/\s*\.song_break\s*/, ' .song ')
# Remove everything but paragraph class names
r = r.scan(/\.\w+/)
m << r.join(' ')
Expand Down
16 changes: 15 additions & 1 deletion templates/latex_for_pdf.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
\mag=<%= @magnification %> % geometery package magnification
\mag=<%= @magnification %> % geometry package magnification
\documentclass[<%= @font_size %>pt, twoside, openright]{book}

% NOTE: in latex, bp is equivalent to PS points in other programs. A latex
Expand Down Expand Up @@ -299,6 +299,20 @@
\par
}

% environment to render song paragraphs.
\newenvironment{RtSongBreak}
{
\par
\leftskip=60.225pt
\rightskip=30.112pt
\setlength{\parindent}{-8pt}
\pagebreak
\setlength{\parskip}{0pt plus 0pt minus 0pt}
}
{
\par
}

% environment to render split pairs in pdf_recording_merged
\newenvironment{RtSplitPair}
{
Expand Down

0 comments on commit f912748

Please sign in to comment.