System.Data.SQLite
Check-in [d8c22e8ff7]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:More doc tooling updates.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: d8c22e8ff72729a137782c9e20546176f23ed661
User & Date: mistachkin 2016-09-12 21:01:27
Context
2016-09-12
21:07
Enhance backward compatibility of the 'vtab.tcl' doc tool. check-in: 59cb4c92a5 user: mistachkin tags: trunk
21:01
More doc tooling updates. check-in: d8c22e8ff7 user: mistachkin tags: trunk
19:44
Add tooling to sync up the SQLite core library docs from upstream. check-in: 23a3ba47a0 user: mistachkin tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Doc/sync.eagle.

   203    203           "Downloading \"" $uri "\" to \"" $fileName "\"... "]
   204    204     }
   205    205   
   206    206     file delete $fileName
   207    207     uri download $uri $fileName
   208    208   
   209    209     if {$verbose} then {
   210         -    puts stdout OK
          210  +    puts stdout <Ok>
   211    211     }
   212    212   }

Changes to Doc/vtab.tcl.

    25     25   
    26     26   proc escapeSubSpec { data } {
    27     27     regsub -all -- {&} $data {\\\&} data
    28     28     regsub -all -- {\\(\d+)} $data {\\\\\1} data
    29     29     return $data
    30     30   }
    31     31   
    32         -proc removeSectionId { value } {
    33         -  regsub -- { id="section(?:_\d+)+"} $value "" value
           32  +proc preProcessLine { value } {
           33  +  regsub -- { id="[a-z_]+"} $value "" value
           34  +  regsub -- {</p><h(\d)>} $value </p>\n<h\\1> value
           35  +  regsub -- {</p><blockquote><pre>} $value <blockquote><pre> value
    34     36     return $value
    35     37   }
    36     38   
    37     39   proc englishToList { value } {
    38     40     set result [list]
    39     41   
    40     42     foreach element [split $value "\t\n ,"] {
................................................................................
    44     46     }
    45     47   
    46     48     return $result
    47     49   }
    48     50   
    49     51   proc processLine { line prefix } {
    50     52     if {[string length [string trim $line]] == 0 || \
    51         -      [regexp -- {<h\d(?: |>)} [string range $line 0 3]]} then {
           53  +      [regexp -- {<h\d(?: |>)} [string range $line 0 3]] || \
           54  +      [regexp -- {</p>\n<h\d(?: |>)} [string range $line 0 8]]} then {
    52     55       return ""
    53     56     }
    54     57   
    55     58     set result $line
    56     59   
    57     60     foreach remove [list \
    58     61         {<a name=".*?">} {<a href=".*?">} {</a>} {<p>} {</p>}] {
................................................................................
    69     72         {<ul>} {</ul>}] {
    70     73       regsub -all -- ($escape) $result {<![CDATA[\1]]>} result
    71     74     }
    72     75   
    73     76     regsub -all -- {&ne;} $result {\&#8800;} result
    74     77     regsub -all -- {&#91(?:;)?} $result {[} result
    75     78     regsub -all -- {&#93(?:;)?} $result {]} result
    76         -  regsub -all -- {<( |\"|\d|=)} $result {\&lt;\1} result
    77         -  regsub -all -- {( |\"|\d|=)>} $result {\1\&gt;} result
           79  +  # regsub -all -- {<( |\"|\d|=)} $result {\&lt;\1} result
           80  +  # regsub -all -- {( |\"|\d|=)>} $result {\1\&gt;} result
    78     81     regsub -all -- {<blockquote><pre>} $result <para><code> result
    79     82     regsub -all -- {</pre></blockquote>} $result </code></para> result
    80     83     regsub -all -- {<blockquote>} $result <para><code> result
    81     84     regsub -all -- {</blockquote>} $result </code></para> result
    82     85   
    83     86     return $result
    84     87   }
................................................................................
    87     90     upvar 1 $indexVarName index
    88     91     upvar 1 $methodsVarName methods
    89     92   
    90     93     array set levels {p 0}
    91     94     set length [llength $lines]
    92     95   
    93     96     while {$index < $length} {
    94         -    set line [removeSectionId [lindex $lines $index]]
           97  +    set line [preProcessLine [lindex $lines $index]]
    95     98   
    96     99       if {[regexp -- $pattern $line]} then {
    97    100         break; # stop on this line for outer loop.
    98    101       } else {
    99    102         set trimLine [string trim $line]; set data ""
   100    103   
   101    104         if {$levels(p) > 0 && [string length $trimLine] == 0} then {
................................................................................
   105    108             append data \n $prefix </para>
   106    109           } else {
   107    110             # first line, no leading line separator.
   108    111             append data $prefix </para>
   109    112           }
   110    113   
   111    114           incr levels(p) -1
   112         -      } elseif {[string range $trimLine 0 2] eq "<p>"} then {
          115  +      } elseif {[string range $trimLine 0 2] eq "<p>" || \
          116  +          [string range $trimLine 0 6] eq "</p><p>"} then {
   113    117           # open tag ... maybe one line?
   114    118           if {[string range $trimLine end-3 end] eq "</p>"} then {
   115    119             set newLine [processLine $line $prefix]
   116    120   
   117    121             if {[string length $newLine] > 0} then {
   118    122               # one line tag, wrap.
   119    123               if {[info exists methods($name)]} then {
................................................................................
   192    196   
   193    197   set inputData [string map [list \
   194    198       {<font size="6" color="red">*** DRAFT ***</font>} ""] $inputData]
   195    199   
   196    200   set inputData [string map [list {<p align="center"></p>} ""] $inputData]
   197    201   
   198    202   set lines [split [string map [list \r\n \n] $inputData] \n]
          203  +set patterns(start) {^</p>\n<h1><span>2\. </span>Virtual Table Methods</h1>$}
   199    204   
   200         -set patterns(method) {^<h2>2\.\d+\. The (.*) Method(?:s)?</h2>$}
          205  +set patterns(method) [string trim {
          206  +  ^(?:</p>\n)?<h2><span>2\.\d+\. </span>The (.*) Method(?:s)?</h2>$
          207  +}]
          208  +
   201    209   set prefix "        /// "
   202    210   unset -nocomplain methods; set start false
   203    211   
   204    212   for {set index 0} {$index < [llength $lines]} {} {
   205         -  set line [removeSectionId [lindex $lines $index]]
          213  +  set line [preProcessLine [lindex $lines $index]]
   206    214   
   207    215     if {$start} then {
   208    216       if {[regexp -- $patterns(method) $line dummy capture]} then {
   209    217         foreach method [englishToList $capture] {
   210    218           set methodIndex [expr {$index + 1}]
   211    219   
   212    220           extractMethod \
................................................................................
   213    221               $method $lines $patterns(method) $prefix methodIndex methods
   214    222         }
   215    223   
   216    224         set index $methodIndex
   217    225       } else {
   218    226         incr index
   219    227       }
   220         -  } elseif {[regexp -- {^<h1>2\. Virtual Table Methods</h1>$} $line]} then {
          228  +  } elseif {[regexp -- $patterns(start) $line]} then {
   221    229       set start true; incr index
   222    230     } else {
   223    231       incr index
   224    232     }
   225    233   }
   226    234   
   227    235   set outputData [string map [list \r\n \n] [readFile $outputFileName]]
................................................................................
   256    264       set summaryStart [lindex $indexes 0]
   257    265       set summaryEnd [lindex $indexes 1]
   258    266   
   259    267       set outputData [string range \
   260    268           $outputData 0 $summaryStart]$methods($name)[string \
   261    269           range $outputData [expr {$summaryEnd + 1}] end]
   262    270   
   263         -    incr count; set start [expr {$summaryEnd + 1}]
          271  +    incr count; incr start [expr {[string length $methods($name)] + 1}]
   264    272     } else {
   265    273       error "cannot find virtual table method \"$name\" in \"$outputFileName\""
   266    274     }
   267    275   }
   268    276   
   269    277   if {$count > 0} then {
   270    278     writeFile $outputFileName [string map [list \n \r\n] $outputData]
   271    279   }
   272    280   
   273    281   exit 0