TAB-tolerant newlispdoc

For the Compleat Fan
Locked
Rexy-Craxy
Posts: 5
Joined: Sat Sep 24, 2011 9:20 am

TAB-tolerant newlispdoc

Post by Rexy-Craxy »

Hi all.

This patch makes newlispdoc working right when TABs are used in comment lines containing @keywords.

Also it replaces a partial derivative sign ("∂", "&part;" in HTML) at the bottom of produced pages with a solid pointing-up triangle ("▲", "&#9650;" in HTML) surrounded by '<a href="">' and '</a>', so following the link just reloads the same page from its top. (I made it because a single "∂" looks like small Russian "d" typed in italics, what always perflexed me :) ).

The version of newlispdoc to patch is one distributed with current stable (10.5.0) release of newLISP.

Code: Select all

116c116
< <br/><br/><center>- &part; -</center><br/>
---
> <br/><br/><center>- <a href="" title="Go to page top">&#9650;</a> -</center><br/>
454c454
<     (when (find ";; *@index ([^ ]*?) ([^ ]*?)\\s*\n" page 0)
---
>     (when (find ";;[ \t]*@index[ \t]+([^ \t]*?)[ \t]+([^ \t]*?)\\s*\n" page 0)
457c457
<         (when (find ";; *@description (.*?)\n" page 0)
---
>         (when (find ";;[ \t]*@description[ \t]+(.*?)\n" page 0)
462c462
<     (if (find ";; *@module " page 0)
---
>     (if (find ";;[ \t]*@module[ \t]" page 0)
464,465c464,465
<             (replace {;;(.*) @link ([^ ]*?) ([^ ]*?)\s} page (string $1 { <a href="} $2 {">} $3 {</a> }) 0)
<             (replace ";; @example *\n(.*?)\n\\s*\n" page (format-example $1) 4)
---
>             (replace {;;(.*)[ \t]@link[ \t]+([^ \t]*?)[ \t]+([^ \t]*?)\s} page (string $1 { <a href="} $2 {">} $3 {</a> }) 0)
>             (replace ";; @example[ \t]*\n(.*?)\n\\s*\n" page (format-example $1) 4)
468,469c468,469
<             (replace ";; *@description (.*?)\n" page (begin (set 'desc $1) (string "<p>" desc "</p>\n") ) 0)
<             (replace ";; *@module (.*?)\n" page (format-module $1 desc outfile)  0)
---
>             (replace ";;[ \t]*@description[ \t](.*?)\n" page (begin (set 'desc $1) (string "<p>" desc "</p>\n") ) 0)
>             (replace ";;[ \t]*@module[ \t](.*?)\n" page (format-module $1 desc outfile)  0)
471,473c471,473
<             (replace ";; *@author (.*?)\n" page (string "<b>Author: </b>" $1 "<br/>\n")  0)
<             (replace ";; *@version (.*?)\n" page (string "<b>Version: </b>" $1 "<br/>\n")  0)
<             (replace ";; *@location (.*?)\n" page 
---
>             (replace ";;[ \t]*@author[ \t](.*?)\n" page (string "<b>Author: </b>" $1 "<br/>\n")  0)
>             (replace ";;[ \t]*@version[ \t](.*?)\n" page (string "<b>Version: </b>" $1 "<br/>\n")  0)
>             (replace ";;[ \t]*@location[ \t](.*?)\n" page 
475,477c475,477
<             (replace ";; *@syntax (.*?)\n" page (format-syntax $1 outfile) 0)
<             (replace ";; *@param (.*?) (.*?)\n" page (format-parameter $1 $2) 0)
<             (replace ";; *@return (.*?)\n" page (format-return $1)  0)
---
>             (replace ";;[ \t]*@syntax[ \t](.*?)\n" page (format-syntax $1 outfile) 0)
>             (replace ";;[ \t]*@param[ \t](.*?)[ \t](.*?)\n" page (format-parameter $1 $2) 0)
>             (replace ";;[ \t]*@return[ \t](.*?)\n" page (format-return $1)  0)
479c479
<             (replace ";; *@([a-zA-Z_-]*?) (.*?)\n" page (string "<b>" (title-case $1) ": </b>" $2 "<br/>\n") 0)
---
>             (replace ";;[ \t]*@([a-zA-Z_-]*?)[ \t](.*?)\n" page (string "<b>" (title-case $1) ": </b>" $2 "<br/>\n") 0)

Locked