-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3a99da9
commit 38a641c
Showing
3 changed files
with
79 additions
and
68 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,62 @@ | ||
ECHO start parcing... | ||
|
||
::add top part of template | ||
TYPE %parent%template_top_report.html> niceDiff-report.html | ||
|
||
SET parent=%~dp0 | ||
|
||
::CONSTANTS | ||
SET sOpenFile=^</div^>^<button class="section"^> | ||
SET sCloseFile=^</button^>^<div class="section-content"^>^<div^> | ||
SET sOpenCodeBlock=^</div^>^<div^> | ||
SET sOpenCodeLine=^<pre^> | ||
SET sCloseCodeLine=^</pre^> | ||
SET sOpenAddCodeLine=^<pre class="add"^> | ||
SET sOpenRemoveCodeLine=^<pre class="remove"^> | ||
|
||
::init code block | ||
ECHO ^<div^>>> niceDiff-report.html | ||
::init file section | ||
ECHO ^<div^>>> niceDiff-report.html | ||
|
||
SETLOCAL enabledelayedexpansion | ||
FOR /F "usebackq tokens=*" %%A IN ("%parent%/diff.txt") DO ( | ||
SET line1=%%A | ||
SET line2=!line1:^<=^<! | ||
SET line=!line2:^>=^>! | ||
IF "!line:~0,10!"=="diff --git" ( | ||
rem close last code block in previous file | ||
ECHO ^</div^>>> niceDiff-report.html | ||
rem new file | ||
ECHO !sOpenFile! >> niceDiff-report.html | ||
) ELSE IF "!line:~0,5!"=="--- a" ( | ||
rem get file name | ||
ECHO !line:~5!!sCloseFile! >> niceDiff-report.html | ||
) ELSE IF "!line:~0,5!"=="+++ b" ( | ||
rem skip line | ||
) ELSE IF "!line:~0,6!"=="index " ( | ||
rem skip line | ||
) ELSE IF "!line:~0,3!"=="@@ " ( | ||
rem start diff block | ||
ECHO !sOpenCodeBlock!!sOpenCodeLine!!line!!sCloseCodeLine! >> niceDiff-report.html | ||
) ELSE IF "!line:~0,1!"=="-" ( | ||
rem start remove line | ||
ECHO !sOpenRemoveCodeLine!!line:~1!!sCloseCodeLine! >> niceDiff-report.html | ||
) ELSE IF "!line:~0,1!"=="+" ( | ||
rem start add line | ||
ECHO !sOpenAddCodeLine!!line:~1!!sCloseCodeLine! >> niceDiff-report.html | ||
) ELSE ( | ||
rem default add line | ||
ECHO !sOpenCodeLine!!line!!sCloseCodeLine! >> niceDiff-report.html | ||
) | ||
) | ||
::close last code block | ||
ECHO ^</div^>>> niceDiff-report.html | ||
::close file section | ||
ECHO ^</div^>>> niceDiff-report.html | ||
|
||
::add bottom part of template | ||
TYPE %parent%template_bottom_report.html>> niceDiff-report.html | ||
|
||
ECHO complited | ||
|
||
ECHO start parcing... | ||
|
||
SET parent=%~dp0 | ||
|
||
:: CONSTANTS | ||
SET sOpenFile=^</div^>^<button class="section"^> | ||
SET sCloseFile=^</button^>^<div class="section-content"^>^<div^> | ||
SET sOpenCodeBlock=^</div^>^<div^> | ||
SET sOpenCodeLine=^<pre^> | ||
SET sCloseCodeLine=^</pre^> | ||
SET sOpenAddCodeLine=^<pre class="add"^> | ||
SET sOpenRemoveCodeLine=^<pre class="remove"^> | ||
|
||
:: open tag for main cotent | ||
ECHO ^<main^>>>niceDiff-report.html | ||
|
||
:: init code block | ||
ECHO ^<div^>>> niceDiff-report.html | ||
:: init file section | ||
ECHO ^<div^>>> niceDiff-report.html | ||
|
||
SETLOCAL enabledelayedexpansion | ||
FOR /F "usebackq tokens=*" %%A IN ("%parent%/diff.txt") DO ( | ||
SET line1=%%A | ||
SET line2=!line1:^<=^<! | ||
SET line=!line2:^>=^>! | ||
IF "!line:~0,10!"=="diff --git" ( | ||
rem close last code block in previous file | ||
ECHO ^</div^>>> niceDiff-report.html | ||
rem new file | ||
ECHO !sOpenFile! >> niceDiff-report.html | ||
) ELSE IF "!line:~0,5!"=="--- a" ( | ||
rem get file name | ||
ECHO !line:~5!!sCloseFile! >> niceDiff-report.html | ||
) ELSE IF "!line:~0,5!"=="+++ b" ( | ||
rem skip line | ||
) ELSE IF "!line:~0,6!"=="index " ( | ||
rem skip line | ||
) ELSE IF "!line:~0,3!"=="@@ " ( | ||
rem start diff block | ||
ECHO !sOpenCodeBlock!!sOpenCodeLine!!line!!sCloseCodeLine! >> niceDiff-report.html | ||
) ELSE IF "!line:~0,1!"=="-" ( | ||
rem start remove line | ||
ECHO !sOpenRemoveCodeLine!!line:~1!!sCloseCodeLine! >> niceDiff-report.html | ||
) ELSE IF "!line:~0,1!"=="+" ( | ||
rem start add line | ||
ECHO !sOpenAddCodeLine!!line:~1!!sCloseCodeLine! >> niceDiff-report.html | ||
) ELSE ( | ||
rem default add line | ||
ECHO !sOpenCodeLine!!line!!sCloseCodeLine! >> niceDiff-report.html | ||
) | ||
) | ||
:: close last code block | ||
ECHO ^</div^>>> niceDiff-report.html | ||
:: close file section | ||
ECHO ^</div^>>> niceDiff-report.html | ||
|
||
:: add bottom part of template | ||
TYPE %parent%template_bottom_report.html>> niceDiff-report.html | ||
|
||
ECHO complited | ||
|
This file contains 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