Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
iv
gitlab-ce
Commits
504a048b
Commit
504a048b
authored
Jun 15, 2016
by
http://jneen.net/
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove the dead linenos and linenostart options
and the methods that relied on them
parent
96274c27
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
44 deletions
+2
-44
lib/rouge/formatters/html_gitlab.rb
lib/rouge/formatters/html_gitlab.rb
+2
-44
No files found.
lib/rouge/formatters/html_gitlab.rb
View file @
504a048b
...
...
@@ -9,14 +9,6 @@ module Rouge
#
# [+cssclass+] CSS class for the wrapping <tt><div></tt> tag
# (default: 'highlight').
# [+linenos+] If set to 'table', output line numbers as a table
# with two cells, one containing the line numbers,
# the other the whole code. This is copy paste friendly,
# but may cause alignment problems with some browsers
# or fonts. If set to 'inline', the line numbers will
# be integrated in the <tt><pre></tt> tag that contains
# the code (default: nil).
# [+linenostart+] The line number for the first line (default: 1).
# [+lineanchors+] If set to true the formatter will wrap each output
# line in an anchor tag with a name of L-linenumber.
# This allows easy linking to certain lines
...
...
@@ -26,53 +18,23 @@ module Rouge
# (default: 'L').
def
initialize
(
cssclass:
'highlight'
,
linenos:
nil
,
linenostart:
1
,
lineanchors:
false
,
lineanchorsid:
'L'
)
@cssclass
=
cssclass
@linenos
=
linenos
@linenostart
=
linenostart
@lineanchors
=
lineanchors
@lineanchorsid
=
lineanchorsid
end
def
render
(
tokens
)
case
@linenos
when
'table'
render_tableized
(
tokens
)
when
'inline'
render_untableized
(
tokens
)
else
render_untableized
(
tokens
)
end
end
alias_method
:format
,
:render
private
def
render_untableized
(
tokens
)
data
=
process_tokens
(
tokens
)
wrap_lines
(
data
[
:code
])
end
def
render_tableized
(
tokens
)
data
=
process_tokens
(
tokens
)
alias_method
:format
,
:render
html
=
''
html
<<
'<table><tbody>'
html
<<
"<td class=
\"
linenos
\"
><pre>"
html
<<
wrap_linenos
(
data
[
:numbers
])
html
<<
'</pre></td>'
html
<<
"<td class=
\"
lines
\"
><pre><code>"
html
<<
wrap_lines
(
data
[
:code
])
html
<<
'</code></pre></td>'
html
<<
'</tbody></table>'
html
end
private
def
process_tokens
(
tokens
)
rendered
=
[]
...
...
@@ -101,10 +63,6 @@ module Rouge
{
numbers:
numbers
,
code:
rendered
}
end
def
wrap_linenos
(
numbers
)
numbers
.
join
(
"
\n
"
)
end
def
wrap_lines
(
lines
)
if
@lineanchors
lines
=
lines
.
each_with_index
.
map
do
|
line
,
index
|
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment