rfc2html – php script to view rfc with index and links.

If you have to keep viewing RFC’s and you miss index and links in RFC while viewing rfc, then you should check-out rfc2html. It is scrtip that takes plain text rfc and converts it to html.

You can get the original code from sourceforge.

However, I found some small issues with the script and have sent a mail to the authour about the same. In the meantime, you can use the diff below to fix the issue’s or download this diff file rfc2html.diff and apply the diff:

--- rfc2html.php	2014-06-27 18:42:14.027210656 +0530
+++ new/rfc2html.php	2014-07-06 12:06:23.212308365 +0530
@@ -19,7 +19,7 @@
  */
 
 /** 
- * @version $Id: rfc2html.php,v 1.9 2006/02/08 21:44:42 chmate Exp $
+ * @version $Id: rfc2html.php 15 2006-02-22 08:52:04Z chmate $
  * @author Chang Hsiou-Ming <chmate@gmail.com>
  */
 
@@ -35,8 +35,8 @@
 define("PAGE_COLUMNS", 72);
 define("BUF_SIZE", 8192);
 define("CENTRAL_ERROR", 4);
-define("REF_PATTERN", '/\[RFC(\d+)\]/');
-define("REF_REPLACE", '<a class="ref" href="rfc2html.php?in=\1">\0</a>');
+define("REF_PATTERN", '/\[(\w*\d+)\]/');
+define("REF_REPLACE", '<a class="ref" href="#REF\1">\0</a>');
 define("REFED_REPLACE", '<a name="REF\1">\0</a>');
 define("SEC_NUMBER", '/^(\d+(\.(\d|\w)+)*)(\s|\.)/');
 define("SEC_PATTERN", '/((section|sec)\s*(\d+(\.\d+)*))/i');
@@ -235,7 +235,6 @@
 		echo "</div><!-- page -->\n";
 	}
 
-	//echo '<pre>'; var_dump($rfc_toc); echo '</pre>';	
 	$toc = build_toc($toc);
 
 	echo "</div><!-- pages -->\n";
@@ -639,12 +638,11 @@
 
 
 #sidebar {
-	position: fixed;
-	top: 5px;
-	left: 1px; 
+	position: absolute;
+	top: 50px;
+	left: 10px;
 	width: 280px;
 	margin: 0;
-    font-size:10px;
 }
 
 #navbar {
@@ -727,10 +725,8 @@
 }
 
 div.toolbar {
-    position: fixed;
 	background: #e0e0e0;
-    width: 100%;
-	margin: 10;
+	margin: 0;
 	padding: 10px 2em 10px 1em;
 	border: 2px dashed #bbbbbb;
 }
@@ -812,7 +808,6 @@
 	<?php @include 'rfc2html_head.php'; ?>	
 </div>
 
-<!--
 <div class="toolbar">
 	<form method="get" action="rfc2html.php">
 		<div>
@@ -821,7 +816,7 @@
 			<input type="submit" value="Go!" />
 		</div>
 	</form>
-</div> -->
+</div>
 
 <?php
 	if($text) {

About Amit Agarwal