Mercurial > vim
comparison runtime/doc/syntax.txt @ 2321:1902913f2049 vim73
Improved version of 2html.vim.
Includes progress bar.
Fix dynamic folding in diff view.
(Benjamin Fritz)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Fri, 16 Jul 2010 20:35:36 +0200 |
parents | 233eb4412f5d |
children | 12b829477c60 |
comparison
equal
deleted
inserted
replaced
2320:966a5609669e | 2321:1902913f2049 |
---|---|
378 You are not supposed to set the 'filetype' or 'syntax' option to "2html"! | 378 You are not supposed to set the 'filetype' or 'syntax' option to "2html"! |
379 Source the script to convert the current file: > | 379 Source the script to convert the current file: > |
380 | 380 |
381 :runtime! syntax/2html.vim | 381 :runtime! syntax/2html.vim |
382 < | 382 < |
383 Warning: This is slow! | |
384 *:TOhtml* | 383 *:TOhtml* |
385 Or use the ":TOhtml" user command. It is defined in a standard plugin. | 384 Or use the ":TOhtml" user command. It is defined in a standard plugin. |
386 ":TOhtml" also works with a range and in a Visual area: > | 385 ":TOhtml" also works with a range and in a Visual area: > |
387 | 386 |
388 :10,40TOhtml | 387 :10,40TOhtml |
389 | 388 |
389 Warning: This is slow! The script must process every character of every line. | |
390 Because it is so slow, by default a progress bar is displayed in the | |
391 statusline for each step that usually takes a long time. If you don't like | |
392 seeing this progress bar, you can disable it and get a very minor speed | |
393 improvement with: > | |
394 | |
395 let g:html_no_progress = 1 | |
396 | |
390 ":TOhtml" has another special feature: if the window is in diff mode, it will | 397 ":TOhtml" has another special feature: if the window is in diff mode, it will |
391 generate HTML that shows all the related windows. This can be disabled by | 398 generate HTML that shows all the related windows. This can be disabled by |
392 setting the g:diff_one_file variable: > | 399 setting the g:html_diff_one_file variable: > |
393 | 400 |
394 let g:diff_one_file = 1 | 401 let g:html_diff_one_file = 1 |
395 | 402 |
396 After you save the resulting file, you can view it with any browser. The | 403 After you save the resulting file, you can view it with any browser. The |
397 colors should be exactly the same as you see them in Vim. | 404 colors should be exactly the same as you see them in Vim. |
398 | 405 |
399 To restrict the conversion to a range of lines set "html_start_line" and | 406 To restrict the conversion to a range of lines, use a range with the |:TOhtml| |
400 "html_end_line" to the first and last line to be converted. Example, using | 407 command, or set "g:html_start_line" and "g:html_end_line" to the first and |
401 the last set Visual area: > | 408 last line to be converted. Example, using the last set Visual area: > |
402 | 409 |
403 :let html_start_line = line("'<") | 410 :let g:html_start_line = line("'<") |
404 :let html_end_line = line("'>") | 411 :let g:html_end_line = line("'>") |
405 | 412 |
406 The lines are numbered according to 'number' option and the Number | 413 The lines are numbered according to 'number' option and the Number |
407 highlighting. You can force lines to be numbered in the HTML output by | 414 highlighting. You can force lines to be numbered in the HTML output by |
408 setting "html_number_lines" to non-zero value: > | 415 setting "html_number_lines" to non-zero value: > |
409 :let html_number_lines = 1 | 416 :let g:html_number_lines = 1 |
410 Force to omit the line numbers by using a zero value: > | 417 Force to omit the line numbers by using a zero value: > |
411 :let html_number_lines = 0 | 418 :let g:html_number_lines = 0 |
412 Go back to the default to use 'number' by deleting the variable: > | 419 Go back to the default to use 'number' by deleting the variable: > |
413 :unlet html_number_lines | 420 :unlet g:html_number_lines |
414 | 421 |
415 By default, HTML optimized for old browsers is generated. If you prefer using | 422 By default, HTML optimized for old browsers is generated. If you prefer using |
416 cascading style sheets (CSS1) for the attributes (resulting in considerably | 423 cascading style sheets (CSS1) for the attributes (resulting in considerably |
417 shorter and valid HTML 4 file), use: > | 424 shorter and valid HTML 4 file), use: > |
418 :let html_use_css = 1 | 425 :let g:html_use_css = 1 |
419 | 426 |
420 Closed folds are put in the HTML as they are displayed. If you don't want | 427 Closed folds are put in the HTML as they are displayed. If you don't want |
421 this, use the |zR| command before invoking 2html, or use: > | 428 this, use the |zR| command before invoking 2html, or use: > |
422 :let html_ignore_folding = 1 | 429 :let g:html_ignore_folding = 1 |
423 | 430 |
424 You may want to generate HTML that includes all the data within the folds, and | 431 You may want to generate HTML that includes all the data within the folds, and |
425 allow the user to view the folded data similar to how they would in Vim. To | 432 allow the user to view the folded data similar to how they would in Vim. To |
426 generate this dynamic fold information, use: > | 433 generate this dynamic fold information, use: > |
427 :let html_dynamic_folds = 1 | 434 :let g:html_dynamic_folds = 1 |
428 | 435 |
429 Using html_dynamic_folds will imply html_use_css, because it would be far too | 436 Using html_dynamic_folds will imply html_use_css, because it would be far too |
430 difficult to do it for old browsers. However, html_ignore_folding overrides | 437 difficult to do it for old browsers. However, html_ignore_folding overrides |
431 html_dynamic_folds. | 438 html_dynamic_folds. |
432 | 439 |
433 Using html_dynamic_folds will default to generating a foldcolumn in the html | 440 Using html_dynamic_folds will default to generating a foldcolumn in the html |
434 similar to Vim's foldcolumn, that will use javascript to open and close the | 441 similar to Vim's foldcolumn, that will use javascript to open and close the |
435 folds in the HTML document. The width of this foldcolumn starts at the current | 442 folds in the HTML document. The width of this foldcolumn starts at the current |
436 setting of |'foldcolumn'| but grows to fit the greatest foldlevel in your | 443 setting of |'foldcolumn'| but grows to fit the greatest foldlevel in your |
437 document. If you do not want to show a foldcolumn at all, use: > | 444 document. If you do not want to show a foldcolumn at all, use: > |
438 :let html_no_foldcolumn = 1 | 445 :let g:html_no_foldcolumn = 1 |
439 | 446 |
440 Using this option, there will be no foldcolumn available to open the folds in | 447 Using this option, there will be no foldcolumn available to open the folds in |
441 the HTML. For this reason, another option is provided: html_hover_unfold. | 448 the HTML. For this reason, another option is provided: html_hover_unfold. |
442 Enabling this option will use CSS 2.0 to allow a user to open a fold by | 449 Enabling this option will use CSS 2.0 to allow a user to open a fold by |
443 hovering the mouse pointer over it. Note that old browsers (notably Internet | 450 hovering the mouse pointer over it. Note that old browsers (notably Internet |
444 Explorer 6) will not support this feature. Browser-specific markup for IE6 is | 451 Explorer 6) will not support this feature. Browser-specific markup for IE6 is |
445 included to fall back to the normal CSS1 code so that the folds show up | 452 included to fall back to the normal CSS1 code so that the folds show up |
446 correctly for this browser, but they will not be openable without a | 453 correctly for this browser, but they will not be openable without a |
447 foldcolumn. Note that using html_hover_unfold will allow modern browsers with | 454 foldcolumn. Note that using html_hover_unfold will allow modern browsers with |
448 disabled javascript to view closed folds. To use this option, use: > | 455 disabled javascript to view closed folds. To use this option, use: > |
449 :let html_hover_unfold = 1 | 456 :let g:html_hover_unfold = 1 |
450 | 457 |
451 Setting html_no_foldcolumn with html_dynamic_folds will automatically set | 458 Setting html_no_foldcolumn with html_dynamic_folds will automatically set |
452 html_hover_unfold, because otherwise the folds wouldn't be dynamic. | 459 html_hover_unfold, because otherwise the folds wouldn't be dynamic. |
453 | 460 |
454 By default "<pre>" and "</pre>" is used around the text. This makes it show | 461 By default "<pre>" and "</pre>" is used around the text. This makes it show |
455 up as you see it in Vim, but without wrapping. If you prefer wrapping, at the | 462 up as you see it in Vim, but without wrapping. If you prefer wrapping, at the |
456 risk of making some things look a bit different, use: > | 463 risk of making some things look a bit different, use: > |
457 :let html_no_pre = 1 | 464 :let g:html_no_pre = 1 |
458 This will use <br> at the end of each line and use " " for repeated | 465 This will use <br> at the end of each line and use " " for repeated |
459 spaces. | 466 spaces. |
460 | 467 |
461 The current value of 'encoding' is used to specify the charset of the HTML | 468 The current value of 'encoding' is used to specify the charset of the HTML |
462 file. This only works for those values of 'encoding' that have an equivalent | 469 file. This only works for those values of 'encoding' that have an equivalent |
463 HTML charset name. To overrule this set g:html_use_encoding to the name of | 470 HTML charset name. To overrule this set g:html_use_encoding to the name of |
464 the charset to be used: > | 471 the charset to be used: > |
465 :let html_use_encoding = "foobar" | 472 :let g:html_use_encoding = "foobar" |
466 To omit the line that specifies the charset, set g:html_use_encoding to an | 473 To omit the line that specifies the charset, set g:html_use_encoding to an |
467 empty string: > | 474 empty string: > |
468 :let html_use_encoding = "" | 475 :let g:html_use_encoding = "" |
469 To go back to the automatic mechanism, delete the g:html_use_encoding | 476 To go back to the automatic mechanism, delete the g:html_use_encoding |
470 variable: > | 477 variable: > |
471 :unlet html_use_encoding | 478 :unlet g:html_use_encoding |
472 < | 479 < |
473 For diff mode a sequence of more than 3 filler lines is displayed as three | 480 For diff mode a sequence of more than 3 filler lines is displayed as three |
474 lines with the middle line mentioning the total number of inserted lines. If | 481 lines with the middle line mentioning the total number of inserted lines. If |
475 you prefer to see all the inserted lines use: > | 482 you prefer to see all the inserted lines use: > |
476 :let html_whole_filler = 1 | 483 :let g:html_whole_filler = 1 |
477 And to go back to displaying up to three lines again: > | 484 And to go back to displaying up to three lines again: > |
478 :unlet html_whole_filler | 485 :unlet g:html_whole_filler |
479 < | 486 < |
480 *convert-to-XML* *convert-to-XHTML* | 487 *convert-to-XML* *convert-to-XHTML* |
481 An alternative is to have the script generate XHTML (XML compliant HTML). To | 488 An alternative is to have the script generate XHTML (XML compliant HTML). To |
482 do this set the "use_xhtml" variable: > | 489 do this set the "use_xhtml" variable: > |
483 :let use_xhtml = 1 | 490 :let use_xhtml = 1 |
484 To disable it again delete the variable: > | 491 To disable it again delete the variable: > |
485 :unlet use_xhtml | 492 :unlet use_xhtml |
486 The generated XHTML file can be used in DocBook XML documents. See: | |
487 http://people.mech.kuleuven.ac.be/~pissaris/howto/src2db.html | |
488 | 493 |
489 Remarks: | 494 Remarks: |
490 - This only works in a version with GUI support. If the GUI is not actually | 495 - This only works in a version with GUI support. If the GUI is not actually |
491 running (possible for X11) it still works, but not very well (the colors | 496 running (possible for X11) it still works, but not very well (the colors |
492 may be wrong). | 497 may be wrong). |