Index: Doc/buildChm.tcl ================================================================== --- Doc/buildChm.tcl +++ Doc/buildChm.tcl @@ -43,10 +43,75 @@ return [string trim [lindex [split $result " "] 0]] } return "" } +# +# NOTE: This procedure unescapes certain HTML tags that are used within the +# documentation for the virtual table methods. +# +proc unescapeHtmlTags { fileName cdata } { + # + # NOTE: Read all the textual data from the file. + # + set data [readFile $fileName] + + # + # NOTE: No replacements made yet. + # + set count 0 + + # + # NOTE: If requested by the caller, unwrap all content contained with XML + # CDATA sections as well. + # + if {$cdata} then { + # + # NOTE: Grab everything within the CDATA tags and use verbatim. + # + set cdataCount [regsub -all -- {} $data {\1} data] + + if {$cdataCount > 0} then { + incr count $cdataCount + } else { + # puts stdout "*WARNING* File \"$fileName\" has no CDATA" + } + } + + # + # TODO: Handle all the HTML tags we know may be present in the virtual + # table method documentation. This may need adjustments in the + # future. + # + foreach to [list \ + {} {} {
} {
} {
} {
} {
} {
} \ + {
} {
  • } {
  • } {
      } {
    } {} {} \ + {}] { + # + # NOTE: Figure out the escaped form of this tag and then replace it + # with the unescaped form. + # + set from [string map [list < <\; > >\;] $to] + incr count [regsub -all -- $from $data $to data] + } + + # + # NOTE: Issue a warning if the "href" pattern was not matched. + # + if {$count == 0} then { + puts stdout "*WARNING* File \"$fileName\" has no supported HTML tags" + } + + # + # NOTE: If some replacements were performed on the data from the file, + # then overwrite it with the new data. + # + if {$count > 0} then { + writeFile $fileName $data + } +} + # # HACK: This procedure checks all the "href" attribute values in the specified # core documentation file. For each value, this procedure checks if the # reference conforms to one of the following general categories: # @@ -137,17 +202,22 @@ # incr count [regsub -all -- $pattern $data $subSpec data] } # - # NOTE: If some replacements were performed on the data from the file, then - # overwrite it with the new data; otherwise, issue a warning. + # NOTE: Issue a warning if the "href" pattern was not matched. + # + if {$count == 0} then { + puts stdout "*WARNING* File \"$fileName\" does not match: href=\"(.*?)\"" + } + + # + # NOTE: If some replacements were performed on the data from the file, + # then overwrite it with the new data. # if {$count > 0} then { writeFile $fileName $data - } else { - puts stdout "*WARNING* File \"$fileName\" does not match: href=\"(.*?)\"" } } # # HACK: Copy our local [fixed] copy of the MSDN documenter assembly into the @@ -294,10 +364,24 @@ exit 1 } transformCoreDocumentationFile $fileName https://www.sqlite.org/ } + +############################################################################### + +foreach fileName [glob -nocomplain [file join $temporaryPath \ + System.Data.SQLite~System.Data.SQLite.ISQLiteNativeModule*.html]] { + set fileName [file join $path $fileName] + + if {![file isfile $fileName]} then { + puts stdout "Cannot find temporary provider file: $fileName" + exit 1 + } + + unescapeHtmlTags $fileName false +} ############################################################################### set patterns(.hhc,1) {