Documentation Source Text

Check-in [edc0f779f7]
Login

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

Overview
Comment:Fix the multi-column bullet lists in the c3ref documents so that the number of columns varies with the screen width.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | mobile-friendly
Files: files | file ages | folders
SHA1: edc0f779f7e192fa40776353be0f95f9def34b2d
User & Date: drh 2016-08-31 19:13:24.833
Context
2016-08-31
20:03
Use the variable-number-of-columns routine for the keyword list. (check-in: 9e95bb666d user: drh tags: mobile-friendly)
19:13
Fix the multi-column bullet lists in the c3ref documents so that the number of columns varies with the screen width. (check-in: edc0f779f7 user: drh tags: mobile-friendly)
17:00
Further refinement of the home page. (check-in: 9bab722ac3 user: drh tags: mobile-friendly)
Changes
Unified Diff Ignore Whitespace Patch
Changes to pages/capi3ref.in.
216
217
218
219
220
221
222




















223

224
225
226
227






228
229
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
  set oldname [string tolower $oldname]
  regsub {^sqlite_} $oldname {c_} oldname
  regsub {^sqlite3_} $oldname {} oldname
  regsub { } $oldname _ name
  return $name.html
}





















# Output HTML that displays the list $lx in $N columns

#
proc output_list {title N lx} {
  hd_putsnl {<table width="100%" cellpadding="0"><tr>}
  if {$title!=""} {






    hd_putsnl "<td colspan=$N>$title</td></tr><tr>"
  }
  set len [llength $lx]
  set n [expr {($len + $N - 1)/$N}]
  for {set i 0} {$i<$N} {incr i} {






    set start [expr {$i*$n}]
    set end [expr {($i+1)*$n}]
    hd_puts {<td valign="top"><ul>}
    for {set j $start} {$j<$end} {incr j} {

      set entry [lindex $lx $j]
      if {$entry!=""} {
        foreach {link label s} $entry break
        if {$s==1} {
          hd_resolve "<li>\[$link|$label\]&nbsp;&nbsp;"
          hd_resolve "\[experimental | <small><i>(exp)</i></small>\]</li>"

        } elseif {$s==2} {
          hd_resolve "<li>\[$link|$label\]&nbsp;&nbsp;"
          hd_resolve "\[deprecated | <small><i>(obs)</i></small>\]</li>"





        } else {
          hd_resolve "<li>\[$link|$label\]</li>"

        }
        hd_puts \n








      }

    }




    hd_putsnl {</ul></td>}
  }








  hd_putsnl {</tr></table>}


}

hd_open_aux c3ref/intro.html
hd_header Introduction
hd_enable_main 0
hd_keywords *capi3ref {C-language Interface}
</tcl>







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>

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







216
217
218
219
220
221
222
223
224
225
226
227
228
229
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
318
  set oldname [string tolower $oldname]
  regsub {^sqlite_} $oldname {c_} oldname
  regsub {^sqlite3_} $oldname {} oldname
  regsub { } $oldname _ name
  return $name.html
}

# Convert the keyword $kw into an appropriate relative URI
#
proc keyword_to_uri {kw} {
  global hd llink glink
  if {$hd(enable-main)} {
    set fn $hd(fn-main)
    if {[info exists llink($fn:$kw)]} {
      return $hd(rootpath-main)$llink($fn:$kw)
    }
    if {[info exists glink($kw)]} {
      return $hd(rootpath-main)$glink($kw)
    }
  }
  if {$hd(enable-aux)} {
    if {[info exists glink($kw)]} {
      return $hd(rootpath-aux)$glink($kw)
    }
  }
  return ""
}

# Generate a Javascript table containing the URL and Label from $lx
#
proc output_list_javascript {lx} {

  set sep {[}
  foreach entry $lx {
    foreach {link label s} $entry break
    set url [keyword_to_uri $link]
    hd_puts "${sep}{\"u\":\"$url\",\"x\":\"$label\",\"s\":$s}"
    set sep ",\n"
  }
  hd_putsnl "\];"
}



# Output HTML/JS that displays the list $lx in multiple columns
# under the assumption that each column is $w pixels wide.
#
proc output_list {title w lx} {
  global listcount hd
  if {![info exists listcount]} {
    set listcount 1
  } else {

    incr listcount
  }
  set tx listtab$listcount
  set vx listitems$listcount
  hd_puts "<style>\n#$tx tr td {vertical-align:top;}\n"
  hd_puts "</style>\n"
  hd_putsnl "<table id='$tx' width='100%'></table>"
  hd_putsnl "<script>"
  hd_puts "var $vx = "
  if {$hd(enable-main) && $hd(enable-aux)} {

    set hd(enable-main) 0
    output_list_javascript $lx
    set hd(enable-main) 1
    set hd(enable-aux) 0
    output_list_javascript $lx
    set hd(enable-aux) 1
  } else {

    output_list_javascript $lx
  }
  hd_putsnl "var j = 0;"
  hd_putsnl "var w = Math.max(document.documentElement.clientWidth, \
             window.innerWidth || 0);"
  hd_putsnl "var nCol = Math.floor(w/$w);"
  hd_putsnl "if(nCol<=0) nCol=1;"
  hd_putsnl "var nRow = Math.ceil(($vx.length+1)/nCol);"
  if {$title!=""} {
    hd_putsnl "var h=\"<tr><td colspan=\"+nCol;"
    hd_putsnl "h += \">$title</td></tr><tr><td><ul>\""
  } else {
    hd_putsnl "var h=\"<tr><td><ul>\""
  }
  hd_putsnl "for(var i=0; i<$vx.length; i++){"
  hd_putsnl "  if( (++j)>nRow ){"
  hd_putsnl "    h += \"</ul></td>\\n<td><ul>\\n\";"
  hd_putsnl "    j = 1;"
  hd_putsnl "  }"

  hd_putsnl "  h += \"<li><a href='\";"
  hd_putsnl "  h += $vx\[i\].u;"
  hd_putsnl "  h += \"'>\";"
  hd_putsnl "  if($vx\[i\].s==2) h += \"<s>\""
  hd_putsnl "  h += $vx\[i\].x;"
  hd_putsnl "  if($vx\[i\].s==2) h += \"</s>\""
  hd_putsnl "  h += \"</a>\\n\";"
  hd_putsnl "  if($vx\[i\].s==1) h += \"<small><i>(exp)</i></small>\\n\";"
  hd_putsnl "}"
  hd_putsnl "document.getElementById(\"$tx\").innerHTML = h;"
  hd_putsnl "</script>"
}

hd_open_aux c3ref/intro.html
hd_header Introduction
hd_enable_main 0
hd_keywords *capi3ref {C-language Interface}
</tcl>
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
hd_header {List Of SQLite Objects}
hd_enable_main 0
hd_putsnl {<a href="intro.html"><h2>SQLite C Interface</h2></a>}
hd_enable_main 1
</tcl>
<h2>List Of Objects:</h2>
<tcl>
output_list "" 3 [lsort -nocase $objlist]
hd_enable_main 0
hd_putsnl {<p>Other lists:
<a href="constlist.html">Constants</a> and
<a href="funclist.html">Functions</a> and
<a href="../rescode.html">Result Codes</a>.}
hd_close_aux
hd_enable_main 1







|







496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
hd_header {List Of SQLite Objects}
hd_enable_main 0
hd_putsnl {<a href="intro.html"><h2>SQLite C Interface</h2></a>}
hd_enable_main 1
</tcl>
<h2>List Of Objects:</h2>
<tcl>
output_list "" 280 [lsort -nocase $objlist]
hd_enable_main 0
hd_putsnl {<p>Other lists:
<a href="constlist.html">Constants</a> and
<a href="funclist.html">Functions</a> and
<a href="../rescode.html">Result Codes</a>.}
hd_close_aux
hd_enable_main 1
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
hd_putsnl {<a href="intro.html"><h2>SQLite C Interface</h2></a>}
hd_enable_main 1
</tcl>
<h2>List Of Constants:</h2>
<p>Also available: [error codes|list of error codes]</p>
<tcl>
set clist [lsort -index 1 $clist]
output_list "" 2 $clist
hd_enable_main 0
hd_putsnl {<p>Other lists:
<a href="objlist.html">Objects</a> and
<a href="funclist.html">Functions</a> and
<a href="../rescode.html">Result Codes</a>.</p>}
hd_enable_main 1
hd_close_aux







|







534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
hd_putsnl {<a href="intro.html"><h2>SQLite C Interface</h2></a>}
hd_enable_main 1
</tcl>
<h2>List Of Constants:</h2>
<p>Also available: [error codes|list of error codes]</p>
<tcl>
set clist [lsort -index 1 $clist]
output_list "" 400 $clist
hd_enable_main 0
hd_putsnl {<p>Other lists:
<a href="objlist.html">Objects</a> and
<a href="funclist.html">Functions</a> and
<a href="../rescode.html">Result Codes</a>.</p>}
hd_enable_main 1
hd_close_aux
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
hd_header {List Of SQLite Functions}
hd_keywords *capi3ref_funclist {C-API function list}
hd_enable_main 0
hd_putsnl {<a href="intro.html"><h2>SQLite C Interface</h2></a>}
hd_enable_main 1
</tcl>
<h2>List Of Functions:</h2>
<p>Note: Functions marked with "[experimental | <small><i>(exp)</i></small>]"
are [experimental] and functions marked with
[deprecated | <small><i>(obs)</i></small>] are [deprecated].</p>
<tcl>
set funclist [lsort -index 1 $funclist]
output_list "" 3 $funclist
hd_enable_main 0
hd_putsnl {<p>Other lists:
<a href="constlist.html">Constants</a> and
<a href="objlist.html">Objects</a> and
<a href="../rescode.html">Result Codes</a></p>}
hd_enable_main 1
hd_close_aux







|
|
|


|







570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
hd_header {List Of SQLite Functions}
hd_keywords *capi3ref_funclist {C-API function list}
hd_enable_main 0
hd_putsnl {<a href="intro.html"><h2>SQLite C Interface</h2></a>}
hd_enable_main 1
</tcl>
<h2>List Of Functions:</h2>
<p>Note: Functions marked with "<small><i>(exp)</i></small>"
are [experimental] and functions whose names are
<s>struck through</s> are [deprecated].</p>
<tcl>
set funclist [lsort -index 1 $funclist]
output_list "" 315 $funclist
hd_enable_main 0
hd_putsnl {<p>Other lists:
<a href="constlist.html">Constants</a> and
<a href="objlist.html">Objects</a> and
<a href="../rescode.html">Result Codes</a></p>}
hd_enable_main 1
hd_close_aux
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
    hd_puts "</p>\n"
    return
  }
  set flst {}
  foreach x $lx {
    lappend flst [list $x $x 0]
  }
  output_list ${label}s: 3 $flst
  hd_puts "</p>\n"
}


# Output all the records
#
foreach c [lsort $content] {







|







621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
    hd_puts "</p>\n"
    return
  }
  set flst {}
  foreach x $lx {
    lappend flst [list $x $x 0]
  }
  output_list ${label}s: 350 $flst
  hd_puts "</p>\n"
}


# Output all the records
#
foreach c [lsort $content] {