mirror of
https://github.com/claudehohl/Stikked.git
synced 2025-04-26 04:51:08 -05:00
diff formatting
This commit is contained in:
parent
bd1370d6e1
commit
415e51eb5a
@ -17,6 +17,7 @@
|
|||||||
* - cron()
|
* - cron()
|
||||||
* - delete_paste()
|
* - delete_paste()
|
||||||
* - random_paste()
|
* - random_paste()
|
||||||
|
* - _format_diff()
|
||||||
* Classes list:
|
* Classes list:
|
||||||
* - Pastes extends CI_Model
|
* - Pastes extends CI_Model
|
||||||
*/
|
*/
|
||||||
@ -240,7 +241,7 @@ class Pastes extends CI_Model
|
|||||||
$to_text = $data['raw'];
|
$to_text = $data['raw'];
|
||||||
$opcodes = FineDiff::getDiffOpcodes($from_text, $to_text);
|
$opcodes = FineDiff::getDiffOpcodes($from_text, $to_text);
|
||||||
$to_text = FineDiff::renderToTextFromOpcodes($from_text, $opcodes);
|
$to_text = FineDiff::renderToTextFromOpcodes($from_text, $opcodes);
|
||||||
$data['paste'] = nl2br(FineDiff::renderDiffToHTMLFromOpcodes($from_text, $opcodes));
|
$data['paste'] = $this->_format_diff(nl2br(FineDiff::renderDiffToHTMLFromOpcodes($from_text, $opcodes)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -575,4 +576,12 @@ class Pastes extends CI_Model
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
private
|
||||||
|
function _format_diff($text)
|
||||||
|
{
|
||||||
|
$text = explode("\n", $text);
|
||||||
|
$text = '<ol><li>' . implode('</li><li>', $text) . '</li></ol>';
|
||||||
|
$text = '<div class="text" style="font-family:monospace;">' . $text . '</div>';
|
||||||
|
return $text;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -410,6 +410,17 @@ h4 {
|
|||||||
list-style: decimal outside;
|
list-style: decimal outside;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.text_formatted ins {
|
||||||
|
color: green;
|
||||||
|
background: #dfd;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text_formatted del {
|
||||||
|
color: red;
|
||||||
|
background: #fdd;
|
||||||
|
}
|
||||||
|
|
||||||
/* !Messages */
|
/* !Messages */
|
||||||
.message {
|
.message {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user