[Geany-devel] Would be nice to have line numbers for the HTML export plugin

theUser BL theuserbl at xxxxx
Fri Jun 8 01:12:27 UTC 2012


I think it would be nice to have line numbers for the HTML export plugin.

I am not so familiar with C++, so I post it only as suggestion.

But the in Java written RText (http://www.fifesoft.com/rtext/) have with its function a very similar output.
Here the important Java file:
http://svn.fifesoft.com/viewvc-1.0.5/bin/cgi/viewvc.cgi/RText/trunk/src/org/fife/rtext/actions/SaveAsWebPageAction.java?view=markup&revision=185&root=RText

And for that I have posted an modified version of that file at
http://fifesoft.com/forum/viewtopic.php?f=5&t=670
so that line numbers are nicely shown. Possibly it can help you a little bit.
It is only a cutted down version of GoogleCode.


If it does not help you, here the HTML-outputs:


A little Java source file:
----------------------------------------------------------------------------
class Hello {
  public static void main(String[] args) {
    System.out.println("Hello World!\n");
  }
}
----------------------------------------------------------------------------


The HTML-code your plugin creates:
----------------------------------------------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
    <title>/home/patrick/geanyGitHub/Hello.java</title>
    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
    <meta name="generator" content="Geany 1.22" />
    <meta name="date" content="2012-06-08T03:01:55+0200" />
    <style type="text/css">
    body
    {
        font-family: Monospace, monospace;
        font-size: 10pt;
    }
    .style_0
    {
        color: #000000;
        background-color: #ffffff;
    }
    .style_5
    {
        color: #00007f;
        background-color: #ffffff;
        font-weight: bold;
    }
    .style_6
    {
        color: #ff8000;
        background-color: #ffffff;
    }
    .style_10
    {
        color: #301010;
        background-color: #ffffff;
    }
    .style_11
    {
        color: #000000;
        background-color: #ffffff;
    }
    .style_16
    {
        color: #991111;
        background-color: #ffffff;
        font-weight: bold;
    }
    .style_19
    {
        color: #0000d0;
        background-color: #ffffff;
        font-weight: bold;
    }

    </style>
</head>

<body>
<p>
<span class="style_5">class </span><span class="style_19">Hello </span><span class="style_10">{</span><br />
  <span class="style_5">public static </span><span class="style_16">void </span><span class="style_11">main</span><span class="style_10">(</span><span class="style_11">String</span><span class="style_10">[] </span><span class="style_11">args</span><span class="style_10">) {</span><br />
    <span class="style_11">System</span><span class="style_10">.</span><span class="style_11">out</span><span class="style_10">.</span><span class="style_11">println</span><span class="style_10">(</span><span class="style_6">"Hello World!\n"</span><span class="style_10">);</span><br />
  <span class="style_10">}</span><br />
<span class="style_10">}</span><br />

</p>
</body>
</html>
----------------------------------------------------------------------------


The output RText creates:
----------------------------------------------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- Generated by RText -->
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>/home/patrick/geanyGitHub/Hello.html</title>
<style type="text/css">
.s4 {
font-weight: bold;
color: #0000ff;
}
.s5 {
color: #ad8000;
}
.s10 {
color: #dc009c;
}
.s15 {
color: #000000;
}
.s16 {
color: #808080;
}
.s17 {
color: #ff0000;
}
</style>
</head>
<body>
<pre>
<span class="s4">class</span><span class="s16"> </span><span class="s15">Hello</span><span class="s16"> </span><span class="s17">{</span>
<span class="s16">  </span><span class="s4">public</span><span class="s16"> </span><span class="s4">static</span><span class="s16"> </span><span class="s4">void</span><span class="s16"> </span><span class="s15">main</span><span class="s17">(</span><span class="s5">String</span><span class="s17">[</span><span class="s17">]</span><span class="s16"> </span><span class="s15">args</span><span class="s17">)</span><span class="s16"> </span><span class="s17">{</span>
<span class="s16">    </span><span class="s5">System</span><span class="s15">.</span><span class="s15">out</span><span class="s15">.</span><span class="s15">println</span><span class="s17">(</span><span class="s10">"Hello World!\n"</span><span class="s17">)</span><span class="s15">;</span>
<span class="s16">  </span><span class="s17">}</span>
<span class="s17">}</span>


</pre>
</body>
</html>
----------------------------------------------------------------------------


And here, what my RText modifications create:
----------------------------------------------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- Generated by RText -->
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[Hello.java]</title>
<style type="text/css">
.s6 {
font-weight: bold;
color: #0000ff;
}
.s8 {
color: #ad8000;
}
.s13 {
color: #dc009c;
}
.s20 {
color: #000000;
}
.s21 {
color: #808080;
}
.s22 {
color: #ff0000;
}


 body{background:#fff;font:82% arial,sans-serif;margin:3px 0 3px 0;min-width:768px}
.headbg{margin:0 8px}


/* Style sheet for source browsing pages. */

/* File */
.fc pre, .fc td,
.fc table {border-collapse:collapse; margin:0; padding:0}
#nums, #lines, #nums th, #lines th, #nums td, #lines td { vertical-align:top }
pre {
  font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace;
  font-size: 93%;
}
#nums {padding-right:.5em; width:3.7em}
#nums td {text-align:right}
#nums a {color:#808080; text-decoration:none} /* line numbers */

#lines td {padding-left:4px;}

/* Applies only to sb files and issue attachments */
.fc #nums, .fc #lines {
  padding-top: 0.5em;
}
.fc #lines {
  border-left: 1px solid #dddddd;  /* vertial line */
}

/* IE Whitespace Fix */
.prettyprint td.source {
  white-space: pre-wrap;
  white-space: -moz-pre-wrap;
  white-space: -pre-wrap;
  white-space: -o-pre-wrap;
}
</style>
</head>
<body>
<div class="headbg">
<div class="expand">
<div class="fc">
<table><tr><td id="nums"><pre><table width="100%"><tr><td id="1"><a href="#1">1</a></td></tr>
<tr><td id="2"><a href="#2">2</a></td></tr>
<tr><td id="3"><a href="#3">3</a></td></tr>
<tr><td id="4"><a href="#4">4</a></td></tr>
<tr><td id="5"><a href="#5">5</a></td></tr>
<tr><td id="6"><a href="#6">6</a></td></tr>
</table></pre></td><td id="lines"><pre><table><tr><td><span class="s6">class</span><span class="s21"> </span><span class="s20">Hello</span><span class="s21"> </span><span class="s22">{</span><br></td></tr>
<tr><td><span class="s21">  </span><span class="s6">public</span><span class="s21"> </span><span class="s6">static</span><span class="s21"> </span><span class="s6">void</span><span class="s21"> </span><span class="s20">main</span><span class="s22">(</span><span class="s8">String</span><span class="s22">[</span><span class="s22">]</span><span class="s21"> </span><span class="s20">args</span><span class="s22">)</span><span class="s21"> </span><span class="s22">{</span><br></td></tr>
<tr><td><span class="s21">    </span><span class="s8">System</span><span class="s20">.</span><span class="s20">out</span><span class="s20">.</span><span class="s20">println</span><span class="s22">(</span><span class="s13">"Hello World!\n"</span><span class="s22">)</span><span class="s20">;</span><br></td></tr>
<tr><td><span class="s21">  </span><span class="s22">}</span><br></td></tr>
<tr><td><span class="s22">}</span><br></td></tr>
<tr><td><br></td></tr>
</table></pre></td></tr></table>
</div></div></div>

</body>
</html>
----------------------------------------------------------------------------


Hopefully you adding in the future support for line-numbers of your HTML-exports. Would be nice.

Greatings
theuserbl

  		 	   		  


More information about the Devel mailing list