-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtidy.el
1972 lines (1625 loc) · 60.9 KB
/
tidy.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
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
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
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
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
;;; tidy.el --- Interface to the HTML Tidy program
;; Copyright (C) 2001, 2002, 2003 by Free Software Foundation, Inc.
;; Emacs Lisp Archive Entry
;; Filename: tidy.el
;; Author: Kahlil (Kal) HODGSON <dorge@tpg.com.au>
;; X-URL: http://www.emacswiki.org/elisp/tidy.el
;; Time-stamp: <2002-09-30 13:16:23 kahlil>
;; Version: 2.12
;; Keywords: languages
;; This file is NOT part of GNU Emacs.
;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to
;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
;;;; Commentary:
;; Provides a simple interface to the HTML Tidy program -- a free
;; utility that can fix common errors in your mark-up and clean up
;; sloppy editing automatically. See
;;
;; <http://tidy.sourceforge.net/>
;;
;; for more details. This package provides the following functions:
;;
;; `tidy-buffer',
;; `tidy-parse-config-file',
;; `tidy-save-settings', and
;; `tidy-describe-options',
;;
;; These can be invoked interactively (using M-x) or via the menu-bar.
;; The function `tidy-buffer' sends the current buffer to HTML Tidy,
;; replacing the existing contents with a "tidied" version. If
;; `tidy-buffer' is given a prefix argument, tidy operates on the
;; current region, ignoring mark-up outside <BODY>...</BODY> tags
;; (useful for writhing cgi scripts in Pearl). Warnings and errors
;; are presented in a compilation buffer to facilitate tracking down
;; necessary changes (e.g. C-x ` is bound to `next-error').
;;
;; This package also provides menu-bar support for setting Tidy's many
;; options, and includes support for Tidy configuration files. The
;; function `tidy-parse-config-file' will synchronise options
;; displayed in the menu-bar with the settings in `tidy-config-file'.
;; This is normally called by the load-hook for your HTML editing mode
;; (see installation instructions below). The function
;; `tidy-save-settings' will save the current option settings to your
;; `tidy-config-file'. Finally `tidy-describe-options' allows you to
;; browse the documentation strings associated with each option.
;;;
;;;; Installation:
;; This package assumes you have and up-to-date HTML Tidy program
;; installed on your system. See the URL above for instructions on
;; how to do this. To set up this support package, first place the
;; "tidy.el" file somewhere in your `load-path' and open it in Emacs.
;; Byte-compile and load this package using the command
;;
;; M-x emacs-lisp-byte-compile-and-load <RET>
;;
;; Next customise the variables `tidy-config-file', `tidy-temp-dir'
;; `tidy-shell-command', `tidy-menu-lock' and `tidy-menu-x-position'
;;
;; M-x customize-group <RET> tidy <RET>
;;
;; Now add the following autoloads to your ".emacs.el" file:
;;
;; (autoload 'tidy-buffer "tidy" "Run Tidy HTML parser on current buffer" t)
;; (autoload 'tidy-parse-config-file "tidy" "Parse the `tidy-config-file'" t)
;; (autoload 'tidy-save-settings "tidy" "Save settings to `tidy-config-file'" t)
;; (autoload 'tidy-build-menu "tidy" "Install an options menu for HTML Tidy." t)
;;
;; If you use html-mode to edit HTML files then add something like
;; this as well
;; (defun my-html-mode-hook () "Customize my html-mode."
;; (tidy-build-menu html-mode-map)
;; (local-set-key [(control c) (control c)] 'tidy-buffer)
;; (setq sgml-validate-command "tidy"))
;;
;; (add-hook 'html-mode-hook 'my-html-mode-hook)
;; This will set up a "tidy" menu in the menu bar and bind the key
;; sequence "C-c C-c" to `tidy-buffer' in html-mode (normally bound to
;; `validate-buffer').
;;
;; For other modes (like html-helper-mode) simple change the variables
;; `html-mode-hook' and `html-mode-map' to whatever is appropriate e.g.
;; (defun my-html-mode-hook () "Customize my html-helper-mode."
;; (tidy-build-menu html-helper-mode-map)
;; (local-set-key [(control c) (control c)] 'tidy-buffer)
;; (setq sgml-validate-command "tidy"))
;;
;; (add-hook 'html-helper-mode-hook 'my-html-mode-hook)
;; Finally, restart Emacs and open an HTML file to test-drive the tidy
;; package. For people new to HTML tidy check that the option "markup"
;; under the "Input/Output" sub menu is set. You can read the
;; documentation on this option via the menu item "Describe Options".
;;
;; Enjoy!
;;;; New Features:
;;
;; 0. Now compatible with CVS version of Tidy as at 22 May 2003
;; 1. Improved menu support to facillitate incorporting new options
;; 2. Menu lock option makes menu stick when toggling options.
;; 3. Now runs on XEmacs!!
;; 4. Uses error file rather than std-error to retrieve errors (this
;; fixes some odd pop up behaviour)
;; 5. minor bug fix (empty config files)
;; 6. handle buffer modified query in error buffer better
;; 7. make it impossible to mark the error buffer as modified
;; 8. Added the variable `tidy-temp-directory'.
;; 9. Bugfix in tidy-buffer: call find-file-noselect with NOWARN
;;;; ToDo:
;;
;; 1. Automatically set "char-encoding" according to the buffer encoding
;; 2. Should check value of HTML_TIDY environment variable.
;;;; Bugs:
;; Requires a version of HTML Tidy that understands the "-f"
;; "-config" "--show-body-only" command line options e.g. source-forge
;; pre-release.
;;
;; There may be a bug with setting doctypes. I don't use this feature
;; yet and, well, don't really know how its supposed to work:-)
;;
;; Care with character encodings!!
;;;; Credits
;; This code was inspired by an Emacs "tip" suggested by Pete Gelbman.
;;
;; Thanks to Hans-Michael Stahl for comments regarding XEmacs
;; compatibility.
;;
;; Thanks to Thomas Baumann for bugfix's in `tidy-parse-config-file'
;; and `tidy-buffer'.
;;
;; Thanks to Chris Lott for comments regarding installation and menu
;; display
;;
;; Thanks to Jeroen Baekelandt for noting a problem with ange-ftp and
;; inspiring `tidy-temp-directory'.
;;;; Code:
;;;;; Forward references (stuff which must come first)
(require 'easymenu) ;; This makes menus so much easier!
(require 'compile) ;; To make the error buffer more sexy
;; The following two are functions so that the same compiled code will
;; work in both situations (time cost is negligible)
(defsubst tidy-xemacs-p ()
"Return t iff we are running XEmacs this session."
(not (null (string-match "^XEmacs.*" (emacs-version)))))
(defsubst tidy-windows-p ()
"Return t iff we are running on a Windows system."
(memq system-type '(emx win32 w32 mswindows ms-dos windows-nt)))
;; function definitions
;; XEmacs
(defalias 'tidy-x-event-function 'event-function)
(defalias 'tidy-x-event-object 'event-object)
(defalias 'tidy-x-find-menu-item 'find-menu-item)
(defalias 'tidy-x-get-popup-menu-response 'get-popup-menu-response)
(defalias 'tidy-x-make-event 'make-event)
(defalias 'tidy-x-misc-user-event-p 'misc-user-event-p)
;;;;; User Variables
(defgroup tidy nil
"*Provides a simple interface to the HTML Tidy program -- a free
utility that can fix common errors in your mark-up and clean up
sloppy editing automatically. See
<http://tidy.sourceforge.net/>
for more details. This package provides the following functions:
`tidy-buffer',
`tidy-parse-config-file',
`tidy-save-settings', and
`tidy-describe-options',
These can be invoked interactively (using M-x) or via the menu-bar.
The function `tidy-buffer' sends the current buffer to HTML Tidy,
replacing the existing contents with a \"tidied\" version. If
`tidy-buffer' is given a prefix argument, tidy operates on the
current region, ignoring mark-up outside <BODY>...</BODY> tags
\(useful for writhing cgi scripts in Pearl). Warnings and errors
are presented in a compilation buffer to facilitate tracking down
necessary changes (e.g. C-x ` is bound to `next-error').
This package also provides menu-bar support for setting Tidy's many
options, and includes support for Tidy configuration files. The
function `tidy-parse-config-file' will synchronise options
displayed in the menu-bar with the settings in `tidy-config-file'.
This is normally called by the load-hook for your HTML editing mode
\(see installation instructions below). The function
`tidy-save-settings' will save the current option settings to your
`tidy-config-file'. Finally `tidy-describe-options' allows you to
browse the documentation strings associated with each option.
")
(defcustom tidy-config-file "~/.tidyrc"
"*Path to your default tidy configuration file.
This is used by `tidy-parse-config-file' to synchronise Tidy's behaviour
inside Emacs with its behaviour outside, and by `tidy-save-settings' to
set your configuration file from within Emacs. If you never want this to
happen, set `tidy-config-file' to nil."
:group 'tidy
:type 'string)
(defcustom tidy-shell-command "/usr/bin/tidy"
"*Full path to command to call HTML tidy from a shell."
:group 'tidy
:type 'string)
(defcustom tidy-temp-directory "."
"Directory where tidy places its temp files. The default is the
current directory which works fine unless you are operating on remote
files via `ange-ftp' and its ilk, in which case it will try to place
the temp files on the remote server (and will probably fail). If this
is the case try setting this variable to something like \"/tmp/\" or
\"/var/tmp/\"."
:group 'tidy
:type 'string)
(defcustom tidy-menu-lock t
" *Non-nil means menu is locked (i.e. doesn't pop down) when
selecting toggle and radio options.
See also `tidy-menu-x-position'."
:type 'boolean
:group 'tidy)
(defcustom tidy-menu-x-position 211
"*Specify menu position height in pixels.
This variable is used to set the horizontal position of the locked
menu, so don't forget to adjust it if menu position is not ok.
See also `tidy-menu-lock'."
:type 'integer
:group 'tidy)
;;;;; Local Variables
(defvar tidy-debug nil
"If t then we rebuild everything on reload. Useful for debugging.")
;;(eval-when-compile (setq tidy-debug t))
(defun tidy-toggle-debug () "Toggle value of tidy-debug."
(interactive)
(message "tidy-debug is %s" (setq tidy-debug (not tidy-debug))))
(defvar tidy-options-alist nil
"An alist containing all valid tidy options.
Each element is a list of the form
(NAME, SUB-MENU, VALUE-TYPE, DEFAULT-VALUE, DOC-STRING).
This is used to automatically construct variables and a menu bar.
To add new or modify exiting options simply modify this list.")
(when (or (null tidy-options-alist) tidy-debug)
(setq tidy-options-alist
'(
("add-xml-decl" "Fix Markup" "Boolean" "no"
"
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should add the XML declaration when
outputting XML or XHTML. Note that if the input already includes an <?xml
... ?> declaration then this option will be ignored.")
("add-xml-pi" "Fix Markup" "Boolean" "no"
"
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
This option is the same as the add-xml-decl option.")
("add-xml-space" "Fix Markup" "Boolean" "no"
"
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should add xml:space=\"preserve\" to elements
such as <PRE>, <STYLE> and <SCRIPT> when generating XML. This is needed if
the whitespace in such elements is to be parsed appropriately without
having access to the DTD.")
("alt-text" "Fix Markup" "String" ""
"
Type: String
Default: -none-
This option specifies the default \"alt=\" text Tidy uses for <IMG>
attributes. This feature is dangerous as it suppresses further
accessibility warnings. You are responsible for making your documents
accessible to people who can not see the images!")
("ascii-chars" "Fix Markup" "Boolean" "yes"
"
Type: Boolean
Default: yes
Example: y/n, yes/no, t/f, true/false, 1/0
Can be used to modify behavior of -c (--clean yes) option.
Defaults to \"yes\" when using -c. Set to \"no\" to prevent
converting &emdash;, ”, and other named character entities
to their ascii equivalents.")
("assume-xml-procins" "Fix Markup" "Boolean" "no"
"
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should change the parsing of processing
instructions to require ?> as the terminator rather than >. This option is
automatically set if the input is in XML.")
("bare" "Fix Markup" "Boolean" "no"
"
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should strip Microsoft specific HTML from
Word 2000 documents, and output spaces rather than non-breaking spaces
where they exist in the input.")
("break-before-br" "Fix Markup" "Boolean" "no"
"
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should output a line break before each <BR>
element.")
("char-encoding" "Encoding" "Encoding" "ascii"
"
Type: Encoding
Default: ascii
Example: ascii, latin1, raw, utf8, iso2022, mac, win1252
This option specifies the character encoding Tidy uses for both the input
and output. Possible values are: ascii, latin1, raw, utf8, iso2022, mac,
win1252. For ascii, Tidy will accept Latin-1 (ISO-8859-1) character
values, but will use entities for all characters whose value > 127. For
raw, Tidy will output values above 127 without translating them into
entities. For latin1, characters above 255 will be written as
entities. For utf8, Tidy assumes that both input and output is encoded as
UTF-8. You can use iso2022 for files encoded using the ISO-2022 family of
encodings e.g. ISO-2022-JP. For mac and win1252, Tidy will accept vendor
specific character values, but will use entities for all characters whose
value > 127.")
("clean" "Fix Markup" "Boolean" "no"
"
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should strip out surplus presentational tags
and attributes replacing them by style rules and structural markup as
appropriate. It works well on the HTML saved by Microsoft Office products.")
("doctype" "Fix Markup" "DocType" "auto"
"
Type: DocType
Default: auto
Example: auto, omit, strict, loose, transitional, user specified fpi \(string\)
This option specifies the DOCTYPE declaration generated by Tidy. If set to
\"omit\" the output won't contain a DOCTYPE declaration. If set to \"auto\"
\(the default\) Tidy will use an educated guess based upon the contents of
the document. If set to \"strict\", Tidy will set the DOCTYPE to the strict
DTD. If set to \"loose\", the DOCTYPE is set to the loose \(transitional\)
DTD. Alternatively, you can supply a string for the formal public
identifier \(FPI\). For example:
doctype: \"-//ACME//DTD HTML 3.14159//EN\"
If you specify the FPI for an XHTML document, Tidy will set
the system identifier to the empty string. Tidy leaves the DOCTYPE for
generic XML documents unchanged.")
("drop-empty-paras" "Fix Markup" "Boolean" "yes"
"
Type: Boolean
Default: yes
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should discard empty paragraphs. If set to
no, empty paragraphs are replaced by a pair of <BR> elements as HTML4
precludes empty paragraphs.")
("drop-font-tags" "Fix Markup" "Boolean" "no"
"
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should discard <FONT> and <CENTER> tags
rather than creating the corresponding style rules, but only if the clean
option is also set to yes.")
("drop-proprietary-attributes" "Fix Markup" "Boolean" "no"
"
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should strip out proprietary attributes,
such as MS data binding attributes.")
("enclose-block-text" "Fix Markup" "Boolean" "no"
"
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should insert a <P> element to enclose any
text it finds in any element that allows mixed content for HTML
transitional but not HTML strict.")
("enclose-text" "Fix Markup" "Boolean" "no"
"
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should enclose any text it finds in the body
element within a <P> element. This is useful when you want to take
existing HTML and use it with a style sheet.")
("error-file" "Omit" "String" "-none-"
"
Type: String
Default: -none-
This option specifies the error file Tidy uses for errors and
warnings. Normally errors and warnings are output to \"stderr\".
This is option is ignored in Emacs.")
("escape-cdata" "Fix Markup" "Boolean" "no"
"
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should convert <![CDATA[]]> sections to
normal text.")
("fix-backslash" "Fix Markup" "Boolean" "yes"
"
Type: Boolean
Default: yes
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should replace backslash characters \"\\\" in
URLs by forward slashes \"/\".")
("fix-bad-comments" "Fix Markup" "Boolean" "yes"
"
Type: Boolean
Default: yes
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should replace unexpected hyphens with \"=\"
characters when it comes across adjacent hyphens. The default is yes. This
option is provided for users of Cold Fusion which uses the comment syntax:
<!--- --->")
("fix-uri" "Fix Markup" "Boolean" "yes"
"
Type: Boolean
Default: yes
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should check attribute values that carry
URIsfor illegal characters and if such are found, escape them as HTML 4
recommends.")
("force-output" "Input/Output" "Boolean" "no"
"
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should produce output even if errors are
encountered. Use this option with care - if Tidy reports an error,
this means Tidy was not able to, or is not sure how to, fix the error,
so the resulting output may not reflect your intention.")
("gnu-emacs" "Omit" "Boolean" "no"
"
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should change the format for reporting
errors and warnings to a format that is more easily parsed by GNU
Emacs.
This option is automatically set in Emacs." )
("hide-comments" "Fix Markup" "Boolean" "no"
"
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should print out comments.")
("hide-endtags" "Fix Markup" "Boolean" "no"
"
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should omit optional end-tags when
generating the pretty printed markup. This option is ignored if you are
outputting to XML.")
("indent" "Indentation" "AutoBool" "no"
"
Type: AutoBool
Default: no
Example: auto, y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should indent block-level tags. If set to
\"auto\", this option causes Tidy to decide whether or not to indent the
content of tags such as TITLE, H1-H6, LI, TD, TD, or P depending on whether
or not the content includes a block-level element. You are advised to avoid
setting indent to yes as this can expose layout bugs in some browsers.")
("indent-attributes" "Indentation" "Boolean" "no"
"
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should begin each attribute on a new line.")
("indent-cdata" "Indent" "Boolean" "no"
"
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should indent <![CDATA[]]> sections.")
("indent-spaces" "Indentation" "Integer" "2"
"
Type: Integer
Default: 2
Example: 0, 1, 2, ...
This option specifies the number of spaces Tidy uses to indent content,
when indentation is enabled.")
("input-encoding" "Encoding" "Encoding" "latin1"
"
Type: Encoding
Default: ascii
Example: ascii, latin1, raw, utf8, iso2022, mac, win1252
This option specifies the character encoding Tidy uses for the input. See
char-encoding for more info.")
("input-xml" "Input/Output" "Boolean" "no"
"
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should use the XML parser rather than the
error correcting HTML parser.")
("join-classes" "Fix Markup" "Boolean" "no"
"
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should combine class names to generate a
single new class name, if multiple class assignments are detected on an
element.")
("join-styles" "Fix Markup" "Boolean" "yes"
"
Type: Boolean
Default: yes
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should combine styles to generate a single
new style, if multiple style values are detected on an element.")
("keep-time" "Preference" "Boolean" "no"
"
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should alter the last modified time for
files it writes back to. The default is no, which allows you to tidy files
without affecting which ones will be uploaded to a Web server when using a
tool such as 'SiteCopy'. Note that this feature may not work on some
platforms.")
("literal-attributes" "Preference" "Boolean" "no"
"
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should ensure that whitespace characters
within attribute values are passed through unchanged.")
("logical-emphasis" "Fix Markup" "Boolean" "no"
"
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should replace any occurrence of <I> by <EM>
and any occurrence of <B> by <STRONG>. In both cases, the attributes are
preserved unchanged. This option can be set independently of the clean and
drop-font-tags options.")
("lower-literals" "Preference" "Boolean" "yes"
"
Type: Boolean
Default: yes
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should convert the value of an attribute
that takes a list of predefined values to lower case. This is required for
XHTML documents.")
("markup" "Input/Output" "Boolean" "yes"
"
Type: Boolean
Default: yes
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should generate a pretty printed version of
the markup. Note that Tidy won't generate a pretty printed version if it
finds significant errors (see force-output).")
("ncr" "Preference" "Boolean" "yes"
"
Type: Boolean
Default: yes
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should allow numeric character references.")
("new-blocklevel-tags" "Tags" "Tag names" ""
"
Type: Tag names
Default: -none-
Example: tagX, tagY, ...
This option specifies new block-level tags. This option takes a space or
comma separated list of tag names. Unless you declare new tags, Tidy will
refuse to generate a tidied file if the input includes previously unknown
tags. Note you can't change the content model for elements such as
<TABLE>, <UL>, <OL> and <DL>.")
("new-empty-tags" "Tags" "Tag names" ""
"
Type: Tag names
Default: -none-
Example: tagX, tagY, ...
This option specifies new empty inline tags. This option takes a space or
comma separated list of tag names. Unless you declare new tags, Tidy will
refuse to generate a tidied file if the input includes previously unknown
tags. Remember to also declare empty tags as either inline or blocklevel.")
("new-inline-tags" "Tags" "Tag names" ""
"
Type: Tag names
Default: -none-
Example: tagX, tagY, ...
This option specifies new non-empty inline tags. This option takes a space
or comma separated list of tag names. Unless you declare new tags, Tidy
will refuse to generate a tidied file if the input includes previously
unknown tags.")
("new-pre-tags" "Tags" "Tag names" ""
"
Type: Tag names
Default: -none-
Example: tagX, tagY, ...
This option specifies new tags that are to be processed in exactly the
same way as HTML's <PRE> element. This option takes a space or comma
separated list of tag names. Unless you declare new tags, Tidy will refuse
to generate a tidied file if the input includes previously unknown
tags. Note you can not as yet add new CDATA elements (similar to
<SCRIPT>).")
("numeric-entities" "Preference" "Boolean" "no"
"
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should output entities other than the
built-in HTML entities \(&, <, > and "\) in the numeric
rather than the named entity form.")
("output-bom" "Encoding" "AutoBool" "auto"
"
Type: AutoBool
Default: auto
Example: auto, y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should write a Unicode Byte Order Mark
character (BOM; also known as Zero Width No-Break Space; has value of
U+FEFF) to the beginning of the output; only for UTF-8 and UTF-16 output
encodings. If set to \"auto\", this option causes Tidy to write a BOM to the
output only if a BOM was present at the beginning of the input. A BOM is
always written for XML/XHTML output using UTF-16 output encodings.")
("output-encoding" "Encoding" "Encoding" "ascii"
"
Type: Encoding
Default: ascii
Example: ascii, latin1, raw, utf8, iso2022, mac, win1252
This option specifies the character encoding Tidy uses for the output. See
char-encoding for more info. May only be different from input-encoding for
Latin encodings (ascii, latin1, mac, win1252).")
("output-xhtml" "Input/Output" "Boolean" "no"
"
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should generate pretty printed output,
writing it as extensible HTML. This option causes Tidy to set the DOCTYPE
and default namespace as appropriate to XHTML. If a DOCTYPE or namespace
is given they will checked for consistency with the content of the
document. In the case of an inconsistency, the corrected values will
appear in the output. For XHTML, entities can be written as named or
numeric entities according to the setting of the \"numeric-entities\"
option. The original case of tags and attributes will be preserved,
regardless of other options.")
("output-xml" "Input/Output" "Boolean" "no"
"
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should pretty print output, writing it as
well-formed XML. Any entities not defined in XML 1.0 will be written as
numeric entities to allow them to be parsed by a XML parser. The original
case of tags and attributes will be preserved, regardless of other
options.")
("quiet" "Input/Output" "Boolean" "no"
"
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should output the summary of the numbers of
errors and warnings, or the welcome or informational messages.")
("quote-ampersand" "Preference" "Boolean" "yes"
"
Type: Boolean
Default: yes
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should output unadorned & characters as
&.")
("quote-marks" "Preference" "Boolean" "no"
"
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should output \" characters as " as is
preferred by some editing environments. The apostrophe character \' is
written out as ' since many web browsers don't yet support '.")
("quote-nbsp" "Preference" "Boolean" "yes"
"
Type: Boolean
Default: yes
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should output non-breaking space characters
as entities, rather than as the Unicode character value 160 (decimal).")
("raw" "Omit" "Boolean" "no"
"
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0 char-encoding
Currently not used, but this option would be the same as the
char-encoding: raw option.")
("repeated-attributes" "Fix Markup" ("keep-first" "keep-last") "keep-last"
"
Type: -
Default: keep-last
Example: keep-first, keep-last
This option specifies if Tidy should keep the first or last attribute, if
an attribute is repeated, e.g. has two align attributes.")
("replace-color" "Fix Markup" "Boolean"
"
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should replace numeric values in color
attributes by HTML/XHTML color names where defined, e.g. replace
\"#ffffff\" with \"white\"." )
("slide-style" "Omit" "String"
"
Type: Name
Default: -none-
split Currently not used.")
("show-body-only" "Omit" "Boolean" "no"
"
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should print only the contents of the body
tag as an HTML fragment. Useful for incorporating existing whole pages as
a portion of another page.
Emacs overrides this option.")
("show-errors" "Input/Output" "Integer" "6"
"
Type: Integer
Default: 6
Example: 0, 1, 2, ...
This option specifies the number Tidy uses to determine if further errors
should be shown. If set to 0, then no errors are shown.")
("show-warnings" "Input/Output" "Boolean" "yes"
"
Type: Boolean
Default: yes
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should suppress warnings. This can be useful
when a few errors are hidden in a flurry of warnings.")
("slide-style" "Omit" "String" ""
"
Type: Name
Default: -none-
Currently not used.")
("split" "Omit" "Boolean" "no"
"
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should create a sequence of slides from
the input, splitting the markup prior to each successive <H2>. The
slides are written to \"slide001.html\", \"slide002.html\" etc.
There is currently no Emacs support for this option.")
("tab-size" "Indentation" "Integer" "4"
"
Type: Integer
Default: 4
Example: 0, 1, 2, ...
This option specifies the number of columns that Tidy uses between
successive tab stops. It is used to map tabs to spaces when reading the
input. Tidy never outputs tabs.")
("tidy-mark" "Preference" "Boolean" "yes"
"
Type: Boolean
Default: yes
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should add a meta element to the document
head to indicate that the document has been tidied. Tidy won't add a meta
element if one is already present.")
("uppercase-attributes" "Preference" "Boolean" "no"
"
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should output attribute names in upper
case. The default is no, which results in lower case attribute names,
except for XML input, where the original case is preserved.")
("uppercase-tags" "Preference" "Boolean" "no"
"
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should output tag names in upper case. The
default is no, which results in lower case tag names, except for XML
input, where the original case is preserved.")
("word-2000" "Fix Markup" "Boolean" "no"
"
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should go to great pains to strip out all
the surplus stuff Microsoft Word 2000 inserts when you save Word documents
as \"Web pages\". Doesn't handle embedded images or VML.")
("wrap" "Line Wrapping" "Integer" "68"
"
Type: Integer
Default: 68
Example: 0, 1, 2, ...
This option specifies the right margin Tidy uses for line wrapping. Tidy
tries to wrap lines so that they do not exceed this length. Set wrap to
zero if you want to disable line wrapping.")
("wrap-asp" "Line Wrapping" "Boolean" "yes"
"
Type: Boolean
Default: yes
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should line wrap text contained within ASP
pseudo elements, which look like: <% ... %>.")
("wrap-attributes" "Line Wrapping" "Boolean" "no"
"
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should line wrap attribute values, for
easier editing. This option can be set independently of