Commit graph

66 commits

Author SHA1 Message Date
Jim Derry 11178d775b Massive Revamp of the Messaging System
This is a rather large refactoring of Tidy's messaging system. This was done
mostly to allow non-C libraries that cannot adequately take advantage of
arg_lists a chance to query report filter information for information related
to arguments used in constructing an error message.

Three main goals were in mind for this project:

- Don't change the contents of Tidy's existing output sinks. This will ensure
  that changes do no affect console Tidy users, or LibTidy users who use the
  output sinks directly. This was accomplished 100% other than some improved
  cosmetics in the output. See tidy-html5-tests repository, the `refactor` and
  `more_messages_changes` branches for these minor diffs.
- Provide an API that is simple and also extensible without having to write new
  error filters all the time. This was accomplished by adding the new message
  callback `TidyMessageCallback` that provides callback functions an opaque
  object representing the message, and an API to query the message for wanted
  details. With this, we should never have to add a new callback routine again,
  as additional API can simply be written against the opaque object.
- The API should work the same as the rest of LibTidy's API in that it's
  consistent and only uses simple types with wide interoperability with other
  languages. Thanks to @gagern who suggested the model for the API in #409.
  Although the API uses the "Tidy" way off accessing data via an iterator
  rather than an index, this can be easily abstracted in the target language.

There are two *major* API breaking changes:

- Removed TidyReportFilter2
  - This was only used by one application in the entire world, and was a hacky
    kludge that served its purpose. TidyReportCallback (né TidyReportFilter3)
    is much better. If, for some reason, this affects you, I recommend using
    TidyReportCallback instead. It's a minor change for your application.
- Renamed TidyReportFilter3 to TidyReportCallback
  - This name is much more semantic, and much more sensible in light of
    improved callback system. As the name implies, it remains capable of
    *only* receiving callbacks for Tidy "reports."

Introducing TidyMessageCallback, and a new message interrogation API.

- As its name implies, it is able to capture (and optionally suppress) *all*
  of Tidy's output, including the dialogue messages that never make it to
  the existing report filters.
- Provides an opaque `TidyMessage` and an API that can be used to query against
  it to find the juicy goodness inside.
  - For example, `tidyGetMessageOutput( tmessage )` will return the complete,
    localized message.
  - Another example, `tidyGetMessageLine( tmessage )` will return the line the
    message applies to.
- You can also get information about the individual arguments that make up a
  message. By using the `tidyGetMessageArguments( tmessage )` itorator and
  `tidyGetNextMessageArgument` you will obtain an opaque `TidyMessageArgument`
  which has its own interrogation API. For example:
    - tidyGetArgType( tmessage, &iterator );
    - tidyGetArgFormat( tmessage, &iterator );
    - tidyGetArgValueString( tmessage, &iterator );
    - …and so on.

Other major changes include refactoring `messages.c` to use the new message
"object" directly when emitting messages to the console or output sinks. This
allowed replacement of a lot of specialized functions with generalized ones.

Some of this generalizing involved modifications to the `language_xx.h` header
files, and these are all positive improvements even without the above changes.
2017-03-13 13:28:57 -04:00
Jim Derry cbb8354f74 Combined leftover attribute API stuff into single, new file. 2017-02-18 16:57:11 -05:00
Jim Derry 165acc4f3e Several foundational changes preparing for release of 5.4 and future 5.5:
- Consolidated all output string definitions enums into `tidyenum.h`, which
    is where they belong, and where they have proper visibility.
  - Re-arranged `messages.c/h` with several comments useful to developers.
  - Properly added the key lookup functions and the language localization
    functions into tidy.h/tidylib.c with proper name-spacing.
  - Previous point restored a *lot* of sanity to the #include pollution that's
    been introduced in light of these.
  - Note that opaque types have been (properly) introduced. Look at the updated
    headers for `language.h`. In particular only an opaque structure is passed
    outside of LibTidy, and so use TidyLangWindowsName and TidyLangPosixName
    to poll these objects.
  - Console application updated as a result of this.
  - Removed dead code:
    - void TY_(UnknownOption)( TidyDocImpl* doc, char c );
    - void TY_(UnknownFile)( TidyDocImpl* doc, ctmbstr program, ctmbstr file );
  - Redundant strings were removed with the removal of this dead code.
  - Several enums were given fixed starting values. YOUR PROGRAMS SHOULD NEVER
    depend on enum values. `TidyReportLevel` is an example of such.
  - Some enums were removed as a result of this. `TidyReportLevel` now has
    matching strings, so the redundant `TidyReportLevelStrings` was removed.
  - All of the PO's and language header files were regenerated as a result of
    the string cleanup and header cleanup.
  - Made the interface to the library version and release date consistent.
  - CMakeLists.txt now supports SUPPORT_CONSOLE_APP. The intention is to
    be able to remove console-only code from LibTidy (for LibTidy users).
  - Updated README/MESSAGES.md, which is *vastly* more simple now.
2017-02-17 15:29:26 -05:00
Geoff McLane b26271e3f8 Adjust for removal of LICENSE.txt 2016-07-11 20:40:20 +02:00
Adam Majer 30cc376f7b Add compatibility headers
In older versions of tidy, these headers were defined. Now, they are
renamed to tidybuffio.h and tidyplatform.h. This may be more of a
consistent naming scheme, but it breaks current software.

Re-add these headers and add compile time warning when such a header
is used.
2016-06-28 10:27:51 +02:00
Jim Derry cf1adc6d9d Merge pull request #366 from hguemar/master
Fix RPM generation
2016-02-16 10:16:46 +08:00
Jim Derry fbde392af3 - Removed documentation generation from this repository.
- Removed documentation generation from CMake.
- These functions are now available in the api repository.
- Changed documentation directory to man to better illustrate its purpose.
2016-02-05 14:59:12 +08:00
Haikel Guemar 593e1df6ec Fix RPM generation
CPack generated RPM failed to install due to the RPM
owning directories owned by filesystem packages.
Exclude mandir directories from CPack.

Resolves https://github.com/htacg/tidy-html5/issues/364
2016-02-04 08:40:49 +01:00
Geoff McLane 6abb8b7a3c Add new primary language_en.h to sources.
Add the ever present language_en.h to the sources. This does nothing
really, but is important in MSVC IDE project source searches.

Also added win32tc.h even though it is not presently used.
2016-02-01 19:30:56 +01:00
Jim Derry 53f2a2da2a msgunfmt works properly with escaped hex. 2016-01-30 15:51:53 +08:00
Jim Derry d505869910 Localization Support added to HTML Tidy
- Languages can now be added to Tidy using standard toolchains.
- Tidy's help output is improved with new options and some reorganization.
2016-01-30 15:51:53 +08:00
Geoff McLane 0005841cfe Drop back to 2.8.7 for Travis CI use 2015-12-23 00:51:01 +01:00
Geoff McLane e5038f0bc9 Issue #326 - Allow linkage choice TIDY_CONSOLE_SHARED 2015-12-04 18:31:24 +01:00
Geoff McLane 1c6069ae99 Remove MinGW compile rc (#311) 2015-12-03 19:36:24 +01:00
Geoff McLane 77e053d582 Issue #311 - Add MinGW to the version 2015-11-28 15:25:24 +01:00
Rex Dieter d0abe84cb3 support INCLUDE_INSTALL_DIR too 2015-11-13 13:19:10 -06:00
Rex Dieter ea7828fca3 allow modified install paths
and make them consistent between static/shared builds.

Long term, consider using:
https://cmake.org/cmake/help/v3.0/module/GNUInstallDirs.html

issue #295
2015-11-13 12:33:27 -06:00
Jim Derry 4ac07978df Fix CMakeLists references to old paths. 2015-10-31 10:58:28 +08:00
Geoff McLane f01cfaab9e Issue #65 - Merge issue-65 to master, and drop RC_NUMBER 2015-10-28 16:10:06 +01:00
Geoff McLane a94df6c0f9 Issue #285 - Bump to 5.1.15.EXP3 for this fix 2015-10-14 16:57:41 +02:00
Geoff McLane 55060018b3 Issue #64 - bump version to .EXP2 for this fix 2015-10-08 17:07:52 +02:00
Geoff McLane 4e3f853e36 Add RC_NUMBER EXP1 for this #65 and #280 fix 2015-10-07 15:13:29 +02:00
Geoff R. McLane d529b4cd83 #279 - remove creation of a new 'documentation' folder 2015-10-02 14:21:15 +02:00
King_DuckZ e2ec0e96a0 Use tidy.xsl from documentation/ instead of build/documentation. 2015-09-30 16:06:13 +02:00
King_DuckZ 9be7264e6a Fix cmake for use as subproject. 2015-09-29 23:39:08 +02:00
Geoff McLane 87e0e11b49 Merge of issue-228 to master 2015-09-04 15:03:08 +02:00
Geoff McLane d639181afc Make it clear this is RC_VERSION=D231 running 2015-07-30 14:47:59 +02:00
Geoff McLane 97c7065177 Remove RC_NUMBER from development master branch 2015-07-13 12:42:19 +02:00
Geoff McLane 1e70fc6f15 Rename two headers. Issues #224 #223 #221
But this seemed a good time to release 5.0.0.RC1...
2015-06-30 20:06:02 +02:00
Geoff McLane 250ce1c6d0 Issue #190 & #148 - Restore tidyReleaseDate() function.
There was an idea to mark this function deprecated, such that if used the
developer would see a warning. But this was never implemented in a cross
platform way.

So for now revert to circa Jan 2015 when Jim added a build date to the
version.txt file. And now both LIBTIDY_VERSION and RELEASE_DATE macros are
established in CMakeLists.txt, and picked up in version.h.

The idea is the date will now march forward with the version number, side
by side in version.txt. Although have left tidy.c only emitting the
version on the --version command.

After this function has been marked deprecated for several release periods,
only then should consideration be given to potentially removing it.
2015-06-09 12:29:51 +02:00
Geoff McLane d9113957d8 Reverse option wording to reflect new default ON 2015-05-25 13:33:32 +02:00
Geoff McLane efb8e37664 Build both static and shared libraries.
First many other projects do this, and it seems a good choice.

Due mainly to windows where the static and shared libraries have the same
name, appended an 's' to the static library.

The tidy console app will use the static library, since to build the man
page tidy may need to be run before the shared libraries are installed.
And this makes the windows tidy exe a stand-alone app. No DLL install
issue.

This addresses issue #194, and possibly #190
2015-05-24 15:21:30 +02:00
Geoff R. McLane 65d230a167 add documentation target 2015-05-19 16:51:15 +02:00
Geoff R. McLane 221e067f95 Change relative path to absolute so cmake can be run anywhere.
The recommended place to run cmake is in the build/cmake directory,
but have changed a relative path to an absolute path which should
allow cmake to be run ANYWHERE!. See bottom of Issue #193

Also a few other minor tweak to CMakeLists.txt
2015-05-12 14:28:25 +02:00
Geoff McLane d8a4498803 Add user option -DMAN_INSTALL_DIR=path to CMakeLists.txt - see #193
Seems this is required to accomodate different man install directories
used by Slackware, BSD and perhaps others.
2015-05-12 13:20:57 +02:00
Geoff McLane 032bf4264d Issue #193 - install tidy doc in share/man/man1 2015-04-15 15:05:45 +02:00
Geoff McLane a8e98412b5 Issue #192 - no need to check architecture 2015-04-14 02:12:22 +02:00
Geoff McLane 26f1d93379 prepare for changing the lib name 2015-04-02 13:17:14 +02:00
Geoff McLane 17cb520f58 add windows zip binary installer 2015-03-20 13:56:20 +01:00
Geoff R. McLane 12b0fc74a9 Issue #187 - correction for unix man page 2015-03-19 18:06:49 +01:00
Geoff McLane 47df5fddbc Issue #188 - Add some user config items 2015-03-19 16:32:19 +01:00
Geoff R. McLane f4071047e9 Output only to build folder 2015-03-08 12:35:41 +01:00
Jim Derry e0833dc8ab Fixed #183 2015-03-08 15:39:48 +08:00
Jim Derry 08d037b6af Fix for Cmake > 3.0.0 2015-03-08 13:39:46 +08:00
Pedro c013fa97d9 Make man filename into a cmake variable 2015-03-07 22:28:58 +00:00
Pedro 3f8a95601e Make man filename into a cmake variable 2015-03-07 22:27:02 +00:00
Pedro b39a953f69 Add note re using manpath 2015-03-07 22:11:51 +00:00
Pedro b6caf8f7a5 Create man page as part of cmake build 2015-03-07 22:08:39 +00:00
Geoff McLane 59aad805e5 Initial cpack building releases.
Thanks to pedromorgan PR #174 for the initial addition of this to
CMakeLists.txt.
2015-03-06 15:31:34 +01:00
Pedro 648b20e622 Create zips and tarballs 2015-03-05 22:20:46 +00:00