Skip to content

Commit 2eb796b

Browse files
updated link replacement
1 parent 92822ca commit 2eb796b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

blog post html convert code.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<#
22
3-
$Images = 3..8
4-
$path = '2020/07/'
3+
$Images = 13..15
4+
$path = '2020/02/'
55
66
foreach($image in $Images){
77
$Url = 'https://i1.wp.com/sqldbawithabeard.com/wp-content/uploads/' + $path + 'image-' + $Image + '.png'
@@ -40,7 +40,7 @@ $entrycontent = $oldpost.getElementsByClassName('entry-content')
4040
$content = ($entrycontent | Select innerHTML).innerHTML
4141

4242
# get just the post and not the fluff
43-
$notfluff = ($content -split '(.*)\<DIV class="sharedaddy sd-sharing-enabled"\>')[0] -replace 'https://blog.robsewell.com/tags/#','https://blog.robsewell.com/tags/' -replace '<SPAN class=crayon-title></SPAN>','' -replace '<DIV class=crayon-tools style="FONT-SIZE: 12px !important; HEIGHT: 18px !important; LINE-HEIGHT: 18px !important">','' -replace '<DIV class=crayon-button-icon></DIV></DIV>' ,'' -replace '<DIV title="Toggle Plain Code" class="crayon-button crayon-plain-button">','' -replace '<DIV title="Toggle Line Wrap" class="crayon-button crayon-wrap-button">','' -replace '<DIV title="Expand Code" class="crayon-button crayon-expand-button">','' -replace '<DIV title=Copy class="crayon-button crayon-copy-button">','' -replace '<DIV title="Open Code In New Window" class="crayon-button crayon-popup-button">','' -replace '<DIV class=crayon-button-icon></DIV></DIV><SPAN class=crayon-language>PowerShell</SPAN></DIV></DIV>','' -replace '<DIV class=crayon-info style="MIN-HEIGHT: 16px !important; LINE-HEIGHT: 16px !important"></DIV>','' -replace '<DIV class=crayon-plain-wrap><TEXTAREA class="crayon-plain print-no" style="FONT-SIZE: 12px !important; LINE-HEIGHT: 15px !important; -moz-tab-size: 4; -o-tab-size: 4;' ,'' -replace '-webkit-tab-size: 4; tab-size: 4" readOnly data-settings="dblclick">','' -replace '</TEXTAREA></DIV>','' -replace '<TABLE class=crayon-table>','' -replace '<TR class=crayon-row>','' -replace '<TD class="crayon-nums " data-settings="show">','' -replace '<DIV class=crayon-nums-content style="FONT-SIZE: 12px !important; LINE-HEIGHT: 15px !important">','' -replace '<SPAN class=crayon-language>Transact-SQL</SPAN></DIV></DIV>','' -replace '<DIV class=crayon-main>','' -replace '<TBODY>','' -replace '<DIV title="Toggle Line Numbers" class="crayon-button crayon-nums-button">','' -replace 'https://i1.wp.com/sqldbawithabeard.com/wp-content', 'https://blog.robsewell.com/assets' -replace 'https://i0.wp.com/sqldbawithabeard.com/wp-content', 'https://blog.robsewell.com/assets' -replace 'https://i2.wp.com/sqldbawithabeard.com/wp-content', 'https://blog.robsewell.com/assets' -replace '<SPAN class=crayon-language>PowerShell</SPAN></DIV></DIV>',''
43+
$notfluff = ($content -split '(.*)\<DIV class="sharedaddy sd-sharing-enabled"\>')[0] -replace 'https://blog.robsewell.com/tags/#','https://blog.robsewell.com/tags/' -replace '<SPAN class=crayon-title></SPAN>','' -replace '<DIV class=crayon-tools style="FONT-SIZE: 12px !important; HEIGHT: 18px !important; LINE-HEIGHT: 18px !important">','' -replace '<DIV class=crayon-button-icon></DIV></DIV>' ,'' -replace '<DIV title="Toggle Plain Code" class="crayon-button crayon-plain-button">','' -replace '<DIV title="Toggle Line Wrap" class="crayon-button crayon-wrap-button">','' -replace '<DIV title="Expand Code" class="crayon-button crayon-expand-button">','' -replace '<DIV title=Copy class="crayon-button crayon-copy-button">','' -replace '<DIV title="Open Code In New Window" class="crayon-button crayon-popup-button">','' -replace '<DIV class=crayon-button-icon></DIV></DIV><SPAN class=crayon-language>PowerShell</SPAN></DIV></DIV>','' -replace '<DIV class=crayon-info style="MIN-HEIGHT: 16px !important; LINE-HEIGHT: 16px !important"></DIV>','' -replace '<DIV class=crayon-plain-wrap><TEXTAREA class="crayon-plain print-no" style="FONT-SIZE: 12px !important; LINE-HEIGHT: 15px !important; -moz-tab-size: 4; -o-tab-size: 4;' ,'' -replace '-webkit-tab-size: 4; tab-size: 4" readOnly data-settings="dblclick">','' -replace '</TEXTAREA></DIV>','' -replace '<TABLE class=crayon-table>','' -replace '<TR class=crayon-row>','' -replace '<TD class="crayon-nums " data-settings="show">','' -replace '<DIV class=crayon-nums-content style="FONT-SIZE: 12px !important; LINE-HEIGHT: 15px !important">','' -replace '<SPAN class=crayon-language>Transact-SQL</SPAN></DIV></DIV>','' -replace '<DIV class=crayon-main>','' -replace '<TBODY>','' -replace '<DIV title="Toggle Line Numbers" class="crayon-button crayon-nums-button">','' -replace 'https://i1.wp.com/sqldbawithabeard.com/wp-content', 'https://blog.robsewell.com/assets' -replace 'https://i0.wp.com/sqldbawithabeard.com/wp-content', 'https://blog.robsewell.com/assets' -replace 'https://i2.wp.com/sqldbawithabeard.com/wp-content', 'https://blog.robsewell.com/assets' -replace '<SPAN class=crayon-language>PowerShell</SPAN></DIV></DIV>','' -replace 'https://blog.robsewell.com/\d\d\d\d/\d\d/\d\d', 'https://blog.robsewell.com'
4444

4545
$regex = [regex]::Matches($oldpost.body.innerHTML,'category-(\w{0,50})\s')
4646
$categorynames = (($regex.groups|Select @{name='match';exp={$_.groups[1].value}})| Where match -ne $null).match

0 commit comments

Comments
 (0)