Last active
August 29, 2015 13:56
-
-
Save slimane/8915316 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$reg_exp = [string]::join("|", $problematic_msgs) | |
$target_extension = "log" | |
$directory = "." | |
$path = $directory + "\*." + $target_extension | |
$out_file = "logcheck_result.html" | |
$head = @' | |
<meta charset="utf-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>tablecloth.js demo</title> | |
<link href="assets/css/bootstrap.css" rel="stylesheet"> | |
<link href="assets/css/bootstrap-responsive.css" rel="stylesheet"> | |
<link href="assets/css/tablecloth.css" rel="stylesheet"> | |
<link href="assets/css/prettify.css" rel="stylesheet"> | |
'@ | |
$body_elements = select-string -path $path -casesensitive -pattern $reg_exp -encoding default | | |
group-object Path | |
$body = @' | |
<div class="container"> | |
<div class="row"> | |
<div class="span12" style="padding:20px 0;"> | |
<table cellspacing="1" cellpadding="3" class="tablehead" style="background:#CCC;"> | |
'@ | |
foreach($elements in $body_elements){ | |
$body += $elements.values[0] | | |
Select-Object @{Name="link";Expression={'<Caption>' + | |
'<H3>PATH: <a href="' + $_ + '">' + $_ + '</a></H3>' + | |
'</Caption>'}} | | |
Select-Object -Expand link | | |
Out-String | |
$td_element = $elements.Group | | |
Select-Object @{Name="out_data";Expression={'<TR CLASS="oddrow">' + | |
'<TD><span class="greenfont">' + | |
$_.linenumber + | |
'</TD><TD>' $_.line + | |
'</span></TD>' + | |
'</TR>'}} | |
-Expand out_data | |
Out-String | |
$body += '<THED><TR>' + | |
'<TH Class="{sorter: false}">line_number</TH>' + | |
'<TH><CONTENTS></TH>' + | |
'</TR></THED>' + | |
$td_element + "</table>" | |
} | |
$body += @' | |
</div> | |
</div> | |
</div> | |
<script src="assets/js/jquery-1.7.2.min.js"></script> | |
<script src="assets/js/bootstrap.js"></script> | |
<script src="assets/js/jquery.metadata.js"></script> | |
<script src="assets/js/jquery.tablesorter.min.js"></script> | |
<script src="assets/js/jquery.tablecloth.js"></script> | |
<script type="text/javascript" charset="utf-8"> | |
$(document).ready(function() { | |
$("table").tablecloth({ | |
theme: "paper", | |
striped: true, | |
sortable: true, | |
condensed: true | |
}); | |
}); | |
</script> | |
'@ | |
Convertto-HTML -head $head -PreContent "<H1>Log</H1>" -PostContent $body | | |
%{$tmp = $_ -replace "<","<"; $tmp2 = $tmp -replace ">",">"; $tmp2 -replace """,'"'} | | |
Out-File -FilePath $Out_File |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://github.com/bwsewell/tablecloth/