Restore the previous status of gnu-emacs-file

- Updated strings files to match.
- Inhibit internal options from being output via the iterator. Internals should
  never have the chance to be exposed if they shouldn't be use.
- Added tidySetEmacsFile() and TidyGetEmacsFile() to the public API, and use it
  instead of secret API to set the filename in the console application.

The end result is that `gnu-emacs-file` (and also `doctype-mode`) officially no
longer exist to CLI users nor to API users, and tidy console behaves properly
by using a published API to set the filename for emacs.
This commit is contained in:
Jim Derry 2017-03-07 20:11:31 -05:00
parent 1ebae18c9a
commit 978756a482
16 changed files with 43 additions and 116 deletions

View file

@ -1941,8 +1941,8 @@ int main( int argc, char** argv )
#if (!defined(NDEBUG) && defined(_MSC_VER))
SPRTF("Tidying '%s'\n", htmlfil);
#endif /* DEBUG outout */
if ( tidyOptGetBool(tdoc, TidyEmacs) && !tidyOptGetValue(tdoc, TidyEmacsFile) )
tidyOptSetValue( tdoc, TidyEmacsFile, htmlfil );
if ( tidyOptGetBool(tdoc, TidyEmacs) )
tidySetEmacsFile( tdoc, htmlfil );
status = tidyParseFile( tdoc, htmlfil );
}
else

View file

@ -564,6 +564,22 @@ TIDY_EXPORT Bool TIDY_CALL tidyInitSink( TidyOutputSink* sink,
TIDY_EXPORT void TIDY_CALL tidyPutByte( TidyOutputSink* sink, uint byteValue );
/****************
Emacs File
****************/
/** Set the file path to use for reports when `TidyEmacs` is being used. This
** function provides a proper interface for using the hidden, internal-only
** `TidyEmacsFile` configuration option.
*/
TIDY_EXPORT void TIDY_CALL tidySetEmacsFile( TidyDoc tdoc, ctmbstr filePath );
/** Get the file path to use for reports when `TidyEmacs` is being used. This
** function provides a proper interface for using the hidden, internal-only
** `TidyEmacsFile` configuration option.
*/
TIDY_EXPORT ctmbstr TIDY_CALL tidyGetEmacsFile( TidyDoc tdoc );
/****************
Errors
****************/

View file

@ -5,7 +5,7 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: HTML Tidy poconvert.rb\n"
"Project-Id-Version: \n"
"PO-Revision-Date: 2017-02-18 18:13:23\n"
"PO-Revision-Date: 2017-03-07 20:09:19\n"
"Last-Translator: jderry\n"
"Language-Team: \n"
@ -2773,21 +2773,6 @@ msgid ""
"errors and warnings to a format that is more easily parsed by GNU Emacs. "
msgstr ""
#. Important notes for translators:
#. - Use only <code></code>, <var></var>, <em></em>, <strong></strong>, and
#. <br/>.
#. - Entities, tags, attributes, etc., should be enclosed in <code></code>.
#. - Option values should be enclosed in <var></var>.
#. - It's very important that <br/> be self-closing!
#. - The strings "Tidy" and "HTML Tidy" are the program name and must not
#. be translated.
msgctxt "TidyEmacsFile"
msgid ""
"When <code>gnu-emacs</code> is <var>yes</var>, then this option value "
"specifies the filename to be used in the output report. The HTML Tidy "
"command line program will set this automatically. "
msgstr ""
#. Important notes for translators:
#. - Use only <code></code>, <var></var>, <em></em>, <strong></strong>, and
#. <br/>.

View file

@ -5,7 +5,7 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: HTML Tidy poconvert.rb\n"
"Project-Id-Version: \n"
"PO-Revision-Date: 2017-02-18 18:13:23\n"
"PO-Revision-Date: 2017-03-07 20:09:19\n"
"Last-Translator: jderry\n"
"Language-Team: \n"
@ -2750,21 +2750,6 @@ msgid ""
"errors and warnings to a format that is more easily parsed by GNU Emacs. "
msgstr ""
#. Important notes for translators:
#. - Use only <code></code>, <var></var>, <em></em>, <strong></strong>, and
#. <br/>.
#. - Entities, tags, attributes, etc., should be enclosed in <code></code>.
#. - Option values should be enclosed in <var></var>.
#. - It's very important that <br/> be self-closing!
#. - The strings "Tidy" and "HTML Tidy" are the program name and must not
#. be translated.
msgctxt "TidyEmacsFile"
msgid ""
"When <code>gnu-emacs</code> is <var>yes</var>, then this option value "
"specifies the filename to be used in the output report. The HTML Tidy "
"command line program will set this automatically. "
msgstr ""
#. Important notes for translators:
#. - Use only <code></code>, <var></var>, <em></em>, <strong></strong>, and
#. <br/>.

View file

@ -5,7 +5,7 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: HTML Tidy poconvert.rb\n"
"Project-Id-Version: \n"
"PO-Revision-Date: 2017-02-18 18:13:23\n"
"PO-Revision-Date: 2017-03-07 20:09:19\n"
"Last-Translator: jderry\n"
"Language-Team: \n"
@ -2745,21 +2745,6 @@ msgid ""
"errors and warnings to a format that is more easily parsed by GNU Emacs. "
msgstr ""
#. Important notes for translators:
#. - Use only <code></code>, <var></var>, <em></em>, <strong></strong>, and
#. <br/>.
#. - Entities, tags, attributes, etc., should be enclosed in <code></code>.
#. - Option values should be enclosed in <var></var>.
#. - It's very important that <br/> be self-closing!
#. - The strings "Tidy" and "HTML Tidy" are the program name and must not
#. be translated.
msgctxt "TidyEmacsFile"
msgid ""
"When <code>gnu-emacs</code> is <var>yes</var>, then this option value "
"specifies the filename to be used in the output report. The HTML Tidy "
"command line program will set this automatically. "
msgstr ""
#. Important notes for translators:
#. - Use only <code></code>, <var></var>, <em></em>, <strong></strong>, and
#. <br/>.

View file

@ -5,7 +5,7 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"X-Generator: HTML Tidy poconvert.rb\n"
"Project-Id-Version: \n"
"PO-Revision-Date: 2017-02-18 18:13:23\n"
"PO-Revision-Date: 2017-03-07 20:09:19\n"
"Last-Translator: jderry\n"
"Language-Team: \n"
@ -2930,21 +2930,6 @@ msgid ""
"errors and warnings to a format that is more easily parsed by GNU Emacs. "
msgstr ""
#. Important notes for translators:
#. - Use only <code></code>, <var></var>, <em></em>, <strong></strong>, and
#. <br/>.
#. - Entities, tags, attributes, etc., should be enclosed in <code></code>.
#. - Option values should be enclosed in <var></var>.
#. - It's very important that <br/> be self-closing!
#. - The strings "Tidy" and "HTML Tidy" are the program name and must not
#. be translated.
msgctxt "TidyEmacsFile"
msgid ""
"When <code>gnu-emacs</code> is <var>yes</var>, then this option value "
"specifies the filename to be used in the output report. The HTML Tidy "
"command line program will set this automatically. "
msgstr ""
#. Important notes for translators:
#. - Use only <code></code>, <var></var>, <em></em>, <strong></strong>, and
#. <br/>.

View file

@ -5,7 +5,7 @@ msgstr ""
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: HTML Tidy poconvert.rb\n"
"Project-Id-Version: \n"
"PO-Revision-Date: 2017-02-18 18:13:23\n"
"PO-Revision-Date: 2017-03-07 20:09:19\n"
"Last-Translator: jderry\n"
"Language-Team: \n"
@ -2739,21 +2739,6 @@ msgid ""
"errors and warnings to a format that is more easily parsed by GNU Emacs. "
msgstr ""
#. Important notes for translators:
#. - Use only <code></code>, <var></var>, <em></em>, <strong></strong>, and
#. <br/>.
#. - Entities, tags, attributes, etc., should be enclosed in <code></code>.
#. - Option values should be enclosed in <var></var>.
#. - It's very important that <br/> be self-closing!
#. - The strings "Tidy" and "HTML Tidy" are the program name and must not
#. be translated.
msgctxt "TidyEmacsFile"
msgid ""
"When <code>gnu-emacs</code> is <var>yes</var>, then this option value "
"specifies the filename to be used in the output report. The HTML Tidy "
"command line program will set this automatically. "
msgstr ""
#. Important notes for translators:
#. - Use only <code></code>, <var></var>, <em></em>, <strong></strong>, and
#. <br/>.

View file

@ -5,7 +5,7 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: HTML Tidy poconvert.rb\n"
"Project-Id-Version: \n"
"POT-Creation-Date: 2017-02-18 18:13:23\n"
"POT-Creation-Date: 2017-03-07 20:09:19\n"
"Last-Translator: jderry\n"
"Language-Team: \n"
@ -2741,21 +2741,6 @@ msgid ""
"errors and warnings to a format that is more easily parsed by GNU Emacs. "
msgstr ""
#. Important notes for translators:
#. - Use only <code></code>, <var></var>, <em></em>, <strong></strong>, and
#. <br/>.
#. - Entities, tags, attributes, etc., should be enclosed in <code></code>.
#. - Option values should be enclosed in <var></var>.
#. - It's very important that <br/> be self-closing!
#. - The strings "Tidy" and "HTML Tidy" are the program name and must not
#. be translated.
msgctxt "TidyEmacsFile"
msgid ""
"When <code>gnu-emacs</code> is <var>yes</var>, then this option value "
"specifies the filename to be used in the output report. The HTML Tidy "
"command line program will set this automatically. "
msgstr ""
#. Important notes for translators:
#. - Use only <code></code>, <var></var>, <em></em>, <strong></strong>, and
#. <br/>.

View file

@ -1589,6 +1589,9 @@ const TidyOptionImpl* TY_(getNextOption)( TidyDocImpl* ARG_UNUSED(doc),
{
option = &option_defs[ optId ];
optId++;
/* Hide these internal options from the API entirely. */
if ( optId == TidyEmacsFile || optId == TidyDoctypeMode )
optId++;
}
*iter = (TidyIterator) ( optId < N_TIDY_OPTIONS ? optId : (size_t)0 );
return option;

View file

@ -1847,19 +1847,6 @@ static languageDefinition language_en = { whichPluralForm_en, {
"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. "
},
{/* Important notes for translators:
- Use only <code></code>, <var></var>, <em></em>, <strong></strong>, and
<br/>.
- Entities, tags, attributes, etc., should be enclosed in <code></code>.
- Option values should be enclosed in <var></var>.
- It's very important that <br/> be self-closing!
- The strings "Tidy" and "HTML Tidy" are the program name and must not
be translated. */
TidyEmacsFile, 0,
"When <code>gnu-emacs</code> is <var>yes</var>, then this option value "
"specifies the filename to be used in the output report. The HTML Tidy "
"command line program will set this automatically. "
},
{/* Important notes for translators:
- Use only <code></code>, <var></var>, <em></em>, <strong></strong>, and
<br/>.

View file

@ -28,7 +28,7 @@
*
* Orginating PO file metadata:
* PO_LAST_TRANSLATOR=jderry
* PO_REVISION_DATE=2017-02-18 18:13:23
* PO_REVISION_DATE=2017-03-07 20:09:19
*/
#ifdef _MSC_VER

View file

@ -28,7 +28,7 @@
*
* Orginating PO file metadata:
* PO_LAST_TRANSLATOR=jderry
* PO_REVISION_DATE=2017-02-18 18:13:23
* PO_REVISION_DATE=2017-03-07 20:09:19
*/
#ifdef _MSC_VER

View file

@ -28,7 +28,7 @@
*
* Orginating PO file metadata:
* PO_LAST_TRANSLATOR=jderry
* PO_REVISION_DATE=2017-02-18 18:13:23
* PO_REVISION_DATE=2017-03-07 20:09:19
*/
#ifdef _MSC_VER

View file

@ -28,7 +28,7 @@
*
* Orginating PO file metadata:
* PO_LAST_TRANSLATOR=jderry
* PO_REVISION_DATE=2017-02-18 18:13:23
* PO_REVISION_DATE=2017-03-07 20:09:19
*/
#ifdef _MSC_VER

View file

@ -28,7 +28,7 @@
*
* Orginating PO file metadata:
* PO_LAST_TRANSLATOR=jderry
* PO_REVISION_DATE=2017-02-18 18:13:23
* PO_REVISION_DATE=2017-03-07 20:09:19
*/
#ifdef _MSC_VER

View file

@ -649,6 +649,17 @@ Bool TIDY_CALL tidyOptCopyConfig( TidyDoc to, TidyDoc from )
** options will just be set directly.
*/
void TIDY_CALL tidySetEmacsFile( TidyDoc tdoc, ctmbstr filePath )
{
tidyOptSetValue( tdoc, TidyEmacsFile, filePath );
}
ctmbstr TIDY_CALL tidyGetEmacsFile( TidyDoc tdoc )
{
return tidyOptGetValue( tdoc, TidyEmacsFile );
}
/* Use TidyReportFilter to filter messages by diagnostic level:
** info, warning, etc. Just set diagnostic output
** handler to redirect all diagnostics output. Return true