プロジェクト

全般

プロフィール

Vote #66055

未完了

<code> block improvements

Admin Redmine さんが約2年前に追加. 約2年前に更新.

ステータス:
New
優先度:
通常
担当者:
-
カテゴリ:
Text formatting_26
対象バージョン:
-
開始日:
2009/11/23
期日:
進捗率:

0%

予定工数:
category_id:
26
version_id:
0
issue_org_id:
4267
author_id:
7393
assigned_to_id:
0
comments:
6
status_id:
1
tracker_id:
2
plus1:
2
affected_version:
closed_on:
affected_version_id:
ステータス-->[New]

説明

I think it would be useful to implement the following features[1] for @code@ block

Source code:



# The Greeter class
class Greeter
  def initialize(name)
    @name = name.capitalize
  end

  def salute
    puts "Hello #{@name}!" 
  end
end

Result:


# The Greeter class
class Greeter
  def initialize(name)
    @name = name.capitalize
  end

  def salute
    puts "Hello #{@name}!" 
  end
end

h3. :line_numbers[2]


.....
.....

!Redmine_code_lineNumbers_no.png!

h3. :line_number_start[2]


.....

!Redmine_code_start_50.png!

h3. :bold_every[2]


.....

!Redmine_every_2.png!

h3. :highlight_lines[2]


.....

!Redmine_highlight_1_3_5_7.png!

h3. title


.....

!Redmine_title.png!


fn1. This standard features in CodeRay, but unfortunately not supported in Redmine :(

fn2. CodeRay HTML Encoder options


journals

+10 from me on this one. I actually still had to file this issue myself... Thanks for doing it for me :)

These options really would make syntax-highlighting more useable IMHO.
--------------------------------------------------------------------------------
It seems to me that @:line_number_start@ and @highlight_lines@ are most useful. We should focus on them, to keep the highlighter plugin API simple, and ensure that other highlighters can adapt.
--------------------------------------------------------------------------------
For me, the inability to cut and paste code without the line numbers is a deal-breaker. Furthermore, without representing file line numbers, I don't see how they add value. While the CODE blocks are prettier, the plain PRE blocks are better for exchanging code snippets, simply due to the line numbers.

In terms of usefulness and ease of implementation, the CodeRay features I'd like to see supported are:

# Suppress the line numbers
<pre>
:line_numbers => nil
</pre>
# Use the table method:
<pre>
:line_numbers => :table
</pre>
# Use actual file line numbers:
<pre>
:line_number_start
</pre>

I did experiment with changing the line numbering method in @lib/redmine/syntax_highlighting.rb@.

@nil@ works fine and does suppress the line numbers. @:table@ will require some changes to the style declarations to get working properly, but would fix the clipboard issues. The samples on the CodeRay site that cut and paste well seem to be using the @:table@ method.

--------------------------------------------------------------------------------
William Baum wrote:
> For me, the inability to cut and paste code without the line numbers is a deal-breaker. Furthermore, without representing file line numbers, I don't see how they add value. While the CODE blocks are prettier, the plain PRE blocks are better for exchanging code snippets, simply due to the line numbers.
>
> In terms of usefulness and ease of implementation, the CodeRay features I'd like to see supported are:
>
> # Suppress the line numbers
> [...]
> # Use the table method:
> [...]
> # Use actual file line numbers:
> [...]
>
> I did experiment with changing the line numbering method in @lib/redmine/syntax_highlighting.rb@.
>
> @nil@ works fine and does suppress the line numbers. @:table@ will require some changes to the style declarations to get working properly, but would fix the clipboard issues. The samples on the CodeRay site that cut and paste well seem to be using the @:table@ method.

William, if you get a chance please see my patch at #3382. Thanks.
--------------------------------------------------------------------------------
+1

I like William Baum's suggestion in note#3 a lot! Would this be put into some planned version?

William Baum wrote:
> For me, the inability to cut and paste code without the line numbers is a deal-breaker.

Strongly agree!
--------------------------------------------------------------------------------
Generally +1

> For me, the inability to cut and paste code without the line numbers is a deal-breaker.

+10 on this

--------------------------------------------------------------------------------


related_issues

relates,Closed,3382,Ability to select only source code without line numbers

Admin Redmine さんが約2年前に更新

  • カテゴリText formatting_26 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0