Documentation Source Text

Check-in [4d25c80abf]
Login

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

Overview
Comment:Fix the search script so that it can search for individual pragmas. Fix a mismatched tag in the document headers causing the search script to index the menubar on every page.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 4d25c80abff4c7cdc8439f3d271d689224272308
User & Date: dan 2016-09-12 08:34:45
Context
2016-09-12
10:59
Corrections to the statement that defines when the "PRAGMA page_size" macro is not a no-op. check-in: 1d425258b1 user: drh tags: trunk
08:34
Fix the search script so that it can search for individual pragmas. Fix a mismatched tag in the document headers causing the search script to index the menubar on every page. check-in: 4d25c80abf user: dan tags: trunk
2016-09-09
15:38
Initial change log for the 3.14.2 release. check-in: 3324b46ab0 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to document_header.tcl.

15
16
17
18
19
20
21
22
23

24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55

56
57
58
59
60
61
62
    set tagline {<font size="6" color="red">*** DRAFT ***</font>}
  } else {
    set tagline {Small. Fast. Reliable.<br>Choose any three.}
  }

  append ret [subst -nocommands {<body>
    <div class=nosearch>
    <a href="${path}index.html">
    <img class="logo" src="${path}images/sqlite370_banner.gif" alt="SQLite" border="0"></a>

    <div><!-- IE hack to prevent disappearing logo --></div>
    <div class="tagline desktoponly">
      $tagline
    </div>
    </div>
    <div class="menu mainmenu">
    <ul>
    <li><a href="${path}index.html">Home</a>
    <li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>
                           Menu</a>
    <li class='wideonly'><a href='${path}about.html'>About</a>
    <li class='desktoponly'><a href="${path}docs.html">Documentation</a>
    <li class='desktoponly'><a href="${path}download.html">Download</a>
    <li class='wideonly'><a href='${path}copyright.html'>License</a>
    <li class='desktoponly'><a href="${path}support.html">Support</a>
    <li class='desktoponly'><a href="${path}prosupport.html">Purchase</a>
    <li class='search' id='search_menubutton'>
    <a href="javascript:void(0)" onclick='toggle_div("searchmenu")'>Search</a>
    </ul>
    </div>
    <div class="menu submenu" id="submenu">
    <ul>
    <li><a href='${path}docs.html'>Documentation</a>
    <li><a href='${path}support.html'>Support</a>
    <li><a href='${path}prosupport.html'>Purchase</a>
    </ul>
    </div>
    <div class="searchmenu" id="searchmenu">
    <form method="GET" action="search">
    <span class="desktoponly">Search for:</span> <input type="text" name="q">
    <input type="submit" value="Go">
    </form>

    </div>
  }]

  append ret [subst -nocommands {
    <script>
      function toggle_div(nm) {
        var w = document.getElementById(nm);







|
|
>
|
|
|
|
<
|
|
|
|
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>







15
16
17
18
19
20
21
22
23
24
25
26
27
28

29
30
31
32

33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
    set tagline {<font size="6" color="red">*** DRAFT ***</font>}
  } else {
    set tagline {Small. Fast. Reliable.<br>Choose any three.}
  }

  append ret [subst -nocommands {<body>
    <div class=nosearch>
      <a href="${path}index.html">
        <img class="logo" src="${path}images/sqlite370_banner.gif" alt="SQLite" border="0">
      </a>
      <div><!-- IE hack to prevent disappearing logo --></div>
      <div class="tagline desktoponly">
        $tagline
      </div>

      <div class="menu mainmenu">
        <ul>
          <li><a href="${path}index.html">Home</a>
          <li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>

          <li class='wideonly'><a href='${path}about.html'>About</a>
          <li class='desktoponly'><a href="${path}docs.html">Documentation</a>
          <li class='desktoponly'><a href="${path}download.html">Download</a>
          <li class='wideonly'><a href='${path}copyright.html'>License</a>
          <li class='desktoponly'><a href="${path}support.html">Support</a>
          <li class='desktoponly'><a href="${path}prosupport.html">Purchase</a>
          <li class='search' id='search_menubutton'>
            <a href="javascript:void(0)" onclick='toggle_div("searchmenu")'>Search</a>
        </ul>
      </div>
      <div class="menu submenu" id="submenu">
        <ul>
          <li><a href='${path}docs.html'>Documentation</a>
          <li><a href='${path}support.html'>Support</a>
          <li><a href='${path}prosupport.html'>Purchase</a>
        </ul>
      </div>
      <div class="searchmenu" id="searchmenu">
        <form method="GET" action="search">
          <span class="desktoponly">Search for:</span> <input type="text" name="q">
          <input type="submit" value="Go">
        </form>
      </div>
    </div>
  }]

  append ret [subst -nocommands {
    <script>
      function toggle_div(nm) {
        var w = document.getElementById(nm);

Changes to pages/pragma.in.

1569
1570
1571
1572
1573
1574
1575





1576
1577
1578
1579
1580
1581
1582
1583
<li>These pragmas are used for debugging SQLite and
are only available when SQLite is compiled using [SQLITE_DEBUG].
<li>These pragmas are used for testing SQLite and are not recommended
for use in application programs.</ol></p>
<tcl>
foreach prag [lsort [array names PragmaBody]] {
  hd_fragment pragma_$prag





  foreach x $PragmaKeys($prag) {
    hd_keywords *$x "PRAGMA $x" "$x pragma"
  }
  hd_puts "<hr>"
  hd_resolve $PragmaBody($prag)
}
</tcl>
<hr>







>
>
>
>
>








1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
<li>These pragmas are used for debugging SQLite and
are only available when SQLite is compiled using [SQLITE_DEBUG].
<li>These pragmas are used for testing SQLite and are not recommended
for use in application programs.</ol></p>
<tcl>
foreach prag [lsort [array names PragmaBody]] {
  hd_fragment pragma_$prag

  hd_puts "<h _id=pragma_$prag style=\"display:none\"> PRAGMA "
  hd_puts [join $PragmaKeys($prag) ", "]
  hd_puts "</h>"

  foreach x $PragmaKeys($prag) {
    hd_keywords *$x "PRAGMA $x" "$x pragma"
  }
  hd_puts "<hr>"
  hd_resolve $PragmaBody($prag)
}
</tcl>
<hr>

Changes to search/buildsearchdb.tcl.

230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
...
283
284
285
286
287
288
289

290
291
292

293
294


295
296
297
298
299
300
301

302
303
304
305
306



307
308
309


310


311
312
313
314
315
316
317
...
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364

365
366
367
368
369
370
371
    if {[$N tag]==""} {
      if {[eval $filterscript $N]} { append text [$N text] }
    }
  }
  return $text
}

# This is a specialized command for extracting sections from the
# pragma.html document.
#
proc extract_sections_from_pragma_dom {dom} {
  set body [lindex [[$dom root] search body] 0]
  set res [list]

  # Find the section titles.
  foreach T [[$dom root] search table] {
    foreach A [$T search a] {
      if {[string match #pragma_* [$A attr -default "" href]]} {
        set name [$A attr href]
        lappend title($name) [$A text]
      }
    }
  }

  set url     ""
  set hdr     ""
  set content ""

  $body foreach_descendent N {
    set tag  [$N tag]
    if {$tag=="a" && [string match "pragma_*" [$N attr -default "" name]]} {
      lappend res [list $url $hdr $content]

      set name [$N attr name]
      set url "$name"
      set hdr "PRAGMA [join $title(#$name) ,]"
      set content ""
    }

    if {$tag=="" && [generic_filterscript $N]} {
      append content [$N text]
    }
  }
  lappend res [list $url $hdr $content]

  set res
}

proc extract_sections_from_dom {dom filterscript} {
  set body [lindex [[$dom root] search body] 0]

  set h(h) 1
  set h(h1) 1
................................................................................
  set h(h2) 1
  set h(h3) 1

  set res [list]

  $body foreach_descendent N {
    set tag [$N tag]


    if {[info exists h($tag)]} {
      set id [$N attr -default "" id]

      if {$id != ""} {
        if {[info exists H]} {


          lappend res [list [$H attr id] [$H text] $content]
        }
        set H $N
        set content ""
      }
    }


    if {[info exists H] && $tag==""} {
      for {set P [$N parent]} {$P!=""} {set P [$P parent]} {
        if {$P==$H} break
      }
      if {$P==""} { append content [$N text] }



    }
  }



  return $res


}

proc lang_document_import {doc} {
  set dom [::hdom::parse [readfile $doc]]

  # Find the <title> tag and extract the title.
  set title [extract_title $dom $doc]
................................................................................

  # Extract the document text
  set text [extract_text_from_dom $dom generic_filterscript]

  # Insert into the database.
  set rowid [insert_entry -url $doc -title1 $title -content $text]

  if {0 && $doc=="pragma.html"} {
    set lSection [extract_sections_from_pragma_dom $dom]
  } else {
    set lSection [extract_sections_from_dom $dom generic_filterscript]
  }

  set i [expr $rowid*1000]
  foreach section $lSection {
    incr i
    foreach { tag hdr text } $section {}
    if {[string trim $text]==""} continue

    set url "${doc}#${tag}"
    insert_entry -rowid $i -url $url -title1 $title -title2 $hdr -content $text
  }
}

proc rebuild_database {} {








|
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







 







>


<
>


>
>
|






>
|
|
|
|
|
>
>
>



>
>
|
>
>







 







|
<
<
|
<



<


>







230
231
232
233
234
235
236
237
238





































239
240
241
242
243
244
245
...
246
247
248
249
250
251
252
253
254
255

256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
...
321
322
323
324
325
326
327
328


329

330
331
332

333
334
335
336
337
338
339
340
341
342
    if {[$N tag]==""} {
      if {[eval $filterscript $N]} { append text [$N text] }
    }
  }
  return $text
}

proc get_node_id {N {default ""}} {
  $N attr -default [$N attr -default $default _id] id





































}

proc extract_sections_from_dom {dom filterscript} {
  set body [lindex [[$dom root] search body] 0]

  set h(h) 1
  set h(h1) 1
................................................................................
  set h(h2) 1
  set h(h3) 1

  set res [list]

  $body foreach_descendent N {
    set tag [$N tag]
    if {[eval $filterscript $N]==0} continue

    if {[info exists h($tag)]} {

      set id [get_node_id $N]
      if {$id != ""} {
        if {[info exists H]} {
          lappend res [list [get_node_id $H] [$H text] $content]
        } else {
          lappend res [list "" "" $content]
        }
        set H $N
        set content ""
      }
    }

    if {$tag==""} {
      if {[info exists H]} {
        for {set P [$N parent]} {$P!=""} {set P [$P parent]} {
          if {$P==$H} break
        }
        if {$P==""} { append content [$N text] }
      } else {
        append content [$N text]
      }
    }
  }

  if {[info exists H]} {
    lappend res [list [get_node_id $H] [$H text] $content]
    return $res
  }
  return ""
}

proc lang_document_import {doc} {
  set dom [::hdom::parse [readfile $doc]]

  # Find the <title> tag and extract the title.
  set title [extract_title $dom $doc]
................................................................................

  # Extract the document text
  set text [extract_text_from_dom $dom generic_filterscript]

  # Insert into the database.
  set rowid [insert_entry -url $doc -title1 $title -content $text]

  # Find any sections within the document


  set lSection [extract_sections_from_dom $dom generic_filterscript]


  set i [expr $rowid*1000]
  foreach section $lSection {

    foreach { tag hdr text } $section {}
    if {[string trim $text]==""} continue
    incr i
    set url "${doc}#${tag}"
    insert_entry -rowid $i -url $url -title1 $title -title2 $hdr -content $text
  }
}

proc rebuild_database {} {

Changes to wrap.tcl.

539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
    set path $hd(rootpath-aux)
  } else {
    set fd $hd(main)
    set path $hd(rootpath-main)
  }

  puts $fd [document_header $title $path]
  putsin4 $fd {
    <div class=startsearch></div>
  }
  if {$srcfile!=""} {
    if {[file exists DRAFT]} {
      set hd(footer) [hd_trim {
        <p align="center"><font size="6" color="red">*** DRAFT ***</font></p>
      }]
    } else {
      set hd(footer) {}







<
<
<







539
540
541
542
543
544
545



546
547
548
549
550
551
552
    set path $hd(rootpath-aux)
  } else {
    set fd $hd(main)
    set path $hd(rootpath-main)
  }

  puts $fd [document_header $title $path]



  if {$srcfile!=""} {
    if {[file exists DRAFT]} {
      set hd(footer) [hd_trim {
        <p align="center"><font size="6" color="red">*** DRAFT ***</font></p>
      }]
    } else {
      set hd(footer) {}