Skip to content

Commit

Permalink
Merge pull request #817 from kmuto/column-label
Browse files Browse the repository at this point in the history
Fix referring to other chapter's column
  • Loading branch information
kdmsnr authored Sep 14, 2017
2 parents 6bcc3c3 + 334705d commit eb86b78
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions lib/review/htmlbuilder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -981,15 +981,15 @@ def inline_hd_chap(chap, id)
end
end

def column_label(id)
num = @chapter.column(id).number
def column_label(id, chapter = @chapter)
num = chapter.column(id).number
"column-#{num}"
end
private :column_label

def inline_column_chap(chapter, id)
if @book.config["chapterlink"]
%Q(<a href="\##{column_label(id)}" class="columnref">#{I18n.t("column", compile_inline(chapter.column(id).caption))}</a>)
%Q(<a href="\##{column_label(id, chapter)}" class="columnref">#{I18n.t("column", compile_inline(chapter.column(id).caption))}</a>)
else
I18n.t("column", compile_inline(chapter.column(id).caption))
end
Expand Down
6 changes: 3 additions & 3 deletions lib/review/idgxmlbuilder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -257,15 +257,15 @@ def read(lines)

alias_method :lead, :read

def column_label(id)
num = @chapter.column(id).number
def column_label(id, chapter = @chapter)
num = chapter.column(id).number
"column-#{num}"
end
private :column_label

def inline_column_chap(chapter, id)
if @book.config["chapterlink"]
%Q(<link href="#{column_label(id)}">#{I18n.t("column", compile_inline(chapter.column(id).caption))}</link>)
%Q(<link href="#{column_label(id, chapter)}">#{I18n.t("column", compile_inline(chapter.column(id).caption))}</link>)
else
I18n.t("column", compile_inline(chapter.column(id).caption))
end
Expand Down
8 changes: 4 additions & 4 deletions lib/review/latexbuilder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -475,9 +475,9 @@ def bib_label(id)
end
private :bib_label

def column_label(id)
filename = @chapter.id
num = @chapter.column(id).number
def column_label(id, chapter = @chapter)
filename = chapter.id
num = chapter.column(id).number
"column:#{filename}:#{num}"
end
private :column_label
Expand Down Expand Up @@ -908,7 +908,7 @@ def inline_hd_chap(chap, id)
def inline_column_chap(chapter, id)
macro('reviewcolumnref',
I18n.t("chapter_quote", compile_inline(chapter.column(id).caption)),
column_label(id))
column_label(id, chapter))
end

def inline_raw(str)
Expand Down

0 comments on commit eb86b78

Please sign in to comment.