code4Py | Style Context Differences

As per recently created page, the following diff command output representing context differences, needed to be styled;

[vagrant@localhost python]$ diff -c A B
*** A   2014-08-20 20:13:30.315009258 +0000
--- B   2014-08-20 20:13:39.021009349 +0000
***************
*** 1,6 ****
--- 1,9 ----
+ typeset -i sum=0
+
  while read num
  do
    printf "%d " ${num}
+   sum=sum+${num}
  done <<EOF
  1
  2
***************
*** 9,13 ****
  5
  EOF

! echo
!
--- 12,15 ----
  5
  EOF

! echo; echo "Sum: ${sum}"
[vagrant@localhost python]$

Source Code (GitHub Gist)
I have completed writing python script that will generate HTML output as follows.

<tr>
  <td>

  </td>
  <td>
    <span style='color: green'> typeset -i sum=0</span><br />
    <span style='color: green'> </span><br />
     while read num<br />
     do<br />
       printf "%d " ${num}<br />
    <span style='color: green'>   sum=sum+${num}</span><br />
     done <<EOF<br />
     1<br />
     2
  </td>
</tr>
<tr>
  <td>
     5<br />
     EOF<br />
     <br />
    <span style='color: blue'> echo </span><br />
    <span style='color: blue'> </span>
  </td>
  <td>
     5<br />
     EOF<br />
     <br />
    <span style='color: blue'> echo; echo "Sum: ${sum}"</span>
  </td>
</tr>

Style Output
This output tabulates the differences in N-row(s) and 2-column(s) format, if properly embedded into table element of HTML document, which could then be rendered by web browser based on CSS properties (if defined).

Advertisements

One thought on “code4Py | Style Context Differences

  1. Pingback: taT4Py | Recursively Search Regex Patterns | PrayogShala

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s