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
Jérome Perrin
gitlab-ce
Commits
cdec9e47
Commit
cdec9e47
authored
May 23, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace \n to <br>
parent
46de0366
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
3 deletions
+16
-3
app/assets/javascripts/ci/build.coffee
app/assets/javascripts/ci/build.coffee
+4
-2
lib/ci/ansi2html.rb
lib/ci/ansi2html.rb
+3
-1
spec/lib/ci/ansi2html_spec.rb
spec/lib/ci/ansi2html_spec.rb
+9
-0
No files found.
app/assets/javascripts/ci/build.coffee
View file @
cdec9e47
...
...
@@ -33,8 +33,10 @@ class CiBuild
url
:
build_url
+
"/trace.json?state="
+
encodeURIComponent
(
@
state
)
dataType
:
"json"
success
:
(
log
)
=>
if
last_state
is
@
state
and
log
.
status
is
"running"
@
state
=
if
log
.
state
then
log
.
state
else
""
return
unless
last_state
is
@
state
if
log
.
state
and
log
.
status
is
"running"
@
state
=
log
.
state
if
log
.
append
$
(
'.fa-refresh'
).
before
log
.
html
else
...
...
lib/ci/ansi2html.rb
View file @
cdec9e47
...
...
@@ -90,7 +90,7 @@ module Ci
def
convert
(
raw
,
new_state
)
reset_state
restore_state
(
raw
,
new_state
)
if
new_state
restore_state
(
raw
,
new_state
)
if
new_state
.
present?
start
=
@offset
ansi
=
raw
[
@offset
..-
1
]
...
...
@@ -105,6 +105,8 @@ module Ci
break
elsif
s
.
scan
(
/</
)
@out
<<
'<'
elsif
s
.
scan
(
/\n/
)
@out
<<
'<br>'
else
@out
<<
s
.
scan
(
/./m
)
end
...
...
spec/lib/ci/ansi2html_spec.rb
View file @
cdec9e47
...
...
@@ -175,5 +175,14 @@ describe Ci::Ansi2html, lib: true do
it_behaves_like
'stateable converter'
end
context
'with new line'
do
let
(
:pre_text
)
{
"Hello
\r
"
}
let
(
:pre_html
)
{
"Hello
\r
"
}
let
(
:text
)
{
"
\n
World"
}
let
(
:html
)
{
"<br>World"
}
it_behaves_like
'stateable converter'
end
end
end
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