lib/RichTextElement.rb in taskjuggler-0.0.5 vs lib/RichTextElement.rb in taskjuggler-0.0.6

- old
+ new

@@ -96,10 +96,12 @@ number = "#{@data[0]} " when :title2 number = "#{@data[0]}.#{@data[1]} " when :title3 number = "#{@data[0]}.#{@data[1]}.#{@data[2]} " + when :title4 + number = "#{@data[0]}.#{@data[1]}.#{@data[2]}.#{@data[3]} " end if number # We've found a section heading. The String value of the Element is the # title. title = children_to_s @@ -151,10 +153,14 @@ @richText.lineWidth) + "\n" when :title3 return textBlockFormat(@richText.indent + @richText.titleIndent, sTitle(3), children_to_s, @richText.lineWidth) + "\n" + when :title4 + return textBlockFormat(@richText.indent + @richText.titleIndent, + sTitle(4), children_to_s, + @richText.lineWidth) + "\n" when :hline return "#{' ' * @richText.indent}" + "#{'-' * (@richText.lineWidth - @richText.indent)}\n" when :paragraph return textBlockFormat(@richText.indent + @richText.parIndent, @@ -176,10 +182,15 @@ when :bulletlist3 when :bulletitem3 return textBlockFormat(@richText.indent + @richText.listIndent * 3, '* ', children_to_s, @richText.lineWidth) + "\n" + when :bulletlist4 + when :bulletitem4 + return textBlockFormat(@richText.indent + @richText.listIndent * 4, + '* ', children_to_s, + @richText.lineWidth) + "\n" when :numberlist1 when :numberitem1 return textBlockFormat(@richText.indent + @richText.listIndent, "#{@data[0]}. ", children_to_s, @richText.lineWidth) + "\n" @@ -191,10 +202,16 @@ when :numberlist3 when :numberitem3 return textBlockFormat(@richText.indent + @richText.listIndent, "#{@data[0]}.#{@data[1]}.#{@data[2]} ", children_to_s, @richText.lineWidth) + "\n" + when :numberlist4 + when :numberitem4 + return textBlockFormat(@richText.indent + @richText.listIndent, + "#{@data[0]}.#{@data[1]}.#{@data[2]}." + + "#{@data[3]} ", + children_to_s, @richText.lineWidth) + "\n" when :img pre = @data.altText if @data.altText when :ref when :href when :blockfunc @@ -230,10 +247,13 @@ pre = "<h2>#{@data[0]}.#{@data[1]} " post = "</h2>\n\n" when :title3 pre = "<h3>#{@data[0]}.#{@data[1]}.#{@data[2]} " post = "</h3>\n\n" + when :title4 + pre = "<h4>#{@data[0]}.#{@data[1]}.#{@data[2]}.#{@data[3]} " + post = "</h4>\n\n" when :hline pre = '<hr>' post = "</hr>\n" when :paragraph pre = '<p>' @@ -257,10 +277,16 @@ pre = '<ul>' post = '</ul>' when :bulletitem3 pre = '<li> * ' post = "</li>\n" + when :bulletlist4 + pre = '<ul>' + post = '</ul>' + when :bulletitem4 + pre = '<li> * ' + post = "</li>\n" when :numberlist1 pre = '<ol>' post = '</ol>' when :numberitem1 pre = "<li>#{@data[0]} " @@ -275,10 +301,16 @@ pre = '<ol>' post = '</ol>' when :numberitem3 pre = "<li>#{@data[0]}.#{@data[1]}.#{@data[2]} " post = "</li>\n" + when :numberlist4 + pre = '<ol>' + post = '</ol>' + when :numberitem4 + pre = "<li>#{@data[0]}.#{@data[1]}.#{@data[2]}.#{@data[3]} " + post = "</li>\n" when :img pre = "<img file=\"#{@data.fileName}\"/>" when :ref pre = "<ref data=\"#{@data}\">" post = '</ref>' @@ -344,10 +376,12 @@ htmlTitle(1) when :title2 htmlTitle(2) when :title3 htmlTitle(3) + when :title4 + htmlTitle(4) when :hline noChilds = true XMLElement.new('hr', attrs, true) when :paragraph XMLElement.new('p', attrs) @@ -368,10 +402,14 @@ XMLElement.new('li') when :bulletlist3 XMLElement.new('ul') when :bulletitem3 XMLElement.new('li') + when :bulletlist4 + XMLElement.new('ul') + when :bulletitem4 + XMLElement.new('li') when :numberlist1 XMLElement.new('ol') when :numberitem1 XMLElement.new('li') when :numberlist2 @@ -379,9 +417,13 @@ when :numberitem2 XMLElement.new('li') when :numberlist3 XMLElement.new('ol') when :numberitem3 + XMLElement.new('li') + when :numberlist4 + XMLElement.new('ol') + when :numberitem4 XMLElement.new('li') when :img el = XMLElement.new('img', 'src' => @data.fileName) el['alt'] = @data.altText if @data.altText if @data.verticalAlign