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
Boxiang Sun
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
Hide 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
...
@@ -33,8 +33,10 @@ class CiBuild
url
:
build_url
+
"/trace.json?state="
+
encodeURIComponent
(
@
state
)
url
:
build_url
+
"/trace.json?state="
+
encodeURIComponent
(
@
state
)
dataType
:
"json"
dataType
:
"json"
success
:
(
log
)
=>
success
:
(
log
)
=>
if
last_state
is
@
state
and
log
.
status
is
"running"
return
unless
last_state
is
@
state
@
state
=
if
log
.
state
then
log
.
state
else
""
if
log
.
state
and
log
.
status
is
"running"
@
state
=
log
.
state
if
log
.
append
if
log
.
append
$
(
'.fa-refresh'
).
before
log
.
html
$
(
'.fa-refresh'
).
before
log
.
html
else
else
...
...
lib/ci/ansi2html.rb
View file @
cdec9e47
...
@@ -90,7 +90,7 @@ module Ci
...
@@ -90,7 +90,7 @@ module Ci
def
convert
(
raw
,
new_state
)
def
convert
(
raw
,
new_state
)
reset_state
reset_state
restore_state
(
raw
,
new_state
)
if
new_state
restore_state
(
raw
,
new_state
)
if
new_state
.
present?
start
=
@offset
start
=
@offset
ansi
=
raw
[
@offset
..-
1
]
ansi
=
raw
[
@offset
..-
1
]
...
@@ -105,6 +105,8 @@ module Ci
...
@@ -105,6 +105,8 @@ module Ci
break
break
elsif
s
.
scan
(
/</
)
elsif
s
.
scan
(
/</
)
@out
<<
'<'
@out
<<
'<'
elsif
s
.
scan
(
/\n/
)
@out
<<
'<br>'
else
else
@out
<<
s
.
scan
(
/./m
)
@out
<<
s
.
scan
(
/./m
)
end
end
...
...
spec/lib/ci/ansi2html_spec.rb
View file @
cdec9e47
...
@@ -175,5 +175,14 @@ describe Ci::Ansi2html, lib: true do
...
@@ -175,5 +175,14 @@ describe Ci::Ansi2html, lib: true do
it_behaves_like
'stateable converter'
it_behaves_like
'stateable converter'
end
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
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