You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
72 lines
2.4 KiB
72 lines
2.4 KiB
|
|
# -*- tcl -* |
|
# Maintenance Instruction: leave the 999999.xxx.x as is and use 'pmix make' or src/make.tcl to update from <pkg>-buildversion.txt |
|
# |
|
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem. |
|
# Code using preferred Tcl licenses can be eligible for inclusion in Tcllib, Tklib and the punk package repository. |
|
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++ |
|
# (C) 2023 |
|
# |
|
# @@ Meta Begin |
|
# Application punk::docgen 999999.0a1.0 |
|
# Meta platform tcl |
|
# Meta license BSD |
|
# @@ Meta End |
|
|
|
|
|
|
|
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++ |
|
## Requirements |
|
##e.g package require frobz |
|
|
|
package require punk::repo |
|
|
|
|
|
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++ |
|
namespace eval punk::docgen { |
|
proc get_doctools_comments {fname} { |
|
#does no validation of doctools commands |
|
#existence of string match #\**!doctools is taken as evidence enough that the file has inline doctools - review |
|
if {![file exists $fname]} { |
|
error "get_doctools_comments file '$fname' not found" |
|
} |
|
set fd [open $fname r] |
|
chan conf $fd -translation binary |
|
set data [read $fd] |
|
close $fd |
|
if {![string match "*#\**!doctools*" $data]} { |
|
return |
|
} |
|
set data [string map [list \r\n \n] $data] |
|
set in_doctools 0 |
|
set doctools "" |
|
foreach ln [split $data \n] { |
|
set ln [string trim $ln] |
|
if {$in_doctools && [string index $ln 0] != "#"} { |
|
set in_doctools 0 |
|
} elseif {[string range $ln 0 1] == "#*"} { |
|
#todo - process doctools ordering hints in tail of line |
|
set in_doctools 1 |
|
} elseif {$in_doctools} { |
|
append doctools [string range $ln 1 end] \n |
|
} |
|
} |
|
return $doctools |
|
} |
|
#todo - proc autogen_doctools_comments {fname} {} |
|
# - will probably need to use something like parsetcl - as we won't be able to reliably source in an interp without side-effects and use info body etc. |
|
# - mechanism will be to autodocument namespaces, procs, methods where no #*** doctools indication present - but use existing doctools comments for that particular item if it is present. |
|
|
|
|
|
|
|
} |
|
|
|
|
|
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++ |
|
## Ready |
|
package provide punk::docgen [namespace eval punk::docgen { |
|
variable pkg punk::docgen |
|
variable version |
|
set version 999999.0a1.0 |
|
}] |
|
return |