tidy-html5-5.2.0/000077500000000000000000000000001272601517300135225ustar00rootroot00000000000000tidy-html5-5.2.0/.gitignore000066400000000000000000000002601272601517300155100ustar00rootroot00000000000000/autom4te.cache/ /console/.deps/ /console/.libs/ /src/.deps/ /src/.libs/ *.user *.suo *.sdf /test /test/testall.log /test/tmp/ /test/tmp2/ *~ temp* *.bak .DS_Store .idea *.old tidy-html5-5.2.0/CMakeLists.txt000066400000000000000000000326351272601517300162730ustar00rootroot00000000000000# CMakeLists.txt - 20150402 - 20150130 - 20140801 - for github htacg/tidy-html5 # Prepare for changing the name to 'tidy' cmake_minimum_required (VERSION 2.8.7) set(LIB_NAME tidy) project (${LIB_NAME}) # ### NOTE: *** Adjust version.txt when required *** # read 'version' file into a variable (stripping any newlines or spaces) # 20150609: Revert to supplying BOTH version and date, as we had back in Jan 2015 # NOTE: Both version and date MUST be DOT separated, in two lines. file(READ version.txt versionFile) if (NOT versionFile) message(FATAL_ERROR "Unable to determine libtidy version. version.txt file is missing.") endif() string(STRIP "${versionFile}" VERSION_TEXT) string(REGEX REPLACE "(.*)[\r\n|\n](.*)" "\\1" LIBTIDY_VERSION ${VERSION_TEXT}) string(REGEX REPLACE "(.*)[\r\n|\n](.*)" "\\2" LIBTIDY_DATE ${VERSION_TEXT}) # establish version number if (LIBTIDY_VERSION) string(REPLACE "." ";" VERSION_LIST ${LIBTIDY_VERSION}) list(GET VERSION_LIST 0 TIDY_MAJOR_VERSION) list(GET VERSION_LIST 1 TIDY_MINOR_VERSION) list(GET VERSION_LIST 2 TIDY_POINT_VERSION) else () message(FATAL_ERROR "*** FAILED to get a VERSION from version.txt!") endif () # establish version date if (LIBTIDY_DATE) string(REPLACE "." ";" DATE_LIST ${LIBTIDY_DATE}) list(GET DATE_LIST 0 tidy_YEAR) list(GET DATE_LIST 1 tidy_MONTH) list(GET DATE_LIST 2 tidy_DAY) else () message(FATAL_ERROR "*** FAILED to get a DATE from version.txt!") endif () # By default, BOTH library types built, Allow turning OFF shared if not needed set( LIB_TYPE STATIC ) # set default message option( BUILD_SHARED_LIB "Set OFF to NOT build shared library" ON ) option( BUILD_TAB2SPACE "Set ON to build utility app, tab2space" OFF ) option( BUILD_SAMPLE_CODE "Set ON to build the sample code" OFF ) if (NOT MAN_INSTALL_DIR) set(MAN_INSTALL_DIR share/man/man1) endif () # Issue #326 - Allow linkage choice of console app tidy option( TIDY_CONSOLE_SHARED "Set ON to link with shared(DLL) lib." OFF ) if (TIDY_CONSOLE_SHARED) if (NOT BUILD_SHARED_LIB) message(FATAL_ERROR "Enable shared build for this tidy linkage!") endif () endif () # Allow building without extra language support option( SUPPORT_LOCALIZATIONS "Set OFF to build without additional languages." ON ) if (SUPPORT_LOCALIZATIONS) add_definitions ( -DSUPPORT_LOCALIZATIONS=1 ) else () add_definitions ( -DSUPPORT_LOCALIZATIONS=0 ) endif () if(CMAKE_COMPILER_IS_GNUCXX) set( WARNING_FLAGS -Wall ) endif(CMAKE_COMPILER_IS_GNUCXX) if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") set( WARNING_FLAGS "-Wall -Wno-overloaded-virtual" ) endif() if(WIN32 AND MSVC) # turn off various warnings set(WARNING_FLAGS "${WARNING_FLAGS} /wd4996") # C4090: 'function' : different 'const' qualifiers # C4244: '=' : conversion from '__int64' to 'uint', possible loss of data # C4267: 'function' : conversion from 'size_t' to 'uint', possible loss of data # foreach(warning 4244 4251 4267 4275 4290 4786 4305) foreach(warning 4090 4244 4267) set(WARNING_FLAGS "${WARNING_FLAGS} /wd${warning}") endforeach() set( MSVC_FLAGS "-DNOMINMAX -D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS -D__CRT_NONSTDC_NO_WARNINGS" ) # if (${MSVC_VERSION} EQUAL 1600) # set( MSVC_LD_FLAGS "/FORCE:MULTIPLE" ) # endif (${MSVC_VERSION} EQUAL 1600) # set( NOMINMAX 1 ) # to distinguish between debug and release lib in windows set( CMAKE_DEBUG_POSTFIX "d" ) # little effect in unix else() # add any gcc flags endif() set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS} ${MSVC_FLAGS} -D_REENTRANT" ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS} ${MSVC_FLAGS} -D_REENTRANT" ) set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${MSVC_LD_FLAGS}" ) add_definitions ( -DHAVE_CONFIG_H ) add_definitions ( -DSUPPORT_UTF16_ENCODINGS=1 ) add_definitions ( -DSUPPORT_ASIAN_ENCODINGS=1 ) add_definitions ( -DSUPPORT_ACCESSIBILITY_CHECKS=1 ) add_definitions ( -DLIBTIDY_VERSION="${LIBTIDY_VERSION}" ) add_definitions ( -DRELEASE_DATE="${tidy_YEAR}/${tidy_MONTH}/${tidy_DAY}" ) ### add_definitions ( -DRC_NUMBER="MinGW" ) # Issue #188 - Support user items in platform.h if (TIDY_CONFIG_FILE) add_definitions( -DTIDY_CONFIG_FILE="${TIDY_CONFIG_FILE}" ) endif () if (TIDY_USER_CONFIG_FILE) add_definitions( -DTIDY_USER_CONFIG_FILE="${TIDY_USER_CONFIG_FILE}" ) endif () if (SUPPORT_GETPWNAM) add_definitions( -DSUPPORT_GETPWNAM=1 ) endif () if(BUILD_SHARED_LIB) set(LIB_TYPE SHARED) message(STATUS "*** Also building DLL library ${LIB_TYPE}, version ${LIBTIDY_VERSION}, date ${LIBTIDY_DATE}") else() message(STATUS "*** Only building static library ${LIB_TYPE}, version ${LIBTIDY_VERSION}, date ${LIBTIDY_DATE}") endif() include_directories ( "${PROJECT_SOURCE_DIR}/include" "${PROJECT_SOURCE_DIR}/src" ) ############################################################################## ### tidy library # file locations set ( SRCDIR src ) set ( INCDIR include ) # file lists set ( CFILES ${SRCDIR}/access.c ${SRCDIR}/attrs.c ${SRCDIR}/istack.c ${SRCDIR}/parser.c ${SRCDIR}/tags.c ${SRCDIR}/entities.c ${SRCDIR}/lexer.c ${SRCDIR}/pprint.c ${SRCDIR}/charsets.c ${SRCDIR}/clean.c ${SRCDIR}/message.c ${SRCDIR}/config.c ${SRCDIR}/alloc.c ${SRCDIR}/attrask.c ${SRCDIR}/attrdict.c ${SRCDIR}/attrget.c ${SRCDIR}/buffio.c ${SRCDIR}/fileio.c ${SRCDIR}/streamio.c ${SRCDIR}/tagask.c ${SRCDIR}/tmbstr.c ${SRCDIR}/utf8.c ${SRCDIR}/tidylib.c ${SRCDIR}/mappedio.c ${SRCDIR}/gdoc.c ${SRCDIR}/language.c ) set ( HFILES ${INCDIR}/tidyplatform.h ${INCDIR}/tidy.h ${INCDIR}/tidyenum.h ${INCDIR}/tidybuffio.h ) set ( LIBHFILES ${SRCDIR}/access.h ${SRCDIR}/attrs.h ${SRCDIR}/attrdict.h ${SRCDIR}/charsets.h ${SRCDIR}/clean.h ${SRCDIR}/config.h ${SRCDIR}/entities.h ${SRCDIR}/fileio.h ${SRCDIR}/forward.h ${SRCDIR}/lexer.h ${SRCDIR}/mappedio.h ${SRCDIR}/message.h ${SRCDIR}/parser.h ${SRCDIR}/pprint.h ${SRCDIR}/streamio.h ${SRCDIR}/tags.h ${SRCDIR}/tmbstr.h ${SRCDIR}/utf8.h ${SRCDIR}/tidy-int.h ${SRCDIR}/version.h ${SRCDIR}/gdoc.h ${SRCDIR}/language.h ${SRCDIR}/language_en.h ${SRCDIR}/win32tc.h ) if (MSVC) list(APPEND CFILES ${SRCDIR}/sprtf.c) list(APPEND LIBHFILES ${SRCDIR}/sprtf.h) endif () ####################################### if (NOT LIB_INSTALL_DIR) set(LIB_INSTALL_DIR lib${LIB_SUFFIX}) endif () if (NOT BIN_INSTALL_DIR) set(BIN_INSTALL_DIR bin) endif () if (NOT INCLUDE_INSTALL_DIR) set(INCLUDE_INSTALL_DIR include) endif () # Always build the STATIC library set(name tidy-static) add_library ( ${name} STATIC ${CFILES} ${HFILES} ${LIBHFILES} ) set_target_properties( ${name} PROPERTIES OUTPUT_NAME ${LIB_NAME}s ) if (NOT TIDY_CONSOLE_SHARED) # user wants default static linkage list ( APPEND add_LIBS ${name} ) endif () install(TARGETS ${name} RUNTIME DESTINATION ${BIN_INSTALL_DIR} ARCHIVE DESTINATION ${LIB_INSTALL_DIR} LIBRARY DESTINATION ${LIB_INSTALL_DIR} ) install( FILES ${HFILES} DESTINATION ${INCLUDE_INSTALL_DIR} ) ######################################## # if user option still on if (BUILD_SHARED_LIB) set(name tidy-share) add_library ( ${name} SHARED ${CFILES} ${HFILES} ${LIBHFILES} ) set_target_properties( ${name} PROPERTIES OUTPUT_NAME ${LIB_NAME} ) set_target_properties( ${name} PROPERTIES VERSION ${LIBTIDY_VERSION} SOVERSION ${TIDY_MAJOR_VERSION} ) set_target_properties( ${name} PROPERTIES COMPILE_FLAGS "-DBUILD_SHARED_LIB" ) set_target_properties( ${name} PROPERTIES COMPILE_FLAGS "-DBUILDING_SHARED_LIB" ) install(TARGETS ${name} RUNTIME DESTINATION ${BIN_INSTALL_DIR} ARCHIVE DESTINATION ${LIB_INSTALL_DIR} LIBRARY DESTINATION ${LIB_INSTALL_DIR} ) if (TIDY_CONSOLE_SHARED) # user wants shared/dll linkage list ( APPEND add_LIBS ${name} ) endif () endif () ########################################################## ### main executable - linked with STATIC/SHARED library set(name ${LIB_NAME}) set ( BINDIR console ) add_executable( ${name} ${BINDIR}/tidy.c ) target_link_libraries( ${name} ${add_LIBS} ) if (MSVC) set_target_properties( ${name} PROPERTIES DEBUG_POSTFIX d ) endif () if (NOT TIDY_CONSOLE_SHARED) set_target_properties( ${name} PROPERTIES COMPILE_FLAGS "-DTIDY_STATIC" ) endif () install (TARGETS ${name} DESTINATION bin) if (BUILD_TAB2SPACE) set(name tab2space) add_executable( ${name} ${BINDIR}/tab2space.c ) if (MSVC) set_target_properties( ${name} PROPERTIES DEBUG_POSTFIX d ) endif () # no INSTALL of this 'local' tool - use depreciated endif () if (BUILD_SAMPLE_CODE) set(name test71) set(dir console) add_executable( ${name} ${dir}/${name}.cxx ) if (MSVC) set_target_properties( ${name} PROPERTIES DEBUG_POSTFIX d ) endif () target_link_libraries( ${name} ${add_LIBS} ) # no INSTALL of this 'local' sample endif () #========================================================== # Create man pages #========================================================== if (UNIX) find_program( XSLTPROC_FOUND xsltproc ) if (XSLTPROC_FOUND) ## NOTE: man name must match exe ie currently `${LIB_NAME}.1` not `tidy.1` ## also could use `manpath` command output to determine target install path set(TIDY_MANFILE ${LIB_NAME}.1) message(STATUS "*** Generating man ${TIDY_MANFILE} custom commands...") set(TIDY1XSL ${CMAKE_CURRENT_BINARY_DIR}/tidy1.xsl) set(TIDYHELP ${CMAKE_CURRENT_BINARY_DIR}/tidy-help.xml) set(TIDYCONFIG ${CMAKE_CURRENT_BINARY_DIR}/tidy-config.xml) add_custom_target(man ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${LIB_NAME}") configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/man/tidy1.xsl.in ${TIDY1XSL} ) # run built EXE to generate xml output add_custom_command( TARGET man COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${LIB_NAME} -xml-help > ${TIDYHELP} COMMENT "Generate ${TIDYHELP}" VERBATIM ) # run built EXE to generate more xml output add_custom_command( TARGET man COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${LIB_NAME} -xml-config > ${TIDYCONFIG} COMMENT "Generate ${TIDYCONFIG}" VERBATIM ) # run xsltproc to generate the install files.. add_custom_command( TARGET man DEPENDS ${TIDYHELP} COMMAND xsltproc ARGS ${TIDY1XSL} ${TIDYHELP} > ${CMAKE_CURRENT_BINARY_DIR}/${TIDY_MANFILE} COMMENT "Generate ${TIDY_MANFILE}" VERBATIM ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${TIDY_MANFILE} DESTINATION ${MAN_INSTALL_DIR}) else () message(STATUS "*** NOTE: xsltproc NOT FOUND! Can NOT generate man page.") message(STATUS "*** You need to install xsltproc in your system.") endif () endif () ########################################################## ### Create MSI,EXE, DMG, DEB/RPM ### TODO: Check each of these builds ########################################################## set(BITNESS 32) if(CMAKE_SIZEOF_VOID_P EQUAL 8) set(BITNESS 64) endif() if (WIN32) # MSI - this needs WiX Tooset installed and a path to candle.exe # EXE - this needs NSIS tools to be in path set(CPACK_GENERATOR "NSIS;WIX;ZIP") set(CPACK_SOURCE_GENERATOR "ZIP") set(CPACK_WIX_UPGRADE_GUID "D809598A-B513-4752-B268-0BAC403B00E4") elseif ( ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" ) set(CPACK_GENERATOR "PackageMake") set(CPACK_SOURCE_GENERATOR "TGZ") else () set(CPACK_GENERATOR "DEB;RPM") set(CPACK_SOURCE_GENERATOR "TGZ") endif () set(CPACK_PACKAGE_NAME "${LIB_NAME}") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${LIB_NAME} - HTML syntax checker") set(CPACK_PACKAGE_VENDOR "HTML Tidy Advocacy Community Group") set(CPACK_PACKAGE_CONTACT "maintainer@htacg.org") set(CPACK_PACKAGE_VERSION ${LIBTIDY_VERSION}) set(CPACK_PACKAGE_VERSION_MAJOR "${TIDY_MAJOR_VERSION}") set(CPACK_PACKAGE_VERSION_MINOR "${TIDY_MINOR_VERSION}") set(CPACK_PACKAGE_VERSION_PATCH "${TIDY_POINT_VERSION}") set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README/README.html") set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/README/LICENSE.txt") set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README/README.html") set(CPACK_RESOURCE_FILE_WELCOME "${CMAKE_CURRENT_SOURCE_DIR}/README/README.html") ## debian config set(CPACK_DEBIAN_PACKAGE_MAINTAINER ${CPACK_PACKAGE_CONTACT}) set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "http://www.html-tidy.org/") #set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc") set(CPACK_DEBIAN_PACKAGE_SECTION "Libraries") ## RPM config set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/share/man" "/usr/share/man/man1") set(CPACK_SOURCE_IGNORE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/test/;${CMAKE_CURRENT_SOURCE_DIR}/build/;${CMAKE_CURRENT_SOURCE_DIR}/.git/") if (NOT WIN32 AND NOT APPLE) set( CPACK_PACKAGE_FILE_NAME "${LIB_NAME}-${CPACK_PACKAGE_VERSION}-${BITNESS}bit" ) endif () include(CPack) # eof tidy-html5-5.2.0/README.md000066400000000000000000000004401272601517300147770ustar00rootroot00000000000000# HTML Tidy with HTML5 support All READMEs and related materials can be found in [README/][1]. For build instructions please see [README/README.md][2]. [1]: https://github.com/htacg/tidy-html5/tree/master/README [2]: https://github.com/htacg/tidy-html5/blob/master/README/README.md tidy-html5-5.2.0/README/000077500000000000000000000000001272601517300144575ustar00rootroot00000000000000tidy-html5-5.2.0/README/CODESTYLE.md000066400000000000000000000030001272601517300163250ustar00rootroot00000000000000# HTML Tidy Code Style The source code of **libTidy**, and console app **tidy**, follow the preferences of the original maintainers. Perhaps some of these decisions were arbitrary and based on their sense of aesthetics at the time, but it is good to have all the code looking the same even if it is not exactly what everyone would prefer. Developers adding code to **Tidy!** are urged to try to follow the existing code style. Code that does not follow these conventions may be accepted, but may be modified as time goes by to best fit the `Tidy Style`. There has been a suggestion of using available utilities to make the style consistent, like [Uncrusty](https://github/bengardener/uncrusty) - see [issue #245](https://github.com/htacg/tidy-html5/issues/245), and maybe others... Others have suggested the [AStyle](http://astyle.sourceforge.net/) formatting program with say '-taOHUKk3 -M8' arguments, to conform, but there are a few bugs in AStyle. But again these, and other tools, may not produce code that everybody agrees with... and are presently not formally used in Tidy! #### Known Conventions From reading of the Tidy source, some things are self evident... in no particular order... - Use of 4-space indenting, and no tabs. - No C++ single line comments using `//`. - The openning `{` is indented on the next newline. - While the maximum code line length varies, generally long `if`, `while`, ... statements are wrapped to newlines. Look forward to this document being filled out in detail... Date: 20150904 tidy-html5-5.2.0/README/CONTRIBUTING.md000066400000000000000000000065741272601517300167240ustar00rootroot00000000000000# Contributing to HTML Tidy So you want to contribute to Tidy? Fantastic! Here's a brief overview on how best to do so. ### Support request If you are having trouble running console `Tidy`, or using the `Tidy Library` API in your own project, then maybe the best places to get help is either via a comment in [Tidy Issues](https://github.com/htacg/tidy-html5/issues), or on the [Tidy Mail Archive](https://lists.w3.org/Archives/Public/html-tidy/) list. In either place please start with a short subject to describe the issue. If it involves running tidy on a html file, or an API question, make sure to include the version: `$ tidy -v`; what was the configuration used; a small sample input; the output, and the output expected; some sample code, to make quick testing easy. If you do add a sample html input, then it can also be very helpful if that sample **passes** the W3C [validation](https://validator.w3.org/#validate_by_upload)... tidy attempts to follow all current W3C standards... If you are able to build tidy from [source](https://github.com/htacg/tidy-html5), requires [CMake](https://cmake.org/download/), and can find the problem in the code, then read on about how you can create a `Pull Request`... share your code, ideas, .... ### What to change Here are some examples of things you might want to make a pull request for: - New features - Bug fixes - Inefficient blocks of code - Memory problems - Language translations If you have a more deeply-rooted problem with how the program is built or some of the stylistic decisions made in the code, it is best to [create an issue](https://github.com/htacg/tidy-html5/issues/new) before putting the effort into a pull request. The same goes for new features - it might be best to check the project's direction, existing pull requests, and currently open and closed issues first. Concerning the 'Tidy Code Style', checkout [CODESTYLE.md](CODESTYLE.md), but looking at existing code is the best way to get a good feel for the patterns we use. ### Using Git appropriately 1. Fork the repository to your GitHub account. 2. Optionally create a **topical branch** - a branch whose name is succint but explains what you're doing, such as "feature/add-new-lines"... 3. Make your changes, committing at logical breaks. 4. Push your work to your personal account. 5. [Create a pull request](https://help.github.com/articles/using-pull-requests). 6. Watch for comments or acceptance. Please note - if you want to change multiple things that don't depend on each other, it is better to use `branches`, and make sure you check the master branch back out before making more changes - that way we can take in each change seperate. Else github has a tendancy to combine your requests into one. If you are a continuing contributor then you will need to `rebase` your fork, to htacg `master`, **before** doing any more work, and likewise branches, otherwise we may not be able to cleanly merge your PR. This is a simple process - ``` $ git remote add upstream git@github.com:htacg/tidy-html5.git # once only $ git checkout master $ git status $ git stash # if not clean $ git fetch upstream $ git rebase upstream/master $ git stash pop # if required, and fix conflicts $ git push # update the fork master ``` This can be repeated for `branches`. ### Help Tidy Get Better It goes without saying **all help is appreciated**. We need to work together to make Tidy! better... tidy-html5-5.2.0/README/LICENSE.md000066400000000000000000000032071272601517300160650ustar00rootroot00000000000000# HTML Tidy ## HTML parser and pretty printer Copyright (c) 1998-2003 World Wide Web Consortium (Massachusetts Institute of Technology, European Research Consortium for Informatics and Mathematics, Keio University). All Rights Reserved. This software and documentation is provided "as is," and the copyright holders and contributing author(s) make no representations or warranties, express or implied, including but not limited to, warranties of merchantability or fitness for any particular purpose or that the use of the software or documentation will not infringe any third party patents, copyrights, trademarks or other rights. The copyright holders and contributing author(s) will not be held liable for any direct, indirect, special or consequential damages arising out of any use of the software or documentation, even if advised of the possibility of such damage. Permission is hereby granted to use, copy, modify, and distribute this source code, or portions hereof, documentation and executables, for any purpose, without fee, subject to the following restrictions: 1. The origin of this source code must not be misrepresented. 2. Altered versions must be plainly marked as such and must not be misrepresented as being the original source. 3. This Copyright notice may not be removed or altered from any source or altered source distribution. The copyright holders and contributing author(s) specifically permit, without fee, and encourage the use of this source code as a component for supporting the Hypertext Markup Language in commercial products. If you use this source code in a product, acknowledgement is not required but would be appreciated. tidy-html5-5.2.0/README/LICENSE.txt000066400000000000000000000036421272601517300163070ustar00rootroot00000000000000 Copyright (c) 1998-2015 World Wide Web Consortium (Massachusetts Institute of Technology, European Research Consortium for Informatics and Mathematics, Keio University). All Rights Reserved. Contributing Author(s): Dave Raggett The contributing author(s) would like to thank all those who helped with testing, bug fixes and suggestions for improvements. This wouldn't have been possible without your help. COPYRIGHT NOTICE: This software and documentation is provided "as is," and the copyright holders and contributing author(s) make no representations or warranties, express or implied, including but not limited to, warranties of merchantability or fitness for any particular purpose or that the use of the software or documentation will not infringe any third party patents, copyrights, trademarks or other rights. The copyright holders and contributing author(s) will not be held liable for any direct, indirect, special or consequential damages arising out of any use of the software or documentation, even if advised of the possibility of such damage. Permission is hereby granted to use, copy, modify, and distribute this source code, or portions hereof, documentation and executables, for any purpose, without fee, subject to the following restrictions: 1. The origin of this source code must not be misrepresented. 2. Altered versions must be plainly marked as such and must not be misrepresented as being the original source. 3. This Copyright notice may not be removed or altered from any source or altered source distribution. The copyright holders and contributing author(s) specifically permit, without fee, and encourage the use of this source code as a component for supporting the Hypertext Markup Language in commercial products. If you use this source code in a product, acknowledgment is not required but would be appreciated. tidy-html5-5.2.0/README/LOCALIZE.md000066400000000000000000000013671272601517300162120ustar00rootroot00000000000000# Localize HTML Tidy HTML Tidy is used worldwide but is not very friendly to non-English speakers. The latest versions of HTML Tidy and `libtidy` now support other languages and regional variations, but we need your help to make it accessible to these users by using your knowledge of other languages to make Tidy better. Help us translate HTML Tidy into another language and as part of our project team you will certainly earn the admiration of fellow Tidy users worldwide. ## How to Contribute All READMEs (including [instructions][2] on how to localize Tidy) and related materials can be found in [localize][1]. [1]: https://github.com/htacg/tidy-html5/tree/master/localize [2]:https://github.com/htacg/tidy-html5/blob/master/localize/README.md tidy-html5-5.2.0/README/OPTIONS.md000066400000000000000000000151211272601517300161340ustar00rootroot00000000000000# Tidy Config Options Tidy supports a quite large number of configuration options. The full list can be output using `-help-config`. This will show the option to be used either on the command line or in a configuration file, the type of option, and the value(s) that can be used. The current default value for each option can be seen using `-show-config`. The options can also be listed in xml format. `-xml-help` will output each option plus a description. `-xml-config` will not only output the option and a desciption, but will include the type, default and examples. These xml outputs are used, with the aid of `xsltproc` and `doxygen`, to generate the [API Documentation](http://api.html-tidy.org/). These options can also be used by application linking with **`libtidy`**. For each option there is a `TidyOptionId` enumeration in the `tidyenum.h` file, and get/set functions for each option type. This file indicates how to add a new option to tidy. Here adding an option `TidyEscapeScripts`. In essence it consists of 4 steps - 1. Add the option **`ID`** to `tidyenum.h`. 2. Add to the **`table`** `TidyOptionImpl option_defs[]` in `config.c` 3. Add the id, with a **`description`** to `language_en.h` 4. Use the option in the code. #### 1. Option ID In `tidyenum.h` the `TidyOptionId` can be in any order, but normally a new option would be added just before the last `N_TIDY_OPTIONS`, which must remain the last. Choosing the id name can be any string, but by convention it will commence with `Tidy` followed by brief descriptive like text. Naturally it can not be the same as any exisitng option. That is, it must be unique. And it will be followed by a brief descriptive special doxygen formatted comment. So for this new option I have chosen - ``` TidyEscapeScripts, /**< Escape items that look like closing tags */ ``` #### 2. Table Definition In `config.c`, added in `TidyOptionImpl option_defs[]`. Again it can be in any order, but normally a new option would be added just before the last `N_TIDY_OPTIONS`, which must remain the last. The structure definition of the table entries is simple - ``` struct _tidy_option { TidyOptionId id; TidyConfigCategory category; /* put 'em in groups */ ctmbstr name; /* property name */ TidyOptionType type; /* string, int or bool */ ulong dflt; /* default for TidyInteger and TidyBoolean */ ParseProperty* parser; /* parsing method, read-only if NULL */ const ctmbstr* pickList; /* pick list */ ctmbstr pdflt; /* default for TidyString */ }; ``` Naturally it will commence with the above chosen unique **`id`**. The **`category`** will be one of this enumeration - ``` typedef enum { TidyMarkup, /**< Markup options: (X)HTML version, etc */ TidyDiagnostics, /**< Diagnostics */ TidyPrettyPrint, /**< Output layout */ TidyEncoding, /**< Character encodings */ TidyMiscellaneous /**< File handling, message format, etc. */ } TidyConfigCategory; ``` Care, each of these enumeration strings have been equated to 2 uppercase letters. If you feel there should be another `category` or group then this can be discussed, and added. The **`name`** can be anything, but should try to be somewhat descriptive of the otpion. Again this string must be unique. It should be lowercase alphanumeric characters, and can contain a `-` separator. Remember this is the name places on the command line, or in a configuration file to set the option. The **`type`** is one of the following enumeration items - ``` typedef enum { TidyString, /**< String */ TidyInteger, /**< Integer or enumeration */ TidyBoolean /**< Boolean flag */ } TidyOptionType; ``` Care, each of these enumeration strings have been equated to 2 uppercase letters. If you feel there should be another `type` then this can be discussed, but would require other additional things. And also note the `TidyTriState` is the same as a `TidyInteger` except uses its own parser. The next item is the **`default`** value for a boolean, tristate or integer. Note tidy set `no=0` and `yes=1` as its own `Bool` enumeration. There are a number of **`parser`** for the options. Likewise a number of **`pickList`**. Find another option similar to your new option and use the same values. Presently no options have the final **`default`** string, and it is left out of the table. The compiler will add a NULL. The final table entry added. Note in here the spacing has been compressed, but in the actual code the current column settings should be maintained if possible - ``` { TidyEscapeScripts, PP, "escape-scripts", BL, yes, ParseBool, boolPicks[, NULL] }, /* 20160227 - Issue #348 */ ``` #### 3. Option Description In `language_en.h`, in the section labelled **Options Documentation**. It can be anywhere, but usually a new option would be added just before the next section labelled **Console Application**. Each entry is a structure with 3 members - ``` typedef struct languageDictionaryEntry { uint key; uint pluralForm; ctmbstr value; } languageDictionaryEntry; ``` The **`key`** is the option **`ID`**; The **`pluralForm`** is not used for options, and should be `0`; The **`value`** is the description string. Some care has to be taken with the description string. The only html allowed here is `...`, `...`, `...`, `...`, and `
`. Entities, tags, attributes, etc., should be enclosed in `...`. Option values should be enclosed in `...`. It's very important that `
` be self-closing! This string is processed to build the API documentation. This is the desription added for this new option. ``` { TidyEscapeScripts, 0, "This option causes items that look like closing tags, like </g to be " "escaped to <\\/g. Set this option to 'no' if you do not want this." }, ``` #### 4. Use in Code This can be added anywhere in the code to change the current code action. While the testing of the option depends on the option type, the most common is `cfgBool( doc, id )`. Here is an example of where this new option is used - ``` /*\ if javascript insert backslash before / * Issue #348 - Add option, escape-scripts, to skip \*/ if ((TY_(IsJavaScript)(container)) && cfgBool(doc, TidyEscapeScripts)) { ``` #### Summary That's about it. Just 4 places. Obviously the best idea it to search for an existing option **`ID`**, and follow where it is all defined and used, and copy that. It is not difficult. ; eof 20160310 tidy-html5-5.2.0/README/README.html000066400000000000000000000062521272601517300163070ustar00rootroot00000000000000 HTML Tidy with HTML5 support

HTML Tidy with HTML5 support

Prerequisites

  1. git - http://git-scm.com/book/en/v2/Getting-Started-Installing-Git

  2. cmake - http://www.cmake.org/download/

  3. appropriate build tools for the platform

CMake comes in two forms - command line and gui. Some installations only install one or the other, but sometimes both. The build commands below are only for the command line use.

Also the actual build tools vary for each platform. But that is one of the great features of cmake, it can generate variuous 'native' build files. Running cmake without any parameters will list the generators available on that platform. For sure one of the common ones is "Unix Makefiles", which needs autotools make installed, but many other generators are supported.

In windows cmake offers various versions of MSVC. Again below only the command line use of MSVC is shown, but the tidy solution (*.sln) file can be loaded into the MSVC IDE, and the building done in there.

Build the tidy library and command line tool

  1. cd build/cmake

  2. cmake ../.. [-DCMAKE_INSTALL_PREFIX=/path/for/install]

  3. Windows: cmake --build . --config Release
    Unix/OS X: make

  4. Install, if desired:
    Windows: cmake --build . --config Release --target INSTALL
    Unix/OS X: [sudo] make install

By default cmake sets the install path to /usr/local in unix. If you wanted the binary in say /usr/bin instead, then in 2. above use -DCMAKEINSTALLPREFIX=/usr

In windows the default install is to C:\Program Files\tidy5, or C:/Program Files (x86)/tidy5, which is not very useful. After the build the tidy[n].exe is in the Release directory, and can be copied to any directory in your PATH environment variable, for global use.

If you need the tidy library built as a 'shared' (DLL) library, then in 2. add the command -DBUILDSHAREDLIB:BOOL=ON. This option is OFF by default, so the static library is built and linked with the command line tool for convenience.

History

This repository should be considered canonical for HTML Tidy as of 2015-January-15.

tidy-html5-5.2.0/README/README.md000066400000000000000000000103571272601517300157440ustar00rootroot00000000000000# HTML Tidy with HTML5 support ## Prerequisites 1. git - http://git-scm.com/book/en/v2/Getting-Started-Installing-Git 2. cmake - http://www.cmake.org/download/ 3. appropriate build tools for the platform CMake comes in two forms - command line and gui. Some installations only install one or the other, but sometimes both. The build commands below are only for the command line use. Also the actual build tools vary for each platform. But that is one of the great features of cmake, it can generate variuous 'native' build files. Running cmake without any parameters will list the generators available on that platform. For sure one of the common ones is "Unix Makefiles", which needs autotools make installed, but many other generators are supported. In windows cmake offers various versions of MSVC. Again below only the command line use of MSVC is shown, but the tidy solution (*.sln) file can be loaded into the MSVC IDE, and the building done in there. ## Build the tidy library and command line tool 1. `cd build/cmake` 2. `cmake ../.. [-DCMAKE_INSTALL_PREFIX=/path/for/install]` 3. Windows: `cmake --build . --config Release` Unix/OS X: `make` 4. Install, if desired: Windows: `cmake --build . --config Release --target INSTALL` Unix/OS X: `[sudo] make install` By default cmake sets the install path to /usr/local in unix. If you wanted the binary in say /usr/bin instead, then in 2. above use -DCMAKE_INSTALL_PREFIX=/usr Also, in unix if you want to build the release library without any debug `assert` in the code then add `-DCMAKE_BUILD_TYPE=Release` in step 2. This adds a `-DNDEBUG` macro to the compile switches. This is normally added in windows build for the `Release` config. In windows the default install is to C:\Program Files\tidy5, or C:/Program Files (x86)/tidy5, which is not very useful. After the build the tidy[n].exe is in the Release directory, and can be copied to any directory in your PATH environment variable, for global use. If you do **not** need the tidy library built as a 'shared' (DLL) library, then in 2. add the command -DBUILD_SHARED_LIB:BOOL=OFF. This option is ON by default. The static library is always built and linked with the command line tool for convenience in windows, and so the binary can be run as part of the man page build without the shared library being installed in unix. ## Build PHP with the tidy-html5 library Due to API changes in the PHP source, "buffio.h" needs to be changed to "tidybuffio.h" in the file ext/tidy/tidy.c. That is - prior to configuring php run this in the php source directory: ``` sed -i 's/buffio.h/tidybuffio.h/' ext/tidy/*.c ``` And then continue with (just an example here, use your own php config options): ``` ./configure --with-tidy=/usr/local make make test make install ``` ## Important Links - site: http://www.html-tidy.org/ - source: https://github.com/htacg/tidy-html5 - binaries: http://binaries.html-tidy.org - bugs: https://github.com/htacg/tidy-html5/issues - list: https://lists.w3.org/Archives/Public/html-tidy/ - api and quickref: http://api.html-tidy.org/ ## Development The default branch of this repository is `master`. This is the development branch, hopefully always `stable` source. It will identify as library version X.odd.X. Use it to help us on the forever `bug` quest, addition of new features, options, ..., etc. However, if you seek **release** code, then do `git branch -r`, and choose one of the `release/X.even.0` branches for your build and install... This will always be the latest release branch. Important `bug` fixes thought relevant to this release, pushed back, may bump the library version to X.even.1, ..., etc, but will be remain known as `X.even`... Some more details of the `Tidy Version` can be found in [VERSION.md](VERSION.md). Concerning the `Tidy Code Style`, some notes can be found in [CODESTYLE.md](CODESTYLE.md). If you want to contribute to Tidy, then read [CONTRIBUTING.md](CONTRIBUTING.md). ## History This repository should be considered canonical for HTML Tidy as of 2015-January-15. - This repository originally transferred from [w3c.github.com/tidy-html5][1]. - First moved to Github from [tidy.sourceforge.net][2]. [1]: http://w3c.github.com/tidy-html5/ [2]: http://tidy.sourceforge.net tidy-html5-5.2.0/README/RELEASE.html000066400000000000000000001254711272601517300164370ustar00rootroot00000000000000 Release 5.2.0

Release 5.2.0

Change log for this release. List of authors

commit 0db9b32e22568921b1f596d79f5b9f2ac17c3ea5 (HEAD, refs/remotes/origin/master, refs/remotes/origin/HEAD, refs/heads/release/5.2, refs/heads/master)
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Mon Apr 4 18:14:33 2016 +0200

    Issue #390 - Bump to 5.1.52 for this indent fix

commit 61a0a331fc783898aa2dab90627b8437042efe47
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Mon Apr 4 18:02:26 2016 +0200

    Issue #390 - fix indent with --hide-endtags yes.
    
    The problem was, with --hide-endtags yes, a conditional pprint buffer
    flush had nothing to flush, thus the indent was not adjusted.
    
    To track down this bug added a lot of MSVC Debug code, but is only
    existing if some additional items defined, so has no effect on the release
    code.
    
    This, what feels like a good fix, was first reported about 12 years ago by
    @OlafvdSpek in SF Bugs 563. Hopefully finally closed.

commit 7598fdfff238e02d41706e6f264243dae3f54fcd
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Sun Apr 3 17:54:46 2016 +0200

    avoid DEBUG duplicate newline

commit 3e5e07ea1848e6abb24ab226611f29552a85593f
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Thu Mar 31 14:50:47 2016 +0200

    Issue #369 - Bump to version 5.1.51

commit 7777a71913f15a6ee0261eec3f4fd6290316a84a
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Thu Mar 31 14:50:03 2016 +0200

    Issue #369 - Remove Debug asserts

commit 086e4c948c056e45a612e9450f0599ca2789d8a6
Author: Geoff rpi McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Wed Mar 30 15:02:19 2016 +0000

    remove gcc comment warning

commit 005f36106ad7de2c5d2f600b372d819f13f51b5d
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Wed Mar 30 16:28:45 2016 +0200

    Issue #377 - Bump version to 5.1.50

commit 59d6fc7022f7fde541bdef12e68da5f75b499cdb
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Wed Mar 30 16:28:08 2016 +0200

    Issue #377 - If version XHTML5 available, return that.

commit cd08a709dbeee7a2ac66c6dab0025029e6036f6b
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Wed Mar 30 15:16:44 2016 +0200

    Some improvements in build-me.bat

commit d9ce0fc0782d72795e8295cc29c0edafd7a6fe34
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Wed Mar 30 15:01:40 2016 +0200

    Some improvements in build-me.bat

commit c19d221ddcef5469cb106fb1e497098b3bb35e89
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Wed Mar 30 14:19:07 2016 +0200

    Issue #384 - bump to 5.1.49

commit 1830fdb97cd0a2e2d1e095c3eb7aaf2fb9269227
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Wed Mar 30 14:18:04 2016 +0200

    Issue #384 - insert comments

commit 4b135d9b47a53beed36e8cfbe04a938f4f8a5e6c
Merge: aa1fc19 7d28b21
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Wed Mar 30 14:08:40 2016 +0200

    Merge pull request #384 from seaburg/master
    
    Fix skipping parsing character

commit aa1fc197d500d0a222b66a6999b50f02516c3d8b
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Sun Mar 27 19:57:41 2016 +0200

    Issue #383 - Bump to 5.1.48 on this merge

commit e87f26c247b6a854303e547372c520c38154af79
Merge: 7d2ddee 1933205
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Sun Mar 27 19:54:54 2016 +0200

    Merge pull request #388 from htacg/fr.po
    
    Merge fr.po to master

commit 193320571bfc8f2208e2ffd5557628e2e63c127e
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Sat Mar 26 20:20:42 2016 +0100

    add WIP fr.po

commit 7d2ddee775368607e4b9d2a1cff89feecc27f41c
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Thu Mar 24 11:38:04 2016 +0800

    Add new `rebase` command to CLI.
    This is intended to make it very, very easy to update the POT and all of the POs when
    changes are made to `language_en.h`. Used without an sha-1 hash, untranslated strings
    (i.e., the "source" strings) are updated in the POT/PO's.
    
    However if you specify an --sha=HASH (or -c HASH) option, then the script will use git
    to examine the `language_en.h` file from that specified commit, determing the strings
    that have changed, and mark all of these strings as `fuzzy` in the POs. This will serve
    as a flag to translators that the original has changed. In addition, this `fuzzy` flag
    will appear in the headers as "(fuzzy) " in the item comments.
    
    If a translator edits the header directly, he should remove the "(fuzzy )" in the
    comment. Then when the PO is rebuilt, the fuzzy flag will be removed automatically.
    The reverse is also true; if a translator is working with the PO, he or she should
    clear the fuzzy flag and the comment will be adjusted accordingly in the generated
    header.

commit a15f97ebcbb93ed58d51723dedb408b0078f5fe2
Merge: fb95ea2 d208222
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Thu Mar 24 14:18:06 2016 +0100

    Merge branch 'fr.po' of github.com:htacg/tidy-html5 into fr.po

commit fb95ea2ed2350a43f56cfef5c02d2d9d497a1227
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Wed Mar 23 19:53:51 2016 +0100

    Issue #383 - Bump version to 5.1.47fr

commit 8671544beb7c5164d1e6e2d0608b9c5e64331604
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Wed Mar 23 19:52:56 2016 +0100

    Issue #383 - Add a WIP language_fr.h to facilitate testing

commit 5feca8cfd6e335c5bfc7328368963ebce87dc9c6
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Wed Mar 23 19:42:03 2016 +0100

    Issue #383 - correct another byte-by-byte output to message file.
    
    As in the previous case these messages are already valid utf-8 text, and
    thus, if output on a byte-by-byte basis, must not use WriteChar, except
    for the EOL char.
    
    Of course this output can be to either a user ouput file, if configured,
    otherwise stderr.

commit ad7bdee3b96114ef963ee726fd3e50e8a9efb0f9
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Thu Mar 24 11:00:47 2016 +0800

    Added translator comments to new TidyEscapeScripts option, and updated POT and POs to reflect this.

commit a35352387348b48a5a851de237f206d9407685f8
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Thu Mar 24 10:40:21 2016 +0800

    Spaceing

commit d0ec84c169cf9eb4cb1b495a242152efcab4041d
Merge: 71d6ca1 9ecdf30
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Thu Mar 24 10:37:37 2016 +0800

    Merge branch 'master' into lang_help_enhance

commit 9ecdf3077401dddb254e0382aea78564ad5363d8
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Tue Mar 22 10:35:03 2016 +0800

    Localization fixes:
    - Correct format specifiers.
    - Fix missing trailing quote if following escaped quote. #385
    - Don't put developer comments into generated headers unless --force-comments is used.
    - Ruby 1.9.3 fix.
    - Initial fuzzy support.
    - Fix two character lang codes not working.

commit d20822230d8fe53bc2b7639f69c91c69b299d913
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Wed Mar 23 19:53:51 2016 +0100

    Issue #383 - Bump version to 5.1.47fr

commit df4174f5fa6f8585f1ece2677396039dffb86f9a
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Wed Mar 23 19:52:56 2016 +0100

    Issue #383 - Add a WIP language_fr.h to facilitate testing

commit 6cda2e02c865fdbe7e96cbcca41d4484fc15d1a4
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Wed Mar 23 19:42:03 2016 +0100

    Issue #383 - correct another byte-by-byte output to message file.
    
    As in the previous case these messages are already valid utf-8 text, and
    thus, if output on a byte-by-byte basis, must not use WriteChar, except
    for the EOL char.
    
    Of course this output can be to either a user ouput file, if configured,
    otherwise stderr.

commit 71d6ca1392eab720a7a681302062f2feca799a19
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Wed Mar 23 15:10:07 2016 +0800

    Oops. Didn't commit es changes. This fixes that.

commit d54785c933c4a5b6cc2163de036f98067f581e1a
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Wed Mar 23 14:56:36 2016 +0800

    language help enhancements:
    - Show the language Tidy is using.
    - Update the POT and POs with the modified string.
    - Regen language_es.h, which uses the string.
    
    Note that the new header uses the new commentless behavior that's still
    pending in another branch. In addition the proper c style hints have
    been added to all PO's, as their previous absense was a bug.

commit 2cf03f7fa9575ded678ec19ece8a28496c47928f
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Wed Mar 23 14:38:17 2016 +0800

    Fix two character lang codes not working.

commit ee151f07f1d241838a988c275ff6bc4df4433da7
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Wed Mar 23 13:27:17 2016 +0800

    Ruby 1.9.3 fix.

commit 39e4f16b48209cd1d18fb890c7c0ce7b6a173a16
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Tue Mar 22 11:26:32 2016 +0800

    Don't put developer comments into generated headers unless --force-comments is used.

commit 3cd1a87c44d42bd91c349e101f8399b594c21f44
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Tue Mar 22 11:01:41 2016 +0800

    Fix missing trailing quote if following escaped quote. #385

commit 91e8e6bf1e24e651633b6ee2be6ce2b9c27efd91
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Tue Mar 22 10:35:03 2016 +0800

    Correct format specifiers.

commit a5ae647ee3b41127edf55f3e99f8ee3105edb28d
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Sun Mar 20 01:05:36 2016 +0100

    Issue #348 - Add README/OTPIONS.md on adding a new option

commit 3c8d9bf3f64b57d45cef3c3e9708715eb44d85f4
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Sun Mar 20 01:03:25 2016 +0100

    Issue #348 - Bump to version 5.1.47

commit 000c6925bd1fdec0098d69d271fd0eecf60555d0
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Sun Mar 20 01:01:46 2016 +0100

    Issue #348 - Add option 'escape-script', def = yes

commit e4bf52c51619daa563b5de1701d271cd2fa24db4
Author: Geoff R. McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Sat Mar 19 19:56:27 2016 +0100

    add a rentidy.sh script to keep old versions

commit 9e28261c71d0d088a4fedc2c9540ef01e2af8834
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Sat Mar 19 19:49:58 2016 +0100

    ignore vc 2008 vcproj files

commit 8a31aad0e35c192bde6fa4c995d96b6eede7ebba
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Sat Mar 19 19:32:39 2016 +0100

    Issues #379 #380 #383 - Bump to 5.1.46 for this merge of 'issue-380'

commit 370dab3b05f1bcaabe0dd1f151a6149171b928e8
Merge: 9a9acf2 0621576
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Sat Mar 19 19:28:55 2016 +0100

    Merge pull request #382 from htacg/issue-380
    
    Merge Issue 378 and 380

commit 06215769aa297bea25fa260a70cfa39e4524fdf7
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Fri Mar 18 18:48:08 2016 +0100

    Issue #383 - Bump version 5.1.45-Exp3

commit e6f1533d896eef9cabced6e6946f7749b49b1e85
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Fri Mar 18 18:47:00 2016 +0100

    Issue #383 - Output message file text byte-by-byte

commit 7d28b21e60c3f5b4194e68d64d31cae6788bfcfc
Author: Evgeniy Yurtaev <evgeniyyurt _at_ gmail _dot_ com>
Date:   Fri Mar 18 00:25:24 2016 +0400

    Fix skipping parsing character

commit 9a9acf29cbdfdf72fc1460d7e58d05aa5e740363
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Fri Mar 11 16:39:17 2016 +0800

    Updated broken links in readme.

commit 68e69d54a02a8762831371aa453eeab198c55b37
Merge: b2c591c ca90fad
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Sun Mar 6 17:39:32 2016 +0100

    Merge branch 'master' of github.com:htacg/tidy-html5

commit 98f32ddebbe8dd172c15b7d1c82fd7b1c5583ff3
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Sun Mar 6 17:38:48 2016 +0100

    Issue #379 - Bump to version 5.1.45-Exp2

commit 8dda04f1df6a5b43664a55a8c510b3100808f99a
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Sun Mar 6 17:31:00 2016 +0100

    Issue #379 - Care about 'ix' going negative.
    
    How this lasted so long in the code is a mystery! But of course it will
    only be a read out-of-bounds if testing the first character in the lexer,
    and it is a spacey char.
    
    A big thanks to @gaa-cifasis for running ASAN tests on Tidy.

commit b83d5ffb03bbea12f442398118053839fa9cc2e0
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Sat Mar 5 17:40:32 2016 +0100

    Issue #380 - Bump to version 5.1.45-Exp1

commit 8eee85cb9e8d996d324fd54db67043305dcbbc40
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Sat Mar 5 17:39:14 2016 +0100

    Issue #380 - Experimental patch in issue-380 branch

commit b2c591c138a51b605fb5d82a02c24faf986701ed
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Fri Mar 4 19:39:21 2016 +0100

    Issue #380 - Bump version to 5.1.45
    
    Added more debug code to try to track this bug!

commit ca90fadb34d731038aaf303a9aae8947190b444a
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Fri Mar 4 19:39:21 2016 +0100

    Issue #380 - Bump version to 5.1.45
    
    Added more debug code to try to track this bug!

commit 0e6ed639d69449f16128ae2507c363a632c8c463
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Fri Mar 4 19:28:49 2016 +0100

    Issue #380 - Add more MSVC debug

commit d0910270898648ad401000550974fa6b126027a1
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Thu Mar 3 20:21:35 2016 +0100

    Issue #377 add debug only output of constrained versions

commit 1dd06aa4b2060ddedfac328b7860094850c48779
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Mon Feb 29 19:59:41 2016 +0100

    Issue #377 - Bump to 5.1.44 for this fix

commit 7bdc31af760acefbb415d1202f78837b09a26286
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Mon Feb 29 19:58:55 2016 +0100

    Issue #377 - Table summary attribute also applies to XHTML5

commit 9a80938246fabe8368a7d77819a435405fbb9555
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Mon Feb 29 18:49:52 2016 +0100

    Issue #314 - Bump to 5.1.43 for fix

commit 24c62cf0df325b1bfe0fb79c22b2191dd84b1018
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Mon Feb 29 18:49:15 2016 +0100

    Issue #314 - Avoid head warning if show-body-only

commit b41318724ced103f06ea132284166c784b2f4c15
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Wed Feb 24 19:24:46 2016 +0100

    Issue #373 - bump version to 5.1.42 for this merge of branch 373

commit 771b5607f2b229441ae7e53a0458bda557d611e3
Merge: 8c13d27 23e689d
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Wed Feb 24 19:21:26 2016 +0100

    Merge pull request #375 from htacg/issue-373
    
    Issue 373

commit 23e689d14541f906bce2197702b22e34226d7d98
Merge: 9ba80b8 9cf97d5
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Thu Feb 18 15:18:39 2016 +0100

    Issue #373 - Merge branch 'issue-373' of github.com:htacg/tidy-html5 into issue-373
    
    Conflicts: version.txt - set version 5.1.41issue-373

commit 9ba80b864e61c1df9e2ac09e4edcf78a985cd588
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Thu Feb 18 15:12:11 2016 +0100

    Issue #373 - Rebase of issue-373 branch to master
    
    Updated version.txt to 5.1.41issue-373

commit 8c13d270ede8d47b74b2373d818b2841f799ee23
Merge: b91d525 63c0327
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Thu Feb 18 13:58:23 2016 +0100

    Merge branch 'master' of github.com:htacg/tidy-html5

commit b91d52592b69a152c2d07a8e7300fc07f83c5323
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Thu Feb 18 13:57:47 2016 +0100

    Fix to K&R C to compile with MSVC

commit 63c0327de18315a74b870177b1b64b97348bb054
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Thu Feb 18 15:40:10 2016 +0800

    Fixed typo in output strings.

commit be0e5f3a8bc5ce1afd3f4ba7b7850f85153e570a
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Thu Feb 18 10:20:40 2016 +0800

    External API merits patch bump.

commit e00f419f5de36793c9587b1d7d9133c95b3edfdb
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Thu Feb 18 10:19:57 2016 +0800

    Discovered some missing strings from tidyErrorFilterKeysStruct.

commit da8205b2dc730fff8946fbec7326a7400db6bdd8
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Wed Feb 17 20:07:00 2016 +0800

    Regen'd POT, POs, and headers in order to capture documentation changes in all of them.

commit 7fbe76be0b3226fa0d85ee63af301fe15206460d
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Wed Feb 17 20:02:38 2016 +0800

    Finished semantic html.

commit a78daccd3ce2cc5803aefd8a0d09bb341215b052
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Wed Feb 17 17:43:09 2016 +0800

    Through TidyIndentSpaces.

commit a16e89c4f8e9fdfd626e09c10a8ce9fe700280b1
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Wed Feb 17 17:27:57 2016 +0800

    Updated translator comments.

commit d30c2d7747af4445752d287eec087a9dee4a4d03
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Wed Feb 17 17:20:02 2016 +0800

    XSL for man handles <var>. Updated comment and sample string.

commit f76c2615238c10051b5bb6b292833beb0a651dd1
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Wed Feb 17 15:56:21 2016 +0800

    Tidy should only generate valid XML in console output, too.

commit f62e59d813f96fa1e76dc515ed34062657dc1117
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Wed Feb 17 14:17:18 2016 +0800

    Correct CDATA declaration.

commit 6c181d5689353ff7e0d91ec259a538069c676e81
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Wed Feb 17 12:43:44 2016 +0800

    Version bump, since we changed console API a bit.

commit cc59efb23d07e79dca7f59781f230ca9a4d29d55
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Wed Feb 17 12:35:20 2016 +0800

    Add a `xml-error-strings` service to console app providing symbols developers can use with TidyErrorFilter3.

commit bc1e54d5b5d4d546c54cbce86732d991d1151f99
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Wed Feb 17 12:27:11 2016 +0800

    Externalize the TidyReportFilter3 error codes, and provide iterators to loop through them.

commit b4d2bdf3bf9c4be8b5c07e6ba34e0bb691bb6aeb
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Wed Feb 17 11:20:28 2016 +0800

    _Also_ output the raw option description in the -xml-options-strings service.
    Improve documentation.

commit 720d5c25d2f1581c4004a7b5d85e3523129f34e7
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Wed Feb 17 10:56:21 2016 +0800

    Squelch compiler warning default type.

commit 7b8019c6ef054918266937c3335e395e724ac7d8
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Tue Feb 16 11:46:20 2016 +0800

    Regenerated PO's for new strings.

commit 7246c7e3dc1cea3f224cd53fb5b4abb451c726d4
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Tue Feb 16 11:44:50 2016 +0800

    Regenered POT for new strings.

commit dc15acb0f366d3b48c07d21374cb090d804c6640
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Tue Feb 16 11:20:22 2016 +0800

    Remove /test/ from the repository. Regression testing is still very important, and so
    tests and tools will be migrated to a separate development repository.

commit 468cc02cf3289b9ad5b2716c3eabc58f33735d41
Merge: 813b126 97abad0
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Tue Feb 16 11:12:32 2016 +0800

    Merge pull request #372 from htacg/attrdict_phase2
    
    Attrdict phase2 - enforce strict tags and attributes

commit 97abad0c0554f382867e9a39e7d1e38656dbc11d
Merge: c62127b 813b126
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Tue Feb 16 11:11:36 2016 +0800

    Bump to 5.1.39 for merging.
    Merge branch 'master' into attrdict_phase2

commit 813b12640e175ba1940214005be1fc404c739c2b
Merge: a955363 3431dd0
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Tue Feb 16 11:08:53 2016 +0800

    Merge pull request #370 from htacg/attrdict_phase1
    
    Address #346 and shrink attrdict.c.

commit 3431dd05a4f5e144aa95254ad49f10aa82c20034
Merge: 7df66c4 a955363
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Tue Feb 16 11:07:32 2016 +0800

    Merge branch 'master' into attrdict_phase1
    Bump version to 5.1.38

commit 7df66c45daade612654e38b4f6652f84872de134
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Tue Feb 16 10:20:34 2016 +0800

    Update version.txt

commit a95536394d930eefb5d1c45500c664b5f39e7a2f
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Tue Feb 16 10:19:06 2016 +0800

    Bump to 5.1.37

commit 1e4f7dd0f1f2af50741a85c36e76f852e52d6901
Merge: cf1adc6 03a643f
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Tue Feb 16 10:18:26 2016 +0800

    Merge pull request #368 from htacg/issue-341
    
    Issue #341

commit cf1adc6d9d6945a4c4164931f51ec07d2113822a
Merge: a4f4255 593e1df
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Tue Feb 16 10:16:46 2016 +0800

    Merge pull request #366 from hguemar/master
    
    Fix RPM generation

commit 9cf97d536b8016121d1afb59749d95dc1a9801bc
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Mon Feb 15 12:57:22 2016 +0100

    Issue #373 - Avoid a null added to output.
    
    This bug was first openned in 2009 by Christophe Chenon, as bug sf905 but
    the patch provided then never made it into the source.
    
    Now appears fixed, 7 years later!

commit a4f425546f924a4801d1d389b8eed818324adac7
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Sun Feb 14 18:11:57 2016 +0100

    Improve MSVC DEBUG output.
    
    Previous only output the first 8 characters, followed by an elipse if more
    than 8. Now return first up to 19 chars. If nore than 19, return first 8,
    followed by an elipse, followed by the last 8 characters.
    
    This is in the get_text_string service, which is only used if MSVC and not
    NDEBUG.

commit c66bb848f232e24e10a19851264f9e4c24d2237f
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Sat Feb 13 18:34:36 2016 +0100

    Improve tidySaveString API documentation.
    
    This was suggested by Kevin Locke back in SF bug 917 Nov, 2009. Has taken
    some time to filter through!

commit c62127b9bd674eafb56412bfde44ff7c478baae3
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Sat Feb 13 12:33:02 2016 +0800

    Default to NO at this point.

commit 8b5771cf24c0a0b440588999cf6af424d18533f5
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Sat Feb 13 12:26:19 2016 +0800

    Word2000
    Added messages that would otherwise be missed in post-processing, after cleanup.

commit 2cdedb4a630f3363308286643a03aecdc5949aad
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Sat Feb 13 11:53:53 2016 +0800

    Forgot one file...

commit 896b00238b71d63f9ddb6e65b63fb1955cecd5e9
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Sat Feb 13 11:53:40 2016 +0800

    Forgot one file...

commit 2ade3357a927f5139bca62c6c62d1514f467dfad
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Sat Feb 13 11:31:16 2016 +0800

    Phase 2
    This is a MUCH SANER approach to what I was trying to do (now that I screwed up enough internals to understand some of them!
    At this point there are zero exit state reversions, and zero markup reversions! There are still 21 errout reversions; I'll
    annotate and adjust as necessary.

commit e947d296e49f9e14a2e8af8212179411a79975e1
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Fri Feb 12 20:49:14 2016 +0800

    Handle some issues with misusing VERS_HTML5 in the doctype.

commit c81a151da51d2f5ad2a0ccfe71196a3a69f3746f
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Fri Feb 12 20:46:49 2016 +0800

    Add VERS_STRICT to identify future strict document types.

commit 74604fd52b606fdbd914e9abd1588a9fe8f3b0bd
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Fri Feb 12 20:44:03 2016 +0800

    Hard-coded checks are redundant with updates to `attrdict.c`.

commit 429703dce46db84e9ff4b191f7adbe088787fa13
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Fri Feb 12 19:34:19 2016 +0800

    Because the previous effort #350 grew too fast and there was a LOT of side effects to
    my changes, I'm starting over with this. Comments in the PR thread.
    
    This commit reduces the size of attrdict.c while causing only a single errout
    regression that is justified.

commit 03a643f7815af5c3fbf572acb728fd438df60e83
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Mon Feb 8 15:12:23 2016 +0100

    Issue #341 - No token can be inserted if istacksize == 0!

commit 58229b7e2485b9d590e9289242c402f882a29b6b
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Mon Feb 8 15:10:38 2016 +0100

    Issue #341 - Bump to version 5.1.37Test for this fix

commit fbde392af3b26c44628b1f4365ee9c662d37f9db
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Fri Feb 5 14:59:12 2016 +0800

    - 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.

commit 593e1df6ec36d150030a48d6b8ebdeadd0e617fd
Author: Haikel Guemar <hguemar _at_ fedoraproject _dot_ org>
Date:   Thu Feb 4 08:40:49 2016 +0100

    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

commit 0f3cab930a3fc1b3a8eb3ff11fc584b13d37d3db
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Mon Feb 1 20:10:23 2016 +0100

    Issue #345 - bump to 5.1.36 for this fix

commit 7d0d8a853a01004572d27e47b5c1146361816271
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Mon Feb 1 20:07:55 2016 +0100

    Issue #345 - discard leading spaces in href

commit e8ca2aa5f307d8900c36747dd9588934ed1b259d
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Mon Feb 1 19:45:43 2016 +0100

    Issue #342 - bump to version 5.1.35 for this fix

commit 7f0d5c31e6b6fa9f5426a669f3fd246218f5f607
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Mon Feb 1 19:44:30 2016 +0100

    If no doctype, allow user doctype to reset table - Issue #342

commit 6abb8b7a3ce14ca5ae596ec6681055bb4634f269
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Mon Feb 1 19:27:28 2016 +0100

    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.

commit c1f94c066c9683e7bc2b05d6d60cdcaf8566b09b
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Sat Jan 30 20:47:20 2016 +0100

    Tidy up some debug only code.
    
    After @sria91 added #360 merge, added a little more improvement...

commit 328308cbb5f72ce8a93976da7527603051276dcf
Merge: 22998e8 9a0af48
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Sat Jan 30 20:31:32 2016 +0100

    Merge pull request #360 from sria91/master
    
    fixed a NULL node bug in debug build

commit 9a0af48a4e12b7bc7e81daee499ae455c6118036
Author: Srikanth Anantharam <sria91 _at_ gmail _dot_ com>
Date:   Sun Sep 13 10:32:05 2015 +0530

    fixed a NULL node bug in debug build

commit 22998e81e832b105c69d6bdba80697805ddb69bf
Merge: 7b09cae dca50d4
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Sat Jan 30 16:02:39 2016 +0800

    Merge pull request #359 from htacg/localize_rc
    
    HTML Tidy now can be localized.

commit dca50d4077bbb28778e10300eea0bbd05c8cf796
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Sat Jan 30 16:02:00 2016 +0800

    Version bump prior to rolling into master.

commit 3553cbab1f78011d95e334b76c4f1ee68c256436
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Fri Jan 29 17:27:44 2016 +0800

    One more README update.

commit 9ae15f45a7e1493dbeb7f47fcf1070f312e0313f
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Fri Jan 29 11:11:53 2016 +0800

    Consistent tabs
    
    Fixed tabs in template file, and regen'd all related files.

commit 53f2a2da2ae7fdf19198ae690514b39494cd9819
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Wed Jan 27 11:48:38 2016 +0800

    msgunfmt works properly with escaped hex.

commit 17e50f26420dfd3c892354b1aec51554b2342161
Author: Martin von Gagern <Martin _dot_ vGagern _at_ gmx _dot_ net>
Date:   Tue Jan 26 15:31:07 2016 +0100

    Encode UTF-8 strings to hex escapes in header files

commit bf70824cc27640a92f66b2d36ddc2eb71f323b3f
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Mon Jan 25 20:58:55 2016 +0800

    - Add TidyReportFilter3, which removes translation strings completely from the equation. It would be a good idea to deprecate TidyReportFilter2, which is vulnerable to changing strings in Tidy source.
    - Documentation reminders for future enum changes.
    - Documentation updates.

commit d505869910b019731c160fe3b3c944fb5026f3d6
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Fri Jan 15 12:06:15 2016 +0800

    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.

commit 7b09caee37b5e7cb64122ff09b9625d241b0d6ec
Merge: ce6c7de a81885d
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Thu Jan 21 17:05:04 2016 +0800

    Merge pull request #351 from josephgrossberg/master
    
    looks like a pre-processor left "; eof" in some of the outputted mark…

commit a81885d154165c0248d123255c327f7df410d061
Author: Joe Grossberg <josephgrossberg+github _at_ gmail _dot_ com>
Date:   Wed Jan 20 16:53:00 2016 -0800

    looks like a pre-processor left "; eof" in some of the outputted markdown files

commit ce6c7de2d9db9b47431566a22d0de84a5cd14ead
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Thu Jan 7 11:52:58 2016 +0800

    Bump version for Mac OS X Fix, addresses #339.

commit 680adfd96491ee8060b93b13ddf7c240eff1f343
Merge: 0005841 26e7d9d
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Thu Jan 7 11:51:46 2016 +0800

    Merge pull request #340 from htacg/encoding_fixes
    
    Fixes Mac OS X encoding issues and harmonizes output across platforms.

commit 26e7d9d4b04d07a5d42d549078be834c5e8be461
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Thu Dec 31 13:57:34 2015 +0800

    Fixes Mac OS X encoding issues and harmonizes output across platforms.
    Previously Tidy produced different output based on the compilation target, NOT based on
    the file encoding and specified options. Every platform was equal except Mac OS. Now unless
    the encoding is specifically set to a Mac file type, all encoding assumptions are the same
    across platforms.

commit 0005841cfeb4081e5ba2219308f70143b5c77e5f
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Wed Dec 23 00:51:01 2015 +0100

    Drop back to 2.8.7 for Travis CI use

commit 2dd699940bcf7f3592ccee625205ad3543934264
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Tue Dec 8 01:29:39 2015 +0100

    Add W3C validation for sample html

commit 99428561642b830267dad334868eacae837f2c39
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Mon Dec 7 12:42:13 2015 +0100

    Issue #308 - Bump version to 5.1.32

commit 48fbcbfa78bf9fcd595d95482cf88906a59498b2
Merge: 0c6ccd8 b206331
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Mon Dec 7 12:30:34 2015 +0100

    Merge branch 'issue-308' to fix warning and release memory (#308)

commit 0c6ccd884a531135462ba00bb29f55f3888cecef
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Sun Dec 6 18:55:03 2015 +0100

    Some additions to CONTRIBUTING.md

commit b206331c55ab1ecab5b5c55948da4667cf5d55c6
Merge: 78f2d52 885e85d
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Sat Dec 5 17:03:33 2015 +0100

    Merge branch 'issue-308' of github.com:htacg/tidy-html5 into issue-308

commit 902c961619dbc2911d1f0bcad03249e1b4deb1fe
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Sat Dec 5 17:01:31 2015 +0100

    Some updates of the README.md

commit d68e9c45d071b207af780bb7ad737d12abb05422
Merge: 59f60d1 e0fdbba
Author: Geoff R. McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Sat Dec 5 16:22:45 2015 +0100

    Merge branch 'master' of github.com:htacg/tidy-html5

commit 59f60d1a79aa92e7327d28263fd28d16af7eac21
Author: Geoff R. McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Sat Dec 5 16:22:18 2015 +0100

    update test 443576 msg

commit 78f2d52cdd3c6637d74532258f7643bdfcd6cc52
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Mon Nov 30 17:55:50 2015 +0100

    Issue #308 - remove bad warn, bad assert, and free discarded

commit e0fdbba8b062bb5c778cb8ffe90e44582ff0f28c
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Sat Dec 5 14:28:46 2015 +0100

    For test 500236 need .xml extent

commit 8f8f40fe52e38cae6bd7b929d3cbb47840748295
Author: Geoff R. McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Sat Dec 5 14:27:16 2015 +0100

    for test 500236 need .xml extent

commit 7f131d3c7906b96b324cfa7ca86aaedec64a424b
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Sat Dec 5 13:48:13 2015 +0100

    Update to new INSERTING_AUTO_ATTRIBUTE message - #324 #320

commit 5f8aac98df913a8a54986048211d81a3805cfe45
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Sat Dec 5 13:02:33 2015 +0100

    Reverted #327 bumped to 5.1.31

commit 9caecb80cf632cf0d332922e96f408ac19a09f6e
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Sat Dec 5 12:45:59 2015 +0100

    Revert "Fix for head closing tag not reported (#327)"
    
    This reverts commit 61cfcb15550bfa5b266cb238d0e34b18d810bad9.
    
    This added an inconsistent warning about a missing optional close tag. In
    general tidy does not report such optional close tags. See issue #327 for
    some discussion on this.

commit 121fe86bc636d708aabbce3a5a3ba02ba9cf9903
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Fri Dec 4 18:32:48 2015 +0100

    Issue #326 - Bump to version 5.1.30

commit e5038f0bc91dfcc45c0805ab3a95f42a9d69d341
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Fri Dec 4 18:31:24 2015 +0100

    Issue #326 - Allow linkage choice TIDY_CONSOLE_SHARED

commit 34eb16b5da5474261c6620fe135339e687951498
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Thu Dec 3 19:38:13 2015 +0100

    Merge MinGW_build branch to version 5.1.29 (#311)
    
    Added support for the __MINGW32__ macro of the MinGW (gcc) compiler.
    
    Small WIN32 code changes where some MS specific defines and API
    extensions needed to fall back to the normal API.
    
    Removed the MinGW build version extension. In distribution this is a well
    formed WIN32 app, perhaps renamed to tidy-MinGW.exe.

commit 1c6069ae9901cfee742fd4728000c80b5f1e255d
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Thu Dec 3 19:36:24 2015 +0100

    Remove MinGW compile rc (#311)

commit 3b13cd8076b87fbd745899c3a1be813f04e2b0a0
Merge: b2c8060 77e053d
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Thu Dec 3 19:18:07 2015 +0100

    Merge branch 'mingw-build'

commit 885e85d0a24689968e3dafe36ea0df0e294caa2a
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Mon Nov 30 17:55:50 2015 +0100

    Issue #308 - remove bad warn, bad assert, and free discarded

commit b2c806063a343f8ad80d514ebb74a8f8db34714d
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Sun Nov 29 13:03:05 2015 +0100

    Kick '5' off name

commit 4c848c57bc8da6e274a413b102926429b7d0636b
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Sun Nov 29 13:24:01 2015 +0800

    Bumped version.

commit 61cfcb15550bfa5b266cb238d0e34b18d810bad9
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Sun Nov 29 13:21:49 2015 +0800

    Fix for head closing tag not reported (#327)

commit 3708d429bcacb67ec27904a07b814f6225c117d9
Merge: dd4eb46 8737941
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Sun Nov 29 12:48:22 2015 +0800

    Merge pull request #325 from htacg/progress_callback
    
    Progress callback

commit 873794162ae45356e77a2dce5a3fd2079faad9dc
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Sun Nov 29 07:39:33 2015 +0800

    Callback added to XML printer, too; fixed off-by-one error.

commit 77e053d582e5ea6cba64fe959f70e4c0ab3d612c
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Sat Nov 28 15:25:24 2015 +0100

    Issue #311 - Add MinGW to the version

commit dc969f30d5321f249eef7929d020e4543f8d8a81
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Sat Nov 28 15:14:53 2015 +0100

    Issue #311 - small changes for MinGW32 build

commit 3b8ad7482e34a2dc109e9df34c8d0a38b3909db0
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Sat Nov 28 16:02:35 2015 +0800

    This is probably best as void.

commit 4adc07fd659ec0d40864b04a94d85dd542d0e5d0
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Sat Nov 28 15:43:34 2015 +0800

    Removed the one callback per line filter. Library user can filter this himself.

commit dcd8f16f7318debea87ce666d4dde7d61eaa96e0
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Sat Nov 28 15:34:23 2015 +0800

    Tidying progress callback implemented.

commit 34d456aa80cffea38d7b5819653a3471adb28006
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Sat Nov 28 14:16:17 2015 +0800

    Make pretty printer keep track of line numbers as it prints.

commit dd4eb46bb320c6ab06b75d28961f9f78c80f6702
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Fri Nov 27 09:50:33 2015 +0800

    Make the new README less annoying.

commit 501c3fb6166c4d0b6065f16e772c7d5d0f192cd1
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Fri Nov 27 09:47:09 2015 +0800

    Version bump given the different output now produced.

commit 3a3836618b98e49e62fe0ee75d5d7dadeb132ead
Merge: c65cf43 9834cc1
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Fri Nov 27 09:46:17 2015 +0800

    Merge pull request #324 from htacg/fix_img_alt
    
    - Addresses #320

commit 9834cc17ad9ba3ea3973cba198dcc8003a96dd08
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Fri Nov 27 09:45:26 2015 +0800

    Style cleanup for previous commit.

commit 1c963acb58f5ed755940d923e9326dfd53406eec
Merge: 933fc3d c65cf43
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Fri Nov 27 09:36:32 2015 +0800

    Merge branch 'master' into fix_img_alt

commit c65cf430613b8df21a21c73b10e18f944b73d440
Merge: db4f647 6323473
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Fri Nov 27 09:04:19 2015 +0800

    Merge pull request #323 from htacg/squelch_null_prefix
    
    Allows null value css-prefix to be used in a config file without issu…

commit 933fc3d236cd870ec3cd638e91eea69b47a76d47
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Thu Nov 26 13:23:43 2015 +0800

    - Addresses #320
    - Different error output depending on whether or not the `alt-text` option was given a value.

commit 63234735d880e699104272a00d5767f743fb6e65
Author: Jim Derry <balthisar _at_ gmail _dot_ com>
Date:   Thu Nov 26 11:21:48 2015 +0800

    Allows null value css-prefix to be used in a config file without issuing a warning.

commit db4f6473ed70d55fb1f375d8b18040254aad4aec
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Thu Nov 26 00:58:07 2015 +0100

    Issue #321 - bump v 5.1.27 for #322 PR - thanks

commit 2522730e3c5886422fd929074d0514fbfabfe3be
Merge: 0ef4493 71d9638
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Thu Nov 26 00:54:55 2015 +0100

    Merge pull request #322 from benkasminbullock/master
    
    Don't push back non-A tokens.

commit 71d963844897a6864097d4bc36501a97ff314e40
Author: Ben Bullock <benkasminbullock _at_ gmail _dot_ com>
Date:   Wed Nov 25 18:00:45 2015 +0900

    Don't push back non-A tokens.

commit 0ef4493ae8bdc4b8fec125fecf4e1dcc95c30fb1
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Tue Nov 24 19:29:52 2015 +0100

    Issue #319 - bump to 5.1.26 for merge of buffer fix

commit b8e4f6e21eb153f4be8bfbae9551f68d5780fba1
Merge: f567088 1ef5ba7
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Tue Nov 24 19:21:28 2015 +0100

    Merge pull request #319 from CMB/memfix
    
    Fix a tiny buffer overflow.

commit 1ef5ba796882fe9f68254dfb79f995d9c29cfe85
Author: Christopher Brannon <chris _at_ the-brannons _dot_ com>
Date:   Mon Nov 23 12:28:00 2015 -0800

    Fix a tiny buffer overflow.

commit f567088a68b0be91c31640c9c5904082a500444f (tag: refs/tags/5.1.25)
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Mon Nov 23 16:07:04 2015 +0100

    Update verhist.log to 5.1.25

commit b58aa1c26a24609e05881639d540d422a40f09e6
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Sun Nov 22 20:43:12 2015 +0100

    Issue #307 - add a ref link in comments

commit 2388fb017565bf09b65a400175de800154909955
Author: Geoff McLane <ubuntu _at_ geoffair _dot_ info>
Date:   Sun Nov 22 18:46:00 2015 +0100

    Issue #307, #167, #169 - regression of nestd anchors

This log has 177 commits by 10 authors: Joe Grossberg 1; Evgeniy Yurtaev 1; Geoff R. McLane 93; Jim Derry 76; Haikel Guemar 1; Martin von Gagern 1; Christopher Brannon 1; Srikanth Anantharam 1; Ben Bullock 1; Geoff rpi McLane 1;

Date: from Sun Sep 13 10:32:05 2015 +0530 to Mon Apr 4 18:14:33 2016 +0200 (204 days)

eof top

tidy-html5-5.2.0/README/VERSION.md000066400000000000000000000056731272601517300161410ustar00rootroot00000000000000# Tidy Library Versioning The **libTidy** version is controlled by the contents of `version.txt` in the root. This file consists of two lines of dot (.) separated items. The first being the MAJOR, MINOR, and PATCH version values, and the second string is a date. Example - ``` 5.1.8 2015.09.04 ``` When cmake is run this file is read and two MACROS added to the compile flags - ``` add_definitions ( -DLIBTIDY_VERSION="${LIBTIDY_VERSION}" ) add_definitions ( -DRELEASE_DATE="${tidy_YEAR}/${tidy_MONTH}/${tidy_DAY}" ) ``` And in CMakeLists.txt there is the posibility to define another MACRO, when and if required - ``` # add_definitions ( -DRC_NUMBER="D231" ) ``` These MACROS are put in static const char strings in **libTidy's** `internal` only src/version.h file - ``` static const char TY_(release_date)[] = RELEASE_DATE; #ifdef RC_NUMBER static const char TY_(library_version)[] = LIBTIDY_VERSION "." RC_NUMBER; #else static const char TY_(library_version)[] = LIBTIDY_VERSION; #endif ``` These strings are returned respectively by the **libTidy** API functions - ``` TIDY_EXPORT ctmbstr TIDY_CALL tidyLibraryVersion(void); TIDY_EXPORT ctmbstr TIDY_CALL tidyReleaseDate(void); ``` **NOTE**: `tidyReleaseDate()` is marked deprecated! The actual `versioning` of the library more or less follows the [Semantic Versioning](http://semver.org/) style. When a `release` is done a release/5.0.0 **branch**, and a similar release/5.0.0 **tag** is created. At that point the version.txt is set to the next, 5.1.0. That is the `master` branch will contain the ongoing development. Any subsequent good bug fixes found for some time after that will be carefully tested and push back (cherry picked I think is the correct term) into the release/5.0.0, making it 5.0.1... And on just about each fix, or feature addition to the `master` will bump the version to 5.1.1, 5.1.2, 5.1.3, and so on... even 5.1.4567 if necessary ;=)). When ready for the next release, say some 6 months or so later, then a branch `release/5.2.0` would be created, and tagged, and the master version.txt moved on to 5.3.0, and so on... That is, each `release` will have an `even` second digit, followed by .0, unless any subsequent fixes are pushed back, making it .1, ... probably not many of those... while the `master` develoment HEAD will have an `odd` second digit, followed by .0, incremented for just about each significant code change... The intial MAJOR digit, 5, will be maintained while the **libTidy** API remains fully compatible, although there may be additions, extensions, as and when these are identified... And throughout this, every effort will be made to keep `master` **stable** at all times, but would expect package managers to eventually really only pick up on the `release` branches, tags. In cases of significant code re-writes, major featues added, these would be done in branches until they are `stable` enought, and tested enough, to be merge back to `master`. Date: 20150904 tidy-html5-5.2.0/README/verhist.log000066400000000000000000000141661272601517300166560ustar00rootroot00000000000000# Version history at 2016/04/07 5.1.52 0db9b32e22 Geoff McLane Mon Apr 4 18:14:33 2016 +0200 5.1.51 3e5e07ea18 Geoff McLane Thu Mar 31 14:50:47 2016 +0200 5.1.50 005f36106a Geoff McLane Wed Mar 30 16:28:45 2016 +0200 5.1.49 c19d221ddc Geoff McLane Wed Mar 30 14:19:07 2016 +0200 5.1.48 aa1fc197d5 Geoff McLane Sun Mar 27 19:57:41 2016 +0200 5.1.47fr fb95ea2ed2 Geoff McLane Wed Mar 23 19:53:51 2016 +0100 5.1.47 3c8d9bf3f6 Geoff McLane Sun Mar 20 01:03:25 2016 +0100 5.1.46 8a31aad0e3 Geoff McLane Sat Mar 19 19:32:39 2016 +0100 5.1.45-Exp3 06215769aa Geoff McLane Fri Mar 18 18:48:08 2016 +0100 5.1.45-Exp2 98f32ddebb Geoff McLane Sun Mar 6 17:38:48 2016 +0100 5.1.45-Exp1 b83d5ffb03 Geoff McLane Sat Mar 5 17:40:32 2016 +0100 5.1.45 b2c591c138 Geoff McLane Fri Mar 4 19:39:21 2016 +0100 5.1.44 1dd06aa4b2 Geoff McLane Mon Feb 29 19:59:41 2016 +0100 5.1.43 9a80938246 Geoff McLane Mon Feb 29 18:49:52 2016 +0100 5.1.42 b41318724c Geoff McLane Wed Feb 24 19:24:46 2016 +0100 5.1.41issue-373 9ba80b864e Geoff McLane Thu Feb 18 15:12:11 2016 +0100 5.1.41 be0e5f3a8b Jim Derry Thu Feb 18 10:20:40 2016 +0800 5.1.40 6c181d5689 Jim Derry Wed Feb 17 12:43:44 2016 +0800 5.1.40 97abad0c05 Jim Derry Tue Feb 16 11:11:36 2016 +0800 5.1.38 7df66c45da Jim Derry Tue Feb 16 10:20:34 2016 +0800 5.1.36_attr_phase2 2ade3357a9 Jim Derry Sat Feb 13 11:31:16 2016 +0800 5.1.36_attr_phase1 429703dce4 Jim Derry Fri Feb 12 19:34:19 2016 +0800 5.1.36 0f3cab930a Geoff McLane Mon Feb 1 20:10:23 2016 +0100 5.1.35 e8ca2aa5f3 Geoff McLane Mon Feb 1 19:45:43 2016 +0100 5.1.34 dca50d4077 Jim Derry Sat Jan 30 16:02:00 2016 +0800 5.1.33localizing d505869910 Jim Derry Fri Jan 15 12:06:15 2016 +0800 5.1.33 ce6c7de2d9 Jim Derry Thu Jan 7 11:52:58 2016 +0800 5.1.32 9942856164 Geoff McLane Mon Dec 7 12:42:13 2015 +0100 5.1.31 5f8aac98df Geoff McLane Sat Dec 5 13:02:33 2015 +0100 5.1.30 121fe86bc6 Geoff McLane Fri Dec 4 18:32:48 2015 +0100 5.1.29 34eb16b5da Geoff McLane Thu Dec 3 19:38:13 2015 +0100 5.1.28 4c848c57bc Jim Derry Sun Nov 29 13:24:01 2015 +0800 5.1.28 501c3fb616 Jim Derry Fri Nov 27 09:47:09 2015 +0800 5.1.27 db4f6473ed Geoff McLane Thu Nov 26 00:58:07 2015 +0100 5.1.26 0ef4493ae8 Geoff McLane Tue Nov 24 19:29:52 2015 +0100 5.1.25 2388fb0175 Geoff McLane Sun Nov 22 18:46:00 2015 +0100 5.1.24 496c81c48d Geoff McLane Wed Nov 18 20:02:54 2015 +0100 5.1.23 06e4311189 Geoff McLane Wed Nov 18 17:08:26 2015 +0100 5.1.22 15563fff51 Geoff McLane Mon Nov 16 18:55:20 2015 +0100 5.1.21 c9699d3820 Geoff McLane Sat Nov 14 15:24:19 2015 +0100 5.1.20 e5703803c8 Geoff McLane Thu Nov 5 15:22:21 2015 +0100 5.1.19 9f9ca4c774 Jim Derry Thu Nov 5 09:38:01 2015 +0800 5.1.18 02909b5fe3 Jim Derry Tue Nov 3 11:37:28 2015 +0800 5.1.17 67c86cbe7f Geoff McLane Wed Oct 28 16:11:24 2015 +0100 5.1.16 ba1f1e00be Geoff McLane Tue Oct 20 15:06:05 2015 +0200 5.1.15 a94df6c0f9 Geoff McLane Wed Oct 14 16:57:41 2015 +0200 5.1.14 fa43957b6d Geoff McLane Sun Sep 27 17:38:08 2015 +0200 5.1.13 7cf9fc2906 Geoff McLane Fri Sep 25 13:00:06 2015 +0200 5.1.12 f4113a8643 Geoff McLane Mon Sep 21 12:34:29 2015 +0200 5.1.11 b2118fa09a Geoff McLane Sat Sep 19 14:59:58 2015 +0200 5.1.10 d541405a2a Geoff McLane Wed Sep 16 13:17:50 2015 +0200 5.1.9 1c187f8179 Geoff McLane Thu Sep 10 15:02:38 2015 +0200 5.1.8 87e0e11b49 Geoff McLane Fri Sep 4 15:03:08 2015 +0200 5.1.7 fd056e353b Geoff McLane Sat Aug 22 14:04:38 2015 +0200 5.1.6 5380eb0413 Geoff McLane Sat Aug 22 14:00:56 2015 +0200 5.1.6 1d67dc940a Geoff McLane Mon Aug 10 18:42:58 2015 +0200 5.1.4 4e7c52607c Geoff McLane Fri Jul 31 13:44:46 2015 +0200 5.1.3 6a24f50466 Geoff McLane Thu Jul 30 14:52:07 2015 +0200 5.1.2 750f31704b Geoff McLane Fri Jul 17 19:16:04 2015 +0200 5.1.2 33494a4aea Geoff McLane Tue Jul 14 11:27:15 2015 +0200 5.1.1 7f9df1c746 Geoff McLane Mon Jul 13 12:18:10 2015 +0200 5.1.0 2da67a2bbc Geoff McLane Mon Jul 13 02:08:37 2015 +0200 5.0.0 1e70fc6f15 Geoff McLane Tue Jun 30 19:59:00 2015 +0200 4.9.37 daef037156 Geoff McLane Wed Jun 24 13:12:31 2015 +0200 4.9.36 b65988c95a Geoff McLane Sun Jun 21 19:50:56 2015 +0200 4.9.35 7b7fbce9ab Geoff McLane Tue Jun 9 12:32:26 2015 +0200 4.9.34 bea5bb700f Geoff McLane Mon Jun 8 13:53:38 2015 +0200 4.9.33 f67300963e Geoff McLane Sat Jun 6 11:06:37 2015 +0200 4.9.32 544f9876cc Geoff McLane Thu Jun 4 13:21:00 2015 +0200 4.9.31 0c96ed8af4 Geoff McLane Wed Jun 3 20:27:01 2015 +0200 4.9.30 dde78c2dbf Geoff McLane Sun May 24 15:23:59 2015 +0200 4.9.29 3686bc5390 Geoff McLane Fri May 22 16:22:27 2015 +0200 4.9.28wt 3f33ba2d88 Geoff McLane Fri May 15 16:17:46 2015 +0200 4.9.28 1c9970deb4 Geoff McLane Wed May 13 12:37:20 2015 +0200 4.9.27 d8a4498803 Geoff McLane Tue May 12 13:18:16 2015 +0200 4.9.26 6b66b65ec8 Geoff McLane Wed Apr 22 21:27:23 2015 +0200 4.9.25 f5eb2cf26a Geoff McLane Sat Apr 11 15:22:55 2015 +0200 4.9.24 ca06201c3a Geoff McLane Wed Apr 8 18:47:08 2015 +0200 4.9.23 3585d4c31a Geoff McLane Thu Mar 19 19:14:27 2015 +0100 4.9.22 47df5fddbc Geoff McLane Thu Mar 19 16:32:19 2015 +0100 4.9.21 09fa036b31 Geoff McLane Fri Mar 13 19:48:31 2015 +0100 4.9.20 90c9e81ba1 Geoff McLane Fri Mar 6 19:14:24 2015 +0100 4.9.19 7ffcce2241 Geoff McLane Fri Mar 6 13:09:12 2015 +0100 4.9.18 2e383c6029 Geoff McLane Sat Feb 28 20:32:38 2015 +0100 4.9.17 a9361a1c5b Geoff McLane Tue Feb 24 17:53:58 2015 +0100 4.9.16 25d38e1dcf Geoff McLane Tue Feb 24 15:07:36 2015 +0100 4.9.15 7bf364624f Geoff McLane Thu Feb 12 15:38:06 2015 +0100 4.9.14 8b362b5f37 Geoff McLane Tue Feb 10 15:30:35 2015 +0100 4.9.13 97470ce459 Geoff McLane Sat Feb 7 13:57:31 2015 +0100 4.9.12 0cf21fb559 Geoff McLane Sat Feb 7 13:43:09 2015 +0100 4.9.11 bef3b08c18 Geoff McLane Fri Feb 6 19:26:45 2015 +0100 4.9.10 906d858f9e Geoff McLane Thu Feb 5 19:03:25 2015 +0100 4.9.9 383a901990 Geoff McLane Thu Feb 5 12:22:14 2015 +0100 4.9.8 5f470763c5 Geoff McLane Tue Feb 3 13:39:51 2015 +0100 4.9.7 d38c5c5d78 Geoff McLane Mon Feb 2 17:37:49 2015 +0100 4.9.6 201f3cb49e Geoff McLane Sun Feb 1 18:36:30 2015 +0100 4.9.5 8497326dc3 Geoff McLane Sun Feb 1 16:08:31 2015 +0100 4.9.4 22a3924484 Geoff McLane Sun Feb 1 14:39:51 2015 +0100 4.9.3 de97628f8f Jim Derry Sun Feb 1 14:20:41 2015 +0800 4.9.3 362c71ee2e Jim Derry Sat Jan 31 18:11:26 2015 +0800 4.9.2 e2cbd9e89f Geoff McLane Thu Jan 29 18:25:57 2015 +0100 # eof tidy-html5-5.2.0/build/000077500000000000000000000000001272601517300146215ustar00rootroot00000000000000tidy-html5-5.2.0/build/cmake/000077500000000000000000000000001272601517300157015ustar00rootroot00000000000000tidy-html5-5.2.0/build/cmake/.gitignore000066400000000000000000000004471272601517300176760ustar00rootroot00000000000000*.vcxproj *.filters CMakeCache.txt CMakeFiles/* Debug/* Release/* Win32/* bldlog-1.txt *.cmake *.dir/ *.sln temp* *.opensdf ipch/* Makefile tab2space tidy5 libtidy5* install_manifest.txt test71 _CPack_Packages/* *.deb *.rpm *.xml *.1 *.exe *.msi *.zip *.wixobj tidy libtidy* tidy1.xsl *.vcproj tidy-html5-5.2.0/build/cmake/build-api.sh000077500000000000000000000033571272601517300201160ustar00rootroot00000000000000#!/bin/sh #< build-api.sh - 20151020 - build the API documentation for publishing... BN=`basename $0` TMPSRC="../.." TMPFIL="$TMPSRC/version.txt" if [ ! -f "$TMPFIL" ]; then echo "Can NOT locate $TMPFIL! *** FIX ME ***" exit 1 fi echo "$BN: Read file $TMPFIL" ls -l $TMPFIL TMPCNT=0 while read LINE; do if [ "$TMPCNT" = "0" ]; then TMPVER="$LINE" fi TMPCNT=`expr $TMPCNT + 1` done <$TMPFIL #TMPVER=$(<$TMPFIL) #TMPVER=$(cat $TMPFIL) echo "$BN: Version $TMPVER" TMPZIP="tidylib_api-$TMPVER.zip" ask() { pause if [ ! "$?" = "0" ]; then exit 1 fi } TMPDIR="../../documentation/temp" TMPZFIL="../../documentation/$TMPZIP" if [ -f "$TMPZFIL" ]; then ls -l $TMPZFIL echo "$BN: WARNING: Current ZIP will be overwritten!" echo "$BN: DO you want to coninue?" ask fi TMPFIL="build-me.sh" if [ ! -x "$TMPFIL" ]; then echo "$BN: Can NOT locate '$TMPFIL'! *** FIX ME ***" echo "$BN: This is a simple build script, that accepts parameters..." exit 1 fi if [ -d "$TMPDIR" ]; then echo "$BN: Directory '$TMPDIR' will be deleted prior the documentaion build..." fi ./$TMPFIL -DBUILD_DOCUMENTATION:BOOL=YES if [ ! "$?" = "0" ]; then echo "$BN: The running of $TMPFIL failed! ????" exit 1 fi if [ -d "$TMPDIR" ]; then echo "$BN: Deleting '$TMPDIR'..." cd $TMPDIR rm -rf * cd - fi echo "$BN: Doing 'make documentation'..." make documentation if [ -d "$TMPDIR" ]; then echo "$BN: Generated a new '$TMPDIR'..." if [ -f "$TMPZFIL" ]; then rm -fv $TMPZFIL fi cd $TMPDIR echo "$BN: Generating ../$TMPZIP..." zip -r ../$TMPZIP * >/dev/null ls -l ../$TMPZIP cd - else echo "$BN: WARNING '$TMPDIR' not generated!" exit 1 fi exit 0 # eof tidy-html5-5.2.0/build/cmake/build-bins.bat000066400000000000000000000000751272601517300204230ustar00rootroot00000000000000@setlocal cmake --build . --config Release --target PACKAGE tidy-html5-5.2.0/build/cmake/build-me.bat000066400000000000000000000073461272601517300201010ustar00rootroot00000000000000@setlocal @set TMPVER=1 @set TMPPRJ=tidy @set TMPSRC=..\.. @set TMPBGN=%TIME% @set TMPINS=..\..\..\software @set TMPLOG=bldlog-1.txt @set DOPAUSE=1 @set TMPOPTS=-DCMAKE_INSTALL_PREFIX=%TMPINS% @set TMPOPTS=%TMPOPTS% -DBUILD_SHARED_LIB=ON :RPT @if "%~1x" == "x" goto GOTCMD @if "%~1x" == "NOPAUSEx" ( @set DOPAUSE=0 ) else ( @set TMPOPTS=%TMPOPTS% %1 ) @shift @goto RPT :GOTCMD @call chkmsvc %TMPPRJ% @call chkbranch master @echo Build %DATE% %TIME% > %TMPLOG% @if NOT EXIST %TMPSRC%\nul goto NOSRC @echo Build source %TMPSRC%... all output to build log %TMPLOG% @echo Build source %TMPSRC%... all output to build log %TMPLOG% >> %TMPLOG% @if EXIST build-cmake.bat ( @call build-cmake >> %TMPLOG% ) @if NOT EXIST %TMPSRC%\CMakeLists.txt goto NOCM @echo Doing: 'cmake %TMPSRC% %TMPOPTS%' @echo Doing: 'cmake %TMPSRC% %TMPOPTS%' >> %TMPLOG% 2>&1 @cmake %TMPSRC% %TMPOPTS% >> %TMPLOG% 2>&1 @if ERRORLEVEL 1 goto ERR1 @echo Doing: 'cmake --build . --config Debug' @echo Doing: 'cmake --build . --config Debug' >> %TMPLOG% 2>&1 @cmake --build . --config Debug >> %TMPLOG% 2>&1 @if ERRORLEVEL 1 goto ERR2 @echo Doing: 'cmake --build . --config Release' @echo Doing: 'cmake --build . --config Release' >> %TMPLOG% 2>&1 @cmake --build . --config Release >> %TMPLOG% 2>&1 @if ERRORLEVEL 1 goto ERR3 @fa4 "***" %TMPLOG% @call elapsed %TMPBGN% @echo Appears a successful build... see %TMPLOG% @echo Note install location %TMPINS% @echo. @REM ############################################## @REM Check if should continue with install @REM ############################################## @if "%DOPAUSE%x" == "0x" goto DOINST @choice /? >nul 2>&1 @if ERRORLEVEL 1 goto NOCHOICE @choice /D N /T 10 /M "Pausing for 10 seconds. Def=N" @if ERRORLEVEL 2 goto GOTNO @goto DOINST :NOCHOICE @echo Appears OS does not have the 'choice' command! @ask *** CONTINUE with install? *** Only y continues @if ERRORLEVEL 2 goto NOASK @if ERRORLEVEL 1 goto DOINST @echo Skipping install to %TMPINST% at this time... @echo. @goto END :NOASK @echo 'ask' utility not found in path... @echo. @echo *** CONTINUE with install? *** Only Ctrl+c aborts... @echo. @pause :DOINST @echo Proceeding with INSTALL... @echo. @echo Doing: 'cmake --build . --config Debug --target INSTALL' @echo Doing: 'cmake --build . --config Debug --target INSTALL' >> %TMPLOG% 2>&1 @cmake --build . --config Debug --target INSTALL >> %TMPLOG% 2>&1 @if ERRORLEVEL 1 goto ERR4 @echo Doing: 'cmake --build . --config Release --target INSTALL' @echo Doing: 'cmake --build . --config Release --target INSTALL' >> %TMPLOG% 2>&1 @cmake --build . --config Release --target INSTALL >> %TMPLOG% 2>&1 @if ERRORLEVEL 1 goto ERR5 @fa4 " -- " %TMPLOG% @call elapsed %TMPBGN% @echo All done... see %TMPLOG% @goto END :GOTNO @echo. @echo No install at this time, but there may be an updexe.bat to copy the EXE to c:\MDOS... @echo. @goto END :NOSRC @echo Can NOT locate source %TMPSRC%! *** FIX ME *** @echo Can NOT locate source %TMPSRC%! *** FIX ME *** >> %TMPLOG% @goto ISERR :NOCM @echo Can NOT locate %TMPSRC%\CMakeLists.txt! @echo Can NOT locate %TMPSRC%\CMakeLists.txt! >> %TMPLOG% @goto ISERR :ERR1 @echo cmake configuration or generations ERROR @echo cmake configuration or generations ERROR >> %TMPLOG% @goto ISERR :ERR2 @echo ERROR: Cmake build Debug FAILED! @echo ERROR: Cmake build Debug FAILED! >> %TMPLOG% @goto ISERR :ERR3 @echo ERROR: Cmake build Release FAILED! @echo ERROR: Cmake build Release FAILED! >> %TMPLOG% @goto ISERR :ERR4 @echo ERROR: Install Debug FAILED! @echo ERROR: Install Debug FAILED! >> %TMPLOG% @goto ISERR :ERR5 @echo ERROR: Install Release FAILED! @echo ERROR: Install Release FAILED! >> %TMPLOG% @goto ISERR :ISERR @echo See %TMPLOG% for details... @endlocal @exit /b 1 :END @endlocal @exit /b 0 @REM eof tidy-html5-5.2.0/build/cmake/build-me.sh000077500000000000000000000034631272601517300177440ustar00rootroot00000000000000#!/bin/sh #< build-me.sh - 20150212 - 20140804 BN=`basename $0` TMPSRC="../.." BLDLOG="bldlog-1.txt" wait_for_input() { if [ "$#" -gt "0" ] ; then echo "$1" fi echo -n "Enter y to continue : " read char if [ "$char" = "y" -o "$char" = "Y" ] then echo "Got $char ... continuing ..." else if [ "$char" = "" ] ; then echo "Aborting ... no input!" else echo "Aborting ... got $char!" fi exit 1 fi # exit 0 } if [ -f "$BLDLOG" ]; then rm -f $BLDLOG fi BLDDBG=0 TMPOPTS="" ############################################## ### ***** NOTE THIS INSTALL LOCATION ***** ### ### Change to suit your taste, environment ### TMPINST="/usr" TMPOPTS="$TMPOPTS -DCMAKE_INSTALL_PREFIX=$TMPINST" ############################################## ### Accept user argument for arg in $@; do case $arg in VERBOSE) TMPOPTS="$TMPOPTS -DCMAKE_VERBOSE_MAKEFILE=ON" ;; DEBUG) BLDDBG=1 ;; SHARED) TMPOPTS="$TMPOPTS -DBUILD_SHARED_LIB:BOOL=TRUE" ;; *) TMPOPTS="$TMPOPTS $arg" ;; esac done if [ "$BLDDBG" = "1" ]; then TMPOPTS="$TMPOPTS -DCMAKE_BUILD_TYPE=Debug -DENABLE_DEBUG_SYMBOLS:BOOL=TRUE" else TMPOPTS="$TMPOPTS -DCMAKE_BUILD_TYPE=Release" fi echo "$BN: Will do: 'cmake $TMPSRC $TMPOPTS' to $BLDLOG" wait_for_input echo "$BN: Doing: 'cmake $TMPSRC $TMPOPTS' to $BLDLOG" cmake $TMPSRC $TMPOPTS >> $BLDLOG 2>&1 if [ ! "$?" = "0" ]; then echo "$BN: cmake confiuration, generation error" exit 1 fi echo "$BN: Doing: 'make' to $BLDLOG" make >> $BLDLOG 2>&1 if [ ! "$?" = "0" ]; then echo "$BN: make error - see $BLDLOG for details" exit 1 fi echo "" echo "$BN: appears a successful build... see $BLDLOG for details" echo "" echo "$BN: Time for '[sudo] make install' IFF desired..." echo "" # eof tidy-html5-5.2.0/build/cmake/cmake-clean.sh000077500000000000000000000005431272601517300204020ustar00rootroot00000000000000#!/bin/sh #< cmake-clean.sh for tidy - remove tidylib... FILES="libtidy*" TMPCNT=0 for f in $FILES; do TMPCNT=`expr $TMPCNT + 1` echo "$TMPCNT: File $f" done echo "Will delete the above $TMPCNT files ater a 5 seconds sleep!" sleep 5 echo "Deleting the above $TMPCNT files!" for f in $FILES; do rm -fv $f done echo "all done..." # eof tidy-html5-5.2.0/build/cmake/cmake-clean.txt000066400000000000000000000006321272601517300206030ustar00rootroot00000000000000bldlog-1.txt libtidy5.a libtidys.a tab2space tidy5 libtidy5s.a libtidy5.so libtidy5.so.5 libtidy5.so.5.0.0 install_manifest.txt tidy-help.xml tidy-config.xml CPackConfig.cmake _CPack_Packages CPackSourceConfig.cmake tidy5-4.9.20-64bit.deb tidy5-4.9.20-64bit.rpm tidy5.1 directories.wixobj features.wixobj files.wixobj main.wixobj tidy libtidy.so libtidy.so.5 libtidy.so.5.0.0 tidy.1 _CPack_Packages tidy1.xsl tidy-html5-5.2.0/build/cmake/pub-bins.bat000066400000000000000000000044301272601517300201110ustar00rootroot00000000000000@setlocal @set TMPWV=win32 @set TMPSRC=../.. @set TMPNAME=tidy @set TMPFIL=%TMPSRC%\version.txt @if NOT EXIST %TMPFIL% goto NOFIL @set /p TMPVER=<%TMPFIL% @set DOPAUSE=pause @echo Version %TMPVER% @set TMPBIN=F:\Projects\tidy-bins @set TMPBINS=%TMPBIN%\binaries @if NOT EXIST %TMPBINS%\nul goto NOBIN @set TMPDD=%TMPBINS%\tidy-%TMPVER% @if EXIST %TMPDD%\nul goto GOTDST @echo. @echo This is a NEW installation in %TMPDD% :GOTDST @if "%1x" == "NOPAUSEx" ( @set DOPAUSE=echo No pause requested... ) @echo Will publish... @set TMPCNT=0 @set TMPFIL1=%TMPNAME%-%TMPVER%-%TMPWV%.exe @set TMPFIL2=%TMPNAME%-%TMPVER%-%TMPWV%.msi @set TMPFIL3=%TMPNAME%-%TMPVER%-%TMPWV%.zip @if EXIST %TMPFIL1% ( @echo %TMPFIL1% @set /A TMPCNT+=1 ) @if EXIST %TMPFIL2% ( @echo %TMPFIL2% @set /A TMPCNT+=1 ) @if EXIST %TMPFIL3% ( @echo %TMPFIL3% @set /A TMPCNT+=1 ) @if "%TMPCNT%x" == "0x" goto NOPUB @echo. @echo Will publish %TMPCNT% files to %TMPDD% @echo. @echo *** CONTINUE?% @%DOPAUSE% @if NOT EXIST %TMPDD%\nul ( @md %TMPDD% @if NOT EXIST %TMPDD%\nul goto NODST ) @if EXIST %TMPFIL1% ( @set TMPSRC=%TMPFIL1% @set TMPDST=%TMPDD%\%TMPFIL1% @call :CHKCOPY ) @if EXIST %TMPFIL2% ( @set TMPSRC=%TMPFIL2% @set TMPDST=%TMPDD%\%TMPFIL2% @call :CHKCOPY ) @if EXIST %TMPFIL3% ( @set TMPSRC=%TMPFIL3% @set TMPDST=%TMPDD%\%TMPFIL3% @call :CHKCOPY ) @echo. @echo If done all bins, WIN32, WIN64, linux, ... maybe time to run 'gentidyyml %TMPBIN%' @echo. @goto END :CHKCOPY @if NOT EXIST %TMPDST% goto DOCOPY @echo Current destination %TMPDST% @call dirmin %TMPDST% @REM Compare @fc4 -q -v0 -b %TMPSRC% %TMPDST% >nul @if ERRORLEVEL 2 goto NOFC4 @if ERRORLEVEL 1 goto DOCOPY @echo. @echo Files are the SAME... Nothing done... @echo. @goto :EOF :NOFC4 @echo Can NOT run fc4! so doing copy... :DOCOPY copy %TMPSRC% %TMPDST% @if NOT EXIST %TMPDST% goto ERR3 @call dirmin %TMPDST% @echo. @echo Done file update... @echo. @goto :EOF :NODST @echo Error: Unable to create %TMPDD% @goto END :NOPUB @echo Appears no files to PUBLISH! :NOFIL1 @echo Can NOT locate %TMPFIL1%! *** FIX ME *** :NOFIL2 @echo Can NOT locate %TMPFIL2%! *** FIX ME *** :NOFIL3 @echo Can NOT locate %TMPFIL3%! *** FIX ME *** @goto END :NOFIL @echo Can NOT locate %TMPFIL%! *** FIX ME *** @goto END :NOBIN @echo Can NOT locate %TMPBINS%! *** FIX ME *** @goto END :END @REM eof tidy-html5-5.2.0/build/cmake/pub-bins.sh000077500000000000000000000037111272601517300177610ustar00rootroot00000000000000#!/bin/sh #< pub-bins.sh - copy binaries to repo for update BN=`basename $0` TMPWV="64bit" TMPSRC="../.." TMPFIL="$TMPSRC/version.txt" if [ ! -f "$TMPFIL" ]; then echo "Can NOT locate $TMPFIL! *** FIX ME ***" exit 1 fi echo "$BN: Read file $TMPFIL" ls -l $TMPFIL TMPCNT=0 while read LINE; do if [ "$TMPCNT" = "0" ]; then TMPVER="$LINE" fi TMPCNT=`expr $TMPCNT + 1` done <$TMPFIL #TMPVER=$(<$TMPFIL) #TMPVER=$(cat $TMPFIL) echo "$BN: Version $TMPVER" ask() { pause if [ ! "$?" = "0" ]; then exit 1 fi } TMPBIN="$HOME/projects/html_tidy/binaries" TMPBINS="$TMPBIN/binaries" if [ ! -d "$TMPBINS" ]; then echo "$BN: Can NOT location '$TMPBINS'! *** FIX ME ***" exit 1 fi TMPDD="$TMPBINS/tidy-$TMPVER" echo "" if [ -d "$TMPDD" ]; then echo "$BN: Destination is $TMPDD" else echo "$BN: This is a NEW installation in $TMPDD" fi TMPFIL1="tidy-$TMPVER-$TMPWV.deb" TMPFIL2="tidy-$TMPVER-$TMPWV.rpm" if [ ! -f "$TMPFIL1" ]; then echo "$BN: $TMPFIL1 does not exits" echo "$BN: Have you run '[sudo] make package'?" exit 1 fi if [ ! -f "$TMPFIL2" ]; then echo "$BN: $TMPFIL2 does not exits" echo "$BN: Have you run '[sudo] make package'?" exit 1 fi echo "" echo "$BN: Will publish..." echo "$TMPFIL1" echo "$TMPFIL2" if [ ! -d "$TMPDD" ]; then echo "$BN: Will create dir $TMPDD" else echo "$BN: Destination $TMPDD" fi echo "" echo "$BN: *** CONTINUE? ***" ask if [ ! -d "$TMPDD" ]; then mkdir $TMPDD if [ ! -d "$TMPDD" ]; then echo "$BN: Failed to create folder $TMPDD" exit 1 fi fi TMPSRC="$TMPFIL1" TMPDST="$TMPDD/$TMPFIL1" echo "$BN: Copying $TMPSRC to $TMPDST" cp -u -v $TMPSRC $TMPDST if [ ! -f "$TMPDST" ]; then echo "$BN: Copy $TMPSRC FAILED!" exit 1 fi TMPSRC="$TMPFIL2" TMPDST="$TMPDD/$TMPFIL2" echo "$BN: Copying $TMPSRC to $TMPDST" cp -u -v $TMPSRC $TMPDST if [ ! -f "$TMPDST" ]; then echo "$BN: Copy $TMPSRC FAILED!" exit 1 fi # @REM eof tidy-html5-5.2.0/build/cmake/rentidy.sh000077500000000000000000000011151272601517300177140ustar00rootroot00000000000000#!/bin/sh #< rentidy.sh - 20160201 BN=`basename $0` ask() { pause if [ ! "$?" = "0" ]; then exit 1 fi } TMPEXE="/usr/bin/tidy" if [ ! -f "$TMPEXE" ]; then echo "$BN: Can not locate '$TMPEXE'" exit 1 fi # tidy -v $TMPEXE -v if [ ! "$?" = "0" ]; then echo "$BN: Can not run $TMPEXE!" exit 1 fi TMPVER=`$TMPEXE -v | awk '{ print $6 }'` # echo "$BN: Version $TMPVER" TMPFIL2="$TMPEXE-$TMPVER" if [ -f "$TMPFIL2" ]; then echo "$BN: New name already exists!" exit 1 fi echo "$BN: Rename $TMPEXE to $TMPFIL2?" ask sudo mv $TMPEXE $TMPFIL2 # eof tidy-html5-5.2.0/build/cmake/updexe.bat000066400000000000000000000020021272601517300176550ustar00rootroot00000000000000@setlocal @REM copy the EXE into C:\MDOS, IFF changed @set TMPDIR=C:\MDOS @set TMPFIL1=tidy.exe @set TMPFIL2=tidy32.exe @set TMPSRC=Release\%TMPFIL1% @if NOT EXIST %TMPSRC% goto ERR1 @echo Current source %TMPSRC% @call dirmin %TMPSRC% @if NOT EXIST %TMPDIR%\nul goto ERR2 @set TMPDST=%TMPDIR%\%TMPFIL2% @if NOT EXIST %TMPDST% goto DOCOPY @echo Current destination %TMPDST% @call dirmin %TMPDST% @REM Compare @fc4 -q -v0 -b %TMPSRC% %TMPDST% >nul @if ERRORLEVEL 2 goto NOFC4 @if ERRORLEVEL 1 goto DOCOPY @echo. @echo Files are the SAME... Nothing done... @echo. @goto END :NOFC4 @echo Can NOT run fc4! so doing copy... :DOCOPY copy %TMPSRC% %TMPDST% @if NOT EXIST %TMPDST% goto ERR3 @call dirmin %TMPDST% @echo Done file update... @goto END :ERR1 @echo Source %TMPSRC% does NOT exist! Has it been built? *** FIX ME *** @goto ISERR :ERR2 @echo Destination %TMPDIR% does NOT exist! @goto ISERR :ERR3 @echo Copy of %TMPSRC% to %TMPDST% FAILED! @goto ISERR :ISERR @endlocal @exit /b 1 :END @endlocal @exit /b 0 @REM eof tidy-html5-5.2.0/build/win64/000077500000000000000000000000001272601517300155705ustar00rootroot00000000000000tidy-html5-5.2.0/build/win64/.gitignore000066400000000000000000000003701272601517300175600ustar00rootroot00000000000000*.vcxproj *.filters CMakeCache.txt CMakeFiles/* Debug/* Release/* bldlog-1.txt cmake_install.cmake *.dir/* *.sln x64/* ipch/* *.opensdf CPackConfig.cmake CPackSourceConfig.cmake *.wixobj install_manifest.txt *.zip *.exe *.msi _CPack_Packages/* dir tidy-html5-5.2.0/build/win64/build-bins.bat000066400000000000000000000000751272601517300203120ustar00rootroot00000000000000@setlocal cmake --build . --config Release --target PACKAGE tidy-html5-5.2.0/build/win64/build-me.bat000066400000000000000000000112331272601517300177560ustar00rootroot00000000000000@setlocal @REM 20160324 - Change to relative, and use choice @set TMPPRJ=tidy @echo Build %TMPPRJ% project, in 64-bits @set TMPLOG=bldlog-1.txt @set BLDDIR=%CD% @set TMPROOT=..\..\.. @set SET_BAT=%ProgramFiles(x86)%\Microsoft Visual Studio 10.0\VC\vcvarsall.bat @if NOT EXIST "%SET_BAT%" goto NOBAT @REM if NOT EXIST %TMPROOT%\nul goto NOROOT @set TMPSRC=..\.. @if NOT EXIST %TMPSRC%\CMakeLists.txt goto NOCM @set DOPAUSE=1 @if /I "%PROCESSOR_ARCHITECTURE%" EQU "AMD64" ( @set TMPINST=%TMPROOT%\software.x64 ) ELSE ( @if /I "%PROCESSOR_ARCHITECTURE%" EQU "x86_64" ( @set TMPINST=%TMPROOT%\software.x64 ) ELSE ( @echo ERROR: Appears 64-bit is NOT available... aborting... @goto ISERR ) ) @if NOT EXIST %TMPINST%\nul goto NOINST @echo Doing build output to %TMPLOG% @echo Doing build output to %TMPLOG% > %TMPLOG% @echo Doing: 'call "%SET_BAT%" %PROCESSOR_ARCHITECTURE%' @echo Doing: 'call "%SET_BAT%" %PROCESSOR_ARCHITECTURE%' >> %TMPLOG% @call "%SET_BAT%" %PROCESSOR_ARCHITECTURE% >> %TMPLOG% 2>&1 @if ERRORLEVEL 1 goto ERR0 @REM call setupqt64 @cd %BLDDIR% @REM :DNARCH @REM ############################################ @REM NOTE: SPECIAL INSTALL LOCATION @REM Adjust to suit your environment @REM ########################################## @REM set TMPINST=F:\Projects\software.x64 @set TMPOPTS=-DCMAKE_INSTALL_PREFIX=%TMPINST% @set TMPOPTS=%TMPOPTS% -G "Visual Studio 10 Win64" @REM set TMPOPTS=%TMPOPTS% -DTIDY_CONFIG_FILE="C:\MDOS\tidy5.cfg" @REM set TMPOPTS=%TMPOPTS% -DTIDY_USER_CONFIG_FILE="C:\MDOS\tidy5.cfg" @set TMPOPTS=%TMPOPTS% -DBUILD_SHARED_LIB:BOOL=OFF :RPT @if "%~1x" == "x" goto GOTCMD @if "%~1x" == "NOPAUSEx" ( @set DOPAUSE=0 ) else ( @set TMPOPTS=%TMPOPTS% %1 ) @shift @goto RPT :GOTCMD @call chkmsvc %TMPPRJ% @echo Begin %DATE% %TIME%, output to %TMPLOG% @echo Begin %DATE% %TIME% >> %TMPLOG% @echo Doing: 'cmake %TMPSRC% %TMPOPTS%' @echo Doing: 'cmake %TMPSRC% %TMPOPTS%' >> %TMPLOG% @cmake %TMPSRC% %TMPOPTS% >> %TMPLOG% 2>&1 @if ERRORLEVEL 1 goto ERR1 @echo Doing: 'cmake --build . --config debug' @echo Doing: 'cmake --build . --config debug' >> %TMPLOG% @cmake --build . --config debug >> %TMPLOG% @if ERRORLEVEL 1 goto ERR2 @echo Doing: 'cmake --build . --config release' @echo Doing: 'cmake --build . --config release' >> %TMPLOG% @cmake --build . --config release >> %TMPLOG% 2>&1 @if ERRORLEVEL 1 goto ERR3 :DNREL @echo Appears a successful build @echo Note install location %TMPINST% @echo. @REM ############################################## @REM Check if should continue with install @REM ############################################## @if "%DOPAUSE%x" == "0x" goto DOINST @choice /? >nul 2>&1 @if ERRORLEVEL 1 goto NOCHOICE @choice /D N /T 10 /M "Pausing for 10 seconds. Def=N" @if ERRORLEVEL 2 goto GOTNO @goto DOINST :NOCHOICE @echo Appears OS does not have the 'choice' command! @ask *** CONTINUE with install? *** Only y continues @if ERRORLEVEL 2 goto NOASK @if ERRORLEVEL 1 goto DOINST @echo Skipping install to %TMPINST% at this time... @echo. @goto END :NOASK @echo 'ask' utility not found in path... @echo. @echo *** CONTINUE with install? *** Only Ctrl+c aborts... @echo. @pause :DOINST @echo Proceeding with INSTALL... @echo. @REM cmake -P cmake_install.cmake @echo Doing: 'cmake --build . --config debug --target INSTALL' @echo Doing: 'cmake --build . --config debug --target INSTALL' >> %TMPLOG% @cmake --build . --config debug --target INSTALL >> %TMPLOG% 2>&1 @echo Doing: 'cmake --build . --config release --target INSTALL' @echo Doing: 'cmake --build . --config release --target INSTALL' >> %TMPLOG% @cmake --build . --config release --target INSTALL >> %TMPLOG% 2>&1 @fa4 " -- " %TMPLOG% @echo Done build and install of %TMPPRJ%... @goto END :GOTNO @echo. @echo No install at this time, but there may be an updexe.bat to copy the EXE to c:\MDOS... @echo. @goto END :NOBAT @echo Can NOT locate MSVC setup batch "%SET_BAT%"! *** FIX ME *** @goto ISERR @REM :NOROOT @REM @echo Can NOT locate %TMPROOT%! *** FIX ME *** @REM @goto ISERR :NOCM @echo Can NOT locate %TMPSRC%\CMakeLists.txt! *** FIX ME *** @goto ISERR :NOINST @echo Can NOT locate directory %TMPINST%! *** FIX ME *** @goto ISERR :ERR0 @echo MSVC 10 setup error @goto ISERR :ERR1 @echo cmake config, generation error @goto ISERR :ERR2 @echo debug build error @goto ISERR :ERR3 @fa4 "mt.exe : general error c101008d:" %TMPLOG% >nul @if ERRORLEVEL 1 goto ERR32 :ERR33 @echo release build error @goto ISERR :ERR32 @echo Stupid error... trying again... @echo Doing: 'cmake --build . --config release' @echo Doing: 'cmake --build . --config release' >> %TMPLOG% @cmake --build . --config release >> %TMPLOG% 2>&1 @if ERRORLEVEL 1 goto ERR33 @goto DNREL :ISERR @endlocal @exit /b 1 :END @endlocal @exit /b 0 @REM eof tidy-html5-5.2.0/build/win64/cmake-clean.txt000066400000000000000000000003651272601517300204750ustar00rootroot00000000000000bldlog-1.txt CPackConfig.cmake CPackSourceConfig.cmake directories.wixobj features.wixobj files.wixobj install_manifest.txt main.wixobj Tidy5-4.9.23-Source.zip Tidy5-4.9.23-win64.exe Tidy5-4.9.23-win64.msi Tidy5-4.9.23-win64.zip _CPack_Packages tidy-html5-5.2.0/build/win64/pub-bins.bat000066400000000000000000000044301272601517300200000ustar00rootroot00000000000000@setlocal @set TMPWV=win64 @set TMPSRC=../.. @set TMPNAME=tidy @set TMPFIL=%TMPSRC%\version.txt @if NOT EXIST %TMPFIL% goto NOFIL @set /p TMPVER=<%TMPFIL% @set DOPAUSE=pause @echo Version %TMPVER% @set TMPBIN=F:\Projects\tidy-bins @set TMPBINS=%TMPBIN%\binaries @if NOT EXIST %TMPBINS%\nul goto NOBIN @set TMPDD=%TMPBINS%\tidy-%TMPVER% @if EXIST %TMPDD%\nul goto GOTDST @echo. @echo This is a NEW installation in %TMPDD% :GOTDST @if "%1x" == "NOPAUSEx" ( @set DOPAUSE=echo No pause requested... ) @echo Will publish... @set TMPCNT=0 @set TMPFIL1=%TMPNAME%-%TMPVER%-%TMPWV%.exe @set TMPFIL2=%TMPNAME%-%TMPVER%-%TMPWV%.msi @set TMPFIL3=%TMPNAME%-%TMPVER%-%TMPWV%.zip @if EXIST %TMPFIL1% ( @echo %TMPFIL1% @set /A TMPCNT+=1 ) @if EXIST %TMPFIL2% ( @echo %TMPFIL2% @set /A TMPCNT+=1 ) @if EXIST %TMPFIL3% ( @echo %TMPFIL3% @set /A TMPCNT+=1 ) @if "%TMPCNT%x" == "0x" goto NOPUB @echo. @echo Will publish %TMPCNT% files to %TMPDD% @echo. @echo *** CONTINUE?% @%DOPAUSE% @if NOT EXIST %TMPDD%\nul ( @md %TMPDD% @if NOT EXIST %TMPDD%\nul goto NODST ) @if EXIST %TMPFIL1% ( @set TMPSRC=%TMPFIL1% @set TMPDST=%TMPDD%\%TMPFIL1% @call :CHKCOPY ) @if EXIST %TMPFIL2% ( @set TMPSRC=%TMPFIL2% @set TMPDST=%TMPDD%\%TMPFIL2% @call :CHKCOPY ) @if EXIST %TMPFIL3% ( @set TMPSRC=%TMPFIL3% @set TMPDST=%TMPDD%\%TMPFIL3% @call :CHKCOPY ) @echo. @echo If done all bins, WIN32, WIN64, linux, ... maybe time to run 'gentidyyml %TMPBIN%' @echo. @goto END :CHKCOPY @if NOT EXIST %TMPDST% goto DOCOPY @echo Current destination %TMPDST% @call dirmin %TMPDST% @REM Compare @fc4 -q -v0 -b %TMPSRC% %TMPDST% >nul @if ERRORLEVEL 2 goto NOFC4 @if ERRORLEVEL 1 goto DOCOPY @echo. @echo Files are the SAME... Nothing done... @echo. @goto :EOF :NOFC4 @echo Can NOT run fc4! so doing copy... :DOCOPY copy %TMPSRC% %TMPDST% @if NOT EXIST %TMPDST% goto ERR3 @call dirmin %TMPDST% @echo. @echo Done file update... @echo. @goto :EOF :NODST @echo Error: Unable to create %TMPDD% @goto END :NOPUB @echo Appears no files to PUBLISH! :NOFIL1 @echo Can NOT locate %TMPFIL1%! *** FIX ME *** :NOFIL2 @echo Can NOT locate %TMPFIL2%! *** FIX ME *** :NOFIL3 @echo Can NOT locate %TMPFIL3%! *** FIX ME *** @goto END :NOFIL @echo Can NOT locate %TMPFIL%! *** FIX ME *** @goto END :NOBIN @echo Can NOT locate %TMPBINS%! *** FIX ME *** @goto END :END @REM eof tidy-html5-5.2.0/build/win64/updexe.bat000066400000000000000000000024711272601517300175560ustar00rootroot00000000000000@setlocal @REM copy the EXE into C:\MDOS, IFF changed @set TMPDIR=C:\MDOS @REM v5.0.0 @set TMPFIL1=tidy.exe @set TMPFIL2=tidy5.exe @set TMPSRC=Release\%TMPFIL1% @if NOT EXIST %TMPSRC% goto ERR1 @echo Current source %TMPSRC% @call dirmin %TMPSRC% @if NOT EXIST %TMPDIR%\nul goto ERR2 @set TMPDST=%TMPDIR%\%TMPFIL2% @call :CHKCOPY @set TMPFIL1=tidyd.exe @set TMPFIL2=tidy5d.exe @set TMPSRC=Debug\%TMPFIL1% @if NOT EXIST %TMPSRC% goto ERR1 @echo Current source %TMPSRC% @call dirmin %TMPSRC% @if NOT EXIST %TMPDIR%\nul goto ERR2 @set TMPDST=%TMPDIR%\%TMPFIL2% @call :CHKCOPY @goto END :CHKCOPY @if NOT EXIST %TMPDST% goto DOCOPY @echo Current destination %TMPDST% @call dirmin %TMPDST% @REM Compare @fc4 -q -v0 -b %TMPSRC% %TMPDST% >nul @if ERRORLEVEL 2 goto NOFC4 @if ERRORLEVEL 1 goto DOCOPY @echo. @echo Files are the SAME... Nothing done... @echo. @goto :EOF :NOFC4 @echo Can NOT run fc4! so doing copy... :DOCOPY copy %TMPSRC% %TMPDST% @if NOT EXIST %TMPDST% goto ERR3 @call dirmin %TMPDST% @echo. @echo Done file update... @echo. @goto :EOF :ERR1 @echo Source %TMPSRC% does NOT exist! Has it been built? *** FIX ME *** @goto ISERR :ERR2 @echo Destination %TMPDIR% does NOT exist! @goto ISERR :ERR3 @echo Copy of %TMPSRC% to %TMPDST% FAILED! @goto ISERR :ISERR @endlocal @exit /b 1 :END @endlocal @exit /b 0 @REM eof tidy-html5-5.2.0/console/000077500000000000000000000000001272601517300151645ustar00rootroot00000000000000tidy-html5-5.2.0/console/tab2space.c000066400000000000000000000163541272601517300172050ustar00rootroot00000000000000#include #include #include #include "tidyplatform.h" #define true 1 #define false 0 #define TABSIZE 4 #define DOS_CRLF 0 #define UNIX_LF 1 #define MAC_CR 2 typedef struct { Bool pushed; int tabs; int curcol; int lastcol; int maxcol; int curline; int pushed_char; uint size; uint length; char *buf; FILE *fp; } Stream; static int tabsize = TABSIZE; static int endline = DOS_CRLF; static Bool tabs = false; /* Memory allocation functions vary from one environment to the next, and experience shows that wrapping the local mechanisms up provides for greater flexibility and allows out of memory conditions to be detected in one place. */ void *MemAlloc(size_t size) { void *p; p = malloc(size); if (!p) { fprintf(stderr, "***** Out of memory! *****\n"); exit(1); } return p; } void *MemRealloc(void *old, size_t size) { void *p; p = realloc(old, size); if (!p) { fprintf(stderr, "***** Out of memory! *****\n"); return NULL; } return p; } void MemFree(void *p) { free(p); p = NULL; } static Stream *NewStream(FILE *fp) { Stream *in; in = (Stream *)MemAlloc(sizeof(Stream)); memset(in, 0, sizeof(Stream)); in->fp = fp; return in; } static void FreeStream(Stream *in) { if (in->buf) MemFree(in->buf); MemFree(in); } static void AddByte(Stream *in, uint c) { if (in->size + 1 >= in->length) { while (in->size + 1 >= in->length) { if (in->length == 0) in->length = 8192; else in->length = in->length * 2; } in->buf = (char *)MemRealloc(in->buf, in->length*sizeof(char)); } in->buf[in->size++] = (char)c; in->buf[in->size] = '\0'; /* debug */ } /* Read a character from a stream, keeping track of lines, columns etc. This is used for parsing markup and plain text etc. A single level pushback is allowed with UngetChar(c, in). Returns EndOfStream if there's nothing more to read. */ static int ReadChar(Stream *in) { int c; if (in->pushed) { in->pushed = false; if (in->pushed_char == '\n') in->curline--; return in->pushed_char; } in->lastcol = in->curcol; /* expanding tab ? */ if (in->tabs > 0) { in->curcol++; in->tabs--; return ' '; } /* Else go on with normal buffer: */ for (;;) { c = getc(in->fp); /* end of file? */ if (c == EOF) break; /* coerce \r\n and isolated \r as equivalent to \n : */ if (c == '\r') { c = getc(in->fp); if (c != '\n') ungetc(c, in->fp); c = '\n'; } if (c == '\n') { if (in->maxcol < in->curcol) in->maxcol = in->curcol; in->curcol = 1; in->curline++; break; } if (c == '\t') { if (tabs) in->curcol += tabsize - ((in->curcol - 1) % tabsize); else /* expand to spaces */ { in->tabs = tabsize - ((in->curcol - 1) % tabsize) - 1; in->curcol++; c = ' '; } break; } if (c == '\033') break; /* strip control characters including '\r' */ if (0 < c && c < 32) continue; in->curcol++; break; } return c; } static Stream *ReadFile(FILE *fin) { int c; Stream *in = NewStream(fin); while ((c = ReadChar(in)) >= 0) AddByte(in, (uint)c); return in; } static void WriteFile(Stream *in, FILE *fout) { int i, c; char *p; i = in->size; p = in->buf; while (i--) { c = *p++; if (c == '\n') { if (endline == DOS_CRLF) { putc('\r', fout); putc('\n', fout); } else if (endline == UNIX_LF) putc('\n', fout); else if (endline == MAC_CR) putc('\r', fout); continue; } putc(c, fout); } } static void HelpText(FILE *errout, char *prog) { fprintf(errout, "%s: [options] [infile [outfile]] ...\n", prog); fprintf(errout, "Utility to expand tabs and ensure consistent line endings\n"); fprintf(errout, "options for tab2space vers: 6th February 2003\n"); fprintf(errout, " -help or -h display this help message\n"); fprintf(errout, " -dos or -crlf set line ends to CRLF (PC-DOS/Windows - default)\n"); fprintf(errout, " -mac or -cr set line ends to CR (classic Mac OS)\n"); fprintf(errout, " -unix or -lf set line ends to LF (Unix)\n"); fprintf(errout, " -tabs preserve tabs, e.g. for Makefile\n"); fprintf(errout, " -t set tabs to (default is 4) spaces\n"); fprintf(errout, "\nNote this utility doesn't map spaces to tabs!\n"); } int main(int argc, char **argv) { char const *infile, *outfile; char *prog; FILE *fin, *fout; Stream *in = NULL; prog = argv[0]; while (argc > 0) { if (argc > 1 && argv[1][0] == '-') { if (strcmp(argv[1], "-help") == 0 || argv[1][1] == 'h') { HelpText(stdout, prog); return 1; } if (strcmp(argv[1], "-dos") == 0 || strcmp(argv[1], "-crlf") == 0) endline = DOS_CRLF; else if (strcmp(argv[1], "-mac") == 0 || strcmp(argv[1], "-cr") == 0) endline = MAC_CR; else if (strcmp(argv[1], "-unix") == 0 || strcmp(argv[1], "-lf") == 0) endline = UNIX_LF; else if (strcmp(argv[1], "-tabs") == 0) tabs = true; else if (strncmp(argv[1], "-t", 2) == 0) sscanf(argv[1]+2, "%d", &tabsize); --argc; ++argv; continue; } if (argc > 1) { infile = argv[1]; fin = fopen(infile, "rb"); } else { infile = "stdin"; fin = stdin; } if (argc > 2) { outfile = argv[2]; fout = NULL; --argc; ++argv; } else { outfile = "stdout"; fout = stdout; } if (fin) { in = ReadFile(fin); if (fin != stdin) fclose(fin); if (fout != stdout) fout = fopen(outfile, "wb"); if (fout) { WriteFile(in, fout); if (fout != stdout) fclose(fout); } else fprintf(stderr, "%s - can't open \"%s\" for writing\n", prog, outfile); FreeStream(in); } else fprintf(stderr, "%s - can't open \"%s\" for reading\n", prog, infile); --argc; ++argv; if (argc <= 1) break; } return 0; } tidy-html5-5.2.0/console/test71.cxx000066400000000000000000000023301272601517300170350ustar00rootroot00000000000000/*\ * 20150206 - Test app for Issue #71 * * A simple API example of getting the body text, first as html, * and then as a raw stream. * * Note: This simple test app has no error checking * \*/ #include #include "tidybuffio.h" #include "tidy.h" static const char *sample = "\n" "\n" "\n" "Test app for Issue #71\n" "something & escaped\n" ""; int main() { printf("\nSimple example of HTML Tidy API use.\n"); TidyDoc tdoc = tidyCreate(); TidyBuffer buff; tidyBufInit(&buff); tidyBufAppend(&buff, (void *)sample, strlen(sample)); tidyParseBuffer(tdoc, &buff); TidyNode body = tidyGetBody(tdoc); TidyNode text_node = tidyGetChild(body); TidyBuffer buff2; tidyBufInit(&buff2); printf("This is the 'escaped' text, from tidyNodeGetText(...), suitable for html use...\n"); tidyNodeGetText(tdoc, text_node, &buff2); fwrite(buff2.bp, buff2.size, 1, stdout); printf("This is the 'raw' lexer values, from tidyNodeGetValue(...).\n"); tidyNodeGetValue(tdoc, text_node, &buff2); fwrite(buff2.bp, buff2.size, 1, stdout); printf("\n"); return 0; } // eof tidy-html5-5.2.0/console/tidy.c000066400000000000000000001711551272601517300163130ustar00rootroot00000000000000/* tidy.c - HTML TidyLib command line driver Copyright (c) 1998-2008 World Wide Web Consortium (Massachusetts Institute of Technology, European Research Consortium for Informatics and Mathematics, Keio University). All Rights Reserved. */ #include "tidy.h" #include "language.h" #include "locale.h" #if defined(_WIN32) #include /* Force console to UTF8. */ #endif #if !defined(NDEBUG) && defined(_MSC_VER) #include "sprtf.h" #endif #ifndef SPRTF #define SPRTF printf #endif static FILE* errout = NULL; /* set to stderr */ /* static FILE* txtout = NULL; */ /* set to stdout */ #if defined(_WIN32) static uint win_cp; /* original Windows code page */ #endif /** ** Indicates whether or not two filenames are the same. */ static Bool samefile( ctmbstr filename1, ctmbstr filename2 ) { #if FILENAMES_CASE_SENSITIVE return ( strcmp( filename1, filename2 ) == 0 ); #else return ( strcasecmp( filename1, filename2 ) == 0 ); #endif } /** ** Handles exit cleanup. */ static void tidy_cleanup() { #if defined(_WIN32) /* Restore original Windows code page. */ SetConsoleOutputCP(win_cp); #endif } /** ** Exits with an error in the event of an out of memory condition. */ static void outOfMemory(void) { fprintf(stderr, "%s", tidyLocalizedString(TC_STRING_OUT_OF_MEMORY)); exit(1); } /** ** Used by `print2Columns` and `print3Columns` to manage whitespace. */ static const char *cutToWhiteSpace(const char *s, uint offset, char *sbuf) { if (!s) { sbuf[0] = '\0'; return NULL; } else if (strlen(s) <= offset) { strcpy(sbuf,s); sbuf[offset] = '\0'; return NULL; } else { uint j, l, n; /* scan forward looking for newline */ j = 0; while(j < offset && s[j] != '\n') ++j; if ( j == offset ) { /* scan backward looking for first space */ j = offset; while(j && s[j] != ' ') --j; l = j; n = j+1; /* no white space */ if (j==0) { l = offset; n = offset; } } else { l = j; n = j+1; } strncpy(sbuf,s,l); sbuf[l] = '\0'; return s+n; } } /** ** Outputs one column of text. */ static void print1Column( const char* fmt, uint l1, const char *c1 ) { const char *pc1=c1; char *c1buf = (char *)malloc(l1+1); if (!c1buf) outOfMemory(); do { pc1 = cutToWhiteSpace(pc1, l1, c1buf); printf(fmt, c1buf[0] !='\0' ? c1buf : ""); } while (pc1); free(c1buf); } /** ** Outputs two columns of text. */ static void print2Columns( const char* fmt, uint l1, uint l2, const char *c1, const char *c2 ) { const char *pc1=c1, *pc2=c2; char *c1buf = (char *)malloc(l1+1); char *c2buf = (char *)malloc(l2+1); if (!c1buf) outOfMemory(); if (!c2buf) outOfMemory(); do { pc1 = cutToWhiteSpace(pc1, l1, c1buf); pc2 = cutToWhiteSpace(pc2, l2, c2buf); printf(fmt, c1buf[0]!='\0'?c1buf:"", c2buf[0]!='\0'?c2buf:""); } while (pc1 || pc2); free(c1buf); free(c2buf); } /** ** Outputs three columns of text. */ static void print3Columns( const char* fmt, uint l1, uint l2, uint l3, const char *c1, const char *c2, const char *c3 ) { const char *pc1=c1, *pc2=c2, *pc3=c3; char *c1buf = (char *)malloc(l1+1); char *c2buf = (char *)malloc(l2+1); char *c3buf = (char *)malloc(l3+1); if (!c1buf) outOfMemory(); if (!c2buf) outOfMemory(); if (!c3buf) outOfMemory(); do { pc1 = cutToWhiteSpace(pc1, l1, c1buf); pc2 = cutToWhiteSpace(pc2, l2, c2buf); pc3 = cutToWhiteSpace(pc3, l3, c3buf); printf(fmt, c1buf[0]!='\0'?c1buf:"", c2buf[0]!='\0'?c2buf:"", c3buf[0]!='\0'?c3buf:""); } while (pc1 || pc2 || pc3); free(c1buf); free(c2buf); free(c3buf); } /** ** Format strings and decorations used in output. */ static const char helpfmt[] = " %-25.25s %-52.52s\n"; static const char helpul[] = "-----------------------------------------------------------------"; static const char fmt[] = "%-27.27s %-9.9s %-40.40s\n"; static const char valfmt[] = "%-27.27s %-9.9s %-1.1s%-39.39s\n"; static const char ul[] = "================================================================="; /** ** This enum is used to categorize the options for help output. */ typedef enum { CmdOptFileManip, CmdOptCatFIRST = CmdOptFileManip, CmdOptProcDir, CmdOptCharEnc, CmdOptMisc, CmdOptXML, CmdOptCatLAST } CmdOptCategory; /** ** This array contains headings that will be used in help ouput. */ static const struct { ctmbstr mnemonic; /**< Used in XML as a class. */ uint key; /**< Key to fetch the localized string. */ } cmdopt_catname[] = { { "file-manip", TC_STRING_FILE_MANIP }, { "process-directives", TC_STRING_PROCESS_DIRECTIVES }, { "char-encoding", TC_STRING_CHAR_ENCODING }, { "misc", TC_STRING_MISC }, { "xml", TC_STRING_XML } }; /** ** The struct and subsequent array keep the help output structured ** because we _also_ output all of this stuff as as XML. */ typedef struct { CmdOptCategory cat; /**< Category */ ctmbstr name1; /**< Name */ uint key; /**< Key to fetch the localized description. */ uint subKey; /**< Secondary substitution key. */ ctmbstr eqconfig; /**< Equivalent configuration option */ ctmbstr name2; /**< Name */ ctmbstr name3; /**< Name */ } CmdOptDesc; /* All instances of %s will be substituted with localized string specified by the subKey field. */ static const CmdOptDesc cmdopt_defs[] = { { CmdOptFileManip, "-output <%s>", TC_OPT_OUTPUT, TC_LABEL_FILE, "output-file: <%s>", "-o <%s>" }, { CmdOptFileManip, "-config <%s>", TC_OPT_CONFIG, TC_LABEL_FILE, NULL }, { CmdOptFileManip, "-file <%s>", TC_OPT_FILE, TC_LABEL_FILE, "error-file: <%s>", "-f <%s>" }, { CmdOptFileManip, "-modify", TC_OPT_MODIFY, 0, "write-back: yes", "-m" }, { CmdOptProcDir, "-indent", TC_OPT_INDENT, 0, "indent: auto", "-i" }, { CmdOptProcDir, "-wrap <%s>", TC_OPT_WRAP, TC_LABEL_COL, "wrap: <%s>", "-w <%s>" }, { CmdOptProcDir, "-upper", TC_OPT_UPPER, 0, "uppercase-tags: yes", "-u" }, { CmdOptProcDir, "-clean", TC_OPT_CLEAN, 0, "clean: yes", "-c" }, { CmdOptProcDir, "-bare", TC_OPT_BARE, 0, "bare: yes", "-b" }, { CmdOptProcDir, "-gdoc", TC_OPT_GDOC, 0, "gdoc: yes", "-g" }, { CmdOptProcDir, "-numeric", TC_OPT_NUMERIC, 0, "numeric-entities: yes", "-n" }, { CmdOptProcDir, "-errors", TC_OPT_ERRORS, 0, "markup: no", "-e" }, { CmdOptProcDir, "-quiet", TC_OPT_QUIET, 0, "quiet: yes", "-q" }, { CmdOptProcDir, "-omit", TC_OPT_OMIT, 0, "omit-optional-tags: yes" }, { CmdOptProcDir, "-xml", TC_OPT_XML, 0, "input-xml: yes" }, { CmdOptProcDir, "-asxml", TC_OPT_ASXML, 0, "output-xhtml: yes", "-asxhtml" }, { CmdOptProcDir, "-ashtml", TC_OPT_ASHTML, 0, "output-html: yes" }, #if SUPPORT_ACCESSIBILITY_CHECKS { CmdOptProcDir, "-access <%s>", TC_OPT_ACCESS, TC_LABEL_LEVL, "accessibility-check: <%s>" }, #endif { CmdOptCharEnc, "-raw", TC_OPT_RAW, 0, NULL }, { CmdOptCharEnc, "-ascii", TC_OPT_ASCII, 0, NULL }, { CmdOptCharEnc, "-latin0", TC_OPT_LATIN0, 0, NULL }, { CmdOptCharEnc, "-latin1", TC_OPT_LATIN1, 0, NULL }, #ifndef NO_NATIVE_ISO2022_SUPPORT { CmdOptCharEnc, "-iso2022", TC_OPT_ISO2022, 0, NULL }, #endif { CmdOptCharEnc, "-utf8", TC_OPT_UTF8, 0, NULL }, { CmdOptCharEnc, "-mac", TC_OPT_MAC, 0, NULL }, { CmdOptCharEnc, "-win1252", TC_OPT_WIN1252, 0, NULL }, { CmdOptCharEnc, "-ibm858", TC_OPT_IBM858, 0, NULL }, #if SUPPORT_UTF16_ENCODINGS { CmdOptCharEnc, "-utf16le", TC_OPT_UTF16LE, 0, NULL }, { CmdOptCharEnc, "-utf16be", TC_OPT_UTF16BE, 0, NULL }, { CmdOptCharEnc, "-utf16", TC_OPT_UTF16, 0, NULL }, #endif #if SUPPORT_ASIAN_ENCODINGS /* #431953 - RJ */ { CmdOptCharEnc, "-big5", TC_OPT_BIG5, 0, NULL }, { CmdOptCharEnc, "-shiftjis", TC_OPT_SHIFTJIS, 0, NULL }, #endif { CmdOptMisc, "-version", TC_OPT_VERSION, 0, NULL, "-v" }, { CmdOptMisc, "-help", TC_OPT_HELP, 0, NULL, "-h", "-?" }, { CmdOptMisc, "-help-config", TC_OPT_HELPCFG, 0, NULL }, { CmdOptMisc, "-show-config", TC_OPT_SHOWCFG, 0, NULL }, { CmdOptMisc, "-help-option <%s>", TC_OPT_HELPOPT, TC_LABEL_OPT, NULL }, { CmdOptMisc, "-language <%s>", TC_OPT_LANGUAGE, TC_LABEL_LANG, "language: <%s>" }, { CmdOptXML, "-xml-help", TC_OPT_XMLHELP, 0, NULL }, { CmdOptXML, "-xml-config", TC_OPT_XMLCFG, 0, NULL }, { CmdOptXML, "-xml-strings", TC_OPT_XMLSTRG, 0, NULL }, { CmdOptXML, "-xml-error-strings", TC_OPT_XMLERRS, 0, NULL }, { CmdOptXML, "-xml-options-strings", TC_OPT_XMLOPTS, 0, NULL }, { CmdOptMisc, NULL, 0, 0, NULL } }; /** ** Create a new string with a format and arguments. */ static tmbstr stringWithFormat( const ctmbstr fmt, ... ) { va_list argList; tmbstr result = NULL; int len = 0; va_start(argList, fmt); len = vsnprintf( result, 0, fmt, argList ); va_end(argList); if (!(result = malloc( len + 1) )) outOfMemory(); va_start(argList, fmt); vsnprintf( result, len + 1, fmt, argList); va_end(argList); return result; } /** ** Option names aren't localized, but the sample fields ** are, for example should be in Spanish. */ static void localize_option_names( CmdOptDesc *pos) { ctmbstr fileString = tidyLocalizedString(pos->subKey); pos->name1 = stringWithFormat(pos->name1, fileString); if ( pos->name2 ) pos->name2 = stringWithFormat(pos->name2, fileString); if ( pos->name3 ) pos->name3 = stringWithFormat(pos->name3, fileString); } /** ** Retrieve the options' names from the structure as a single ** string. */ static tmbstr get_option_names( const CmdOptDesc* pos ) { tmbstr name; uint len; CmdOptDesc localPos = *pos; localize_option_names( &localPos ); len = strlen(localPos.name1); if (localPos.name2) len += 2+strlen(localPos.name2); if (localPos.name3) len += 2+strlen(localPos.name3); name = (tmbstr)malloc(len+1); if (!name) outOfMemory(); strcpy(name, localPos.name1); free((tmbstr)localPos.name1); if (localPos.name2) { strcat(name, ", "); strcat(name, localPos.name2); free((tmbstr)localPos.name2); } if (localPos.name3) { strcat(name, ", "); strcat(name, localPos.name3); free((tmbstr)localPos.name3); } return name; } /** ** Escape a name for XML output. */ static tmbstr get_escaped_name( ctmbstr name ) { tmbstr escpName; char aux[2]; uint len = 0; ctmbstr c; for(c=name; *c!='\0'; ++c) switch(*c) { case '<': case '>': len += 4; break; case '"': len += 6; break; default: len += 1; break; } escpName = (tmbstr)malloc(len+1); if (!escpName) outOfMemory(); escpName[0] = '\0'; aux[1] = '\0'; for(c=name; *c!='\0'; ++c) switch(*c) { case '<': strcat(escpName, "<"); break; case '>': strcat(escpName, ">"); break; case '"': strcat(escpName, """); break; default: aux[0] = *c; strcat(escpName, aux); break; } return escpName; } /** ** Outputs a complete help option (text) */ static void print_help_option( void ) { CmdOptCategory cat = CmdOptCatFIRST; const CmdOptDesc* pos = cmdopt_defs; for( cat=CmdOptCatFIRST; cat!=CmdOptCatLAST; ++cat) { ctmbstr name = tidyLocalizedString(cmdopt_catname[cat].key); size_t len = strlen(name); printf("%s\n", name ); printf("%*.*s\n", (int)len, (int)len, helpul ); for( pos=cmdopt_defs; pos->name1; ++pos) { tmbstr name; if (pos->cat != cat) continue; name = get_option_names( pos ); print2Columns( helpfmt, 25, 52, name, tidyLocalizedString( pos->key ) ); free(name); } printf("\n"); } } /** ** Outputs an XML element for an option. */ static void print_xml_help_option_element( ctmbstr element, ctmbstr name ) { tmbstr escpName; if (!name) return; printf(" <%s>%s\n", element, escpName = get_escaped_name(name), element); free(escpName); } /** ** Outputs a complete help option (XML) */ static void print_xml_help_option( void ) { const CmdOptDesc* pos = cmdopt_defs; for( pos=cmdopt_defs; pos->name1; ++pos) { printf(" \n"); } } /** ** Provides the -xml-help service. */ static void xml_help( void ) { printf( "\n" "\n", tidyLibraryVersion()); print_xml_help_option(); printf( "\n" ); } /** ** Returns the final name of the tidy executable. */ static ctmbstr get_final_name( ctmbstr prog ) { ctmbstr name = prog; int c; size_t i, len = strlen(prog); for (i = 0; i < len; i++) { c = prog[i]; if ((( c == '/' ) || ( c == '\\' )) && prog[i+1]) name = &prog[i+1]; } return name; } /** ** Handles the -help service. */ static void help( ctmbstr prog ) { tmbstr title_line = NULL; printf( tidyLocalizedString(TC_TXT_HELP_1), get_final_name(prog),tidyLibraryVersion() ); #ifdef PLATFORM_NAME title_line = stringWithFormat( tidyLocalizedString(TC_TXT_HELP_2A), PLATFORM_NAME); #else title_line = stringWithFormat( tidyLocalizedString(TC_TXT_HELP_2B) ); #endif printf( "%s\n", title_line ); printf("%*.*s\n", (int)strlen(title_line), (int)strlen(title_line), ul); free( title_line ); printf( "\n"); print_help_option(); printf( "%s", tidyLocalizedString(TC_TXT_HELP_3) ); } /** ** Utility to determine if an option is an AutoBool. */ static Bool isAutoBool( TidyOption topt ) { TidyIterator pos; ctmbstr def; if ( tidyOptGetType( topt ) != TidyInteger) return no; pos = tidyOptGetPickList( topt ); while ( pos ) { def = tidyOptGetNextPick( topt, &pos ); if (0==strcmp(def,"yes")) return yes; } return no; } /** ** Returns the configuration category name for the ** specified configuration category id. This will be ** used as an XML class attribute value. */ static ctmbstr ConfigCategoryName( TidyConfigCategory id ) { switch( id ) { case TidyMarkup: return tidyLocalizedString( TC_CAT_MARKUP ); case TidyDiagnostics: return tidyLocalizedString( TC_CAT_DIAGNOSTICS ); case TidyPrettyPrint: return tidyLocalizedString( TC_CAT_PRETTYPRINT ); case TidyEncoding: return tidyLocalizedString( TC_CAT_ENCODING ); case TidyMiscellaneous: return tidyLocalizedString( TC_CAT_MISC ); } fprintf(stderr, tidyLocalizedString(TC_STRING_FATAL_ERROR), (int)id); fprintf(stderr, "\n"); assert(0); abort(); return "never_here"; /* only for the compiler warning */ } /** ** Structure maintains a description of an option. */ typedef struct { ctmbstr name; /**< Name */ ctmbstr cat; /**< Category */ ctmbstr type; /**< "String, ... */ ctmbstr vals; /**< Potential values. If NULL, use an external function */ ctmbstr def; /**< default */ tmbchar tempdefs[80]; /**< storage for default such as integer */ Bool haveVals; /**< if yes, vals is valid */ } OptionDesc; typedef void (*OptionFunc)( TidyDoc, TidyOption, OptionDesc * ); /** ** Create OptionDesc "d" related to "opt" */ static void GetOption( TidyDoc tdoc, TidyOption topt, OptionDesc *d ) { TidyOptionId optId = tidyOptGetId( topt ); TidyOptionType optTyp = tidyOptGetType( topt ); d->name = tidyOptGetName( topt ); d->cat = ConfigCategoryName( tidyOptGetCategory( topt ) ); d->vals = NULL; d->def = NULL; d->haveVals = yes; /* Handle special cases first. */ switch ( optId ) { case TidyDuplicateAttrs: case TidySortAttributes: case TidyNewline: case TidyAccessibilityCheckLevel: d->type = "enum"; d->vals = NULL; d->def = optId==TidyNewline ? "Platform dependent" :tidyOptGetCurrPick( tdoc, optId ); break; case TidyDoctype: d->type = "DocType"; d->vals = NULL; { ctmbstr sdef = NULL; sdef = tidyOptGetCurrPick( tdoc, TidyDoctypeMode ); if ( !sdef || *sdef == '*' ) sdef = tidyOptGetValue( tdoc, TidyDoctype ); d->def = sdef; } break; case TidyInlineTags: case TidyBlockTags: case TidyEmptyTags: case TidyPreTags: d->type = "Tag names"; d->vals = "tagX, tagY, ..."; d->def = NULL; break; case TidyCharEncoding: case TidyInCharEncoding: case TidyOutCharEncoding: d->type = "Encoding"; d->def = tidyOptGetEncName( tdoc, optId ); if (!d->def) d->def = "?"; d->vals = NULL; break; /* General case will handle remaining */ default: switch ( optTyp ) { case TidyBoolean: d->type = "Boolean"; d->vals = "y/n, yes/no, t/f, true/false, 1/0"; d->def = tidyOptGetCurrPick( tdoc, optId ); break; case TidyInteger: if (isAutoBool(topt)) { d->type = "AutoBool"; d->vals = "auto, y/n, yes/no, t/f, true/false, 1/0"; d->def = tidyOptGetCurrPick( tdoc, optId ); } else { uint idef; d->type = "Integer"; if ( optId == TidyWrapLen ) d->vals = "0 (no wrapping), 1, 2, ..."; else d->vals = "0, 1, 2, ..."; idef = tidyOptGetInt( tdoc, optId ); sprintf(d->tempdefs, "%u", idef); d->def = d->tempdefs; } break; case TidyString: d->type = "String"; d->vals = NULL; d->haveVals = no; d->def = tidyOptGetValue( tdoc, optId ); break; } } } /** ** Array holding all options. Contains a trailing sentinel. */ typedef struct { TidyOption topt[N_TIDY_OPTIONS]; } AllOption_t; /** ** A simple option comparator. **/ static int cmpOpt(const void* e1_, const void *e2_) { const TidyOption* e1 = (const TidyOption*)e1_; const TidyOption* e2 = (const TidyOption*)e2_; return strcmp(tidyOptGetName(*e1), tidyOptGetName(*e2)); } /** ** Returns options sorted. **/ static void getSortedOption( TidyDoc tdoc, AllOption_t *tOption ) { TidyIterator pos = tidyGetOptionList( tdoc ); uint i = 0; while ( pos ) { TidyOption topt = tidyGetNextOption( tdoc, &pos ); tOption->topt[i] = topt; ++i; } tOption->topt[i] = NULL; /* sentinel */ qsort(tOption->topt, /* Do not sort the sentinel: hence `-1' */ sizeof(tOption->topt)/sizeof(tOption->topt[0])-1, sizeof(tOption->topt[0]), cmpOpt); } /** ** An iterator for the sorted options. **/ static void ForEachSortedOption( TidyDoc tdoc, OptionFunc OptionPrint ) { AllOption_t tOption; const TidyOption *topt; getSortedOption( tdoc, &tOption ); for( topt = tOption.topt; *topt; ++topt) { OptionDesc d; GetOption( tdoc, *topt, &d ); (*OptionPrint)( tdoc, *topt, &d ); } } /** ** An iterator for the unsorted options. **/ static void ForEachOption( TidyDoc tdoc, OptionFunc OptionPrint ) { TidyIterator pos = tidyGetOptionList( tdoc ); while ( pos ) { TidyOption topt = tidyGetNextOption( tdoc, &pos ); OptionDesc d; GetOption( tdoc, topt, &d ); (*OptionPrint)( tdoc, topt, &d ); } } /** ** Prints an option's allowed value as specified in its pick list. **/ static void PrintAllowedValuesFromPick( TidyOption topt ) { TidyIterator pos = tidyOptGetPickList( topt ); Bool first = yes; ctmbstr def; while ( pos ) { if (first) first = no; else printf(", "); def = tidyOptGetNextPick( topt, &pos ); printf("%s", def); } } /** ** Prints an option's allowed values. **/ static void PrintAllowedValues( TidyOption topt, const OptionDesc *d ) { if (d->vals) printf( "%s", d->vals ); else PrintAllowedValuesFromPick( topt ); } /** ** Prints for XML an option's . **/ static void printXMLDescription( TidyDoc tdoc, TidyOption topt ) { ctmbstr doc = tidyOptGetDoc( tdoc, topt ); if (doc) printf(" %s\n", doc); else { printf(" \n"); fprintf(stderr, tidyLocalizedString(TC_STRING_OPT_NOT_DOCUMENTED), tidyOptGetName( topt )); fprintf(stderr, "\n"); } } /** ** Prints for XML an option's . **/ static void printXMLCrossRef( TidyDoc tdoc, TidyOption topt ) { TidyOption optLinked; TidyIterator pos = tidyOptGetDocLinksList(tdoc, topt); while( pos ) { optLinked = tidyOptGetNextDocLinks(tdoc, &pos ); printf(" %s\n",tidyOptGetName(optLinked)); } } /** ** Prints for XML an option. **/ static void printXMLOption( TidyDoc tdoc, TidyOption topt, OptionDesc *d ) { if ( tidyOptIsReadOnly(topt) ) return; printf( " \n" ); } /** ** Handles the -xml-config service. **/ static void XMLoptionhelp( TidyDoc tdoc ) { printf( "\n" "\n", tidyLibraryVersion()); ForEachOption( tdoc, printXMLOption ); printf( "\n" ); } /** * Prints the Windows language names that Tidy recognizes, * using the specified format string. */ void tidyPrintWindowsLanguageNames( ctmbstr format ) { const tidyLocaleMapItem *item; TidyIterator i = getWindowsLanguageList(); while (i) { item = getNextWindowsLanguage(&i); if ( format ) printf( format, item->winName, item->POSIXName ); else printf( "%-20s -> %s\n", item->winName, item->POSIXName ); } } /** * Prints the languages the are currently built into Tidy, * using the specified format string. */ void tidyPrintTidyLanguageNames( ctmbstr format ) { ctmbstr item; TidyIterator i = getInstalledLanguageList(); while (i) { item = getNextInstalledLanguage(&i); if ( format ) printf( format, item ); else printf( "%s\n", item ); } } /** ** Retrieves allowed values from an option's pick list. */ static tmbstr GetAllowedValuesFromPick( TidyOption topt ) { TidyIterator pos; Bool first; ctmbstr def; uint len = 0; tmbstr val; pos = tidyOptGetPickList( topt ); first = yes; while ( pos ) { if (first) first = no; else len += 2; def = tidyOptGetNextPick( topt, &pos ); len += strlen(def); } val = (tmbstr)malloc(len+1); if (!val) outOfMemory(); val[0] = '\0'; pos = tidyOptGetPickList( topt ); first = yes; while ( pos ) { if (first) first = no; else strcat(val, ", "); def = tidyOptGetNextPick( topt, &pos ); strcat(val, def); } return val; } /** ** Retrieves allowed values for an option. */ static tmbstr GetAllowedValues( TidyOption topt, const OptionDesc *d ) { if (d->vals) { tmbstr val = (tmbstr)malloc(1+strlen(d->vals)); if (!val) outOfMemory(); strcpy(val, d->vals); return val; } else return GetAllowedValuesFromPick( topt ); } /** ** Prints a single option. */ static void printOption( TidyDoc ARG_UNUSED(tdoc), TidyOption topt, OptionDesc *d ) { if ( tidyOptIsReadOnly(topt) ) return; if ( *d->name || *d->type ) { ctmbstr pval = d->vals; tmbstr val = NULL; if (!d->haveVals) { pval = "-"; } else if (pval == NULL) { val = GetAllowedValues( topt, d); pval = val; } print3Columns( fmt, 27, 9, 40, d->name, d->type, pval ); if (val) free(val); } } /** ** Handles the -help-config service. */ static void optionhelp( TidyDoc tdoc ) { printf( "%s", tidyLocalizedString( TC_TXT_HELP_CONFIG ) ); printf( fmt, tidyLocalizedString( TC_TXT_HELP_CONFIG_NAME ), tidyLocalizedString( TC_TXT_HELP_CONFIG_TYPE ), tidyLocalizedString( TC_TXT_HELP_CONFIG_ALLW ) ); printf( fmt, ul, ul, ul ); ForEachSortedOption( tdoc, printOption ); } /** ** Cleans up the HTML-laden option descriptions for console ** output. It's just a simple HTML filtering/replacement function. ** Will return an allocated string. */ static tmbstr cleanup_description( ctmbstr description ) { /* Substitutions - this might be a good spot to introduce platform dependent definitions for colorized output on different terminals that support, for example, ANSI escape sequences. The assumption is made the Mac and Linux targets support ANSI colors, but even so debugger terminals may not. Note that the line-wrapping function also doesn't account for non-printing characters. */ static struct { ctmbstr tag; ctmbstr replacement; } const replacements[] = { { "lt", "<" }, { "gt", ">" }, { "br/", "\n\n" }, #if defined(LINUX_OS) || defined(MAC_OS_X) { "code", "\x1b[36m" }, { "/code", "\x1b[0m" }, { "em", "\x1b[4m" }, { "/em", "\x1b[0m" }, { "strong", "\x1b[31m" }, { "/strong", "\x1b[0m" }, #endif /* MUST be last */ { NULL, NULL }, }; /* State Machine Setup */ typedef enum { s_DONE, s_DATA, s_WRITING, s_TAG_OPEN, s_TAG_NAME, s_ERROR, s_LAST /* MUST be last */ } states; typedef enum { c_NIL, c_EOF, c_BRACKET_CLOSE, c_BRACKET_OPEN, c_OTHER } charstates; typedef enum { a_NIL, a_BUILD_NAME, a_CONSUME, a_EMIT, a_EMIT_SUBS, a_WRITE, a_ERROR } actions; typedef struct { states state; charstates charstate; actions action; states next_state; } transitionType; const transitionType transitions[] = { { s_DATA, c_EOF, a_NIL, s_DONE }, { s_DATA, c_BRACKET_OPEN, a_CONSUME, s_TAG_OPEN }, /* special case allows ; */ { s_DATA, c_BRACKET_CLOSE, a_EMIT, s_WRITING }, { s_DATA, c_OTHER, a_EMIT, s_WRITING }, { s_WRITING, c_OTHER, a_WRITE, s_DATA }, { s_WRITING, c_BRACKET_CLOSE, a_WRITE, s_DATA }, { s_TAG_OPEN, c_EOF, a_ERROR, s_DONE }, { s_TAG_OPEN, c_OTHER, a_NIL, s_TAG_NAME }, { s_TAG_NAME, c_BRACKET_OPEN, a_ERROR, s_DONE }, { s_TAG_NAME, c_EOF, a_ERROR, s_DONE }, { s_TAG_NAME, c_BRACKET_CLOSE, a_EMIT_SUBS, s_WRITING }, { s_TAG_NAME, c_OTHER, a_BUILD_NAME, s_TAG_NAME }, { s_ERROR, 0, a_ERROR, s_DONE }, { s_DONE, 0, a_NIL, 0 }, /* MUST be last: */ { s_LAST, 0, 0, 0 }, }; /* Output Setup */ tmbstr result = NULL; int g_result = 100; // minimum buffer grow size int l_result = 0; // buffer current size int i_result = 0; // current string position int writer_len = 0; // writer length ctmbstr writer = NULL; /* Current tag name setup */ tmbstr name = NULL; // tag name int g_name = 10; // buffer grow size int l_name = 0; // buffer current size int i_name = 0; // current string position /* Pump Setup */ int i = 0; states state = s_DATA; charstates charstate; char c; int j = 0, k = 0; transitionType transition; if ( !description || (strlen(description) < 1) ) { return NULL; } /* Process the HTML Snippet */ do { c = description[i]; /* Determine secondary state. */ switch (c) { case '\0': charstate = c_EOF; break; case '<': case '&': charstate = c_BRACKET_OPEN; break; case '>': case ';': charstate = c_BRACKET_CLOSE; break; default: charstate = c_OTHER; break; } /* Find the correct instruction */ j = 0; while (transitions[j].state != s_LAST) { transition = transitions[j]; if ( transition.state == state && transition.charstate == charstate ) { switch ( transition.action ) { /* This action is building the name of an HTML tag. */ case a_BUILD_NAME: if ( !name ) { l_name = g_name; name = calloc(l_name, 1); } if ( i_name >= l_name ) { l_name = l_name + g_name; name = realloc(name, l_name); } strncpy(name + i_name, &c, 1); i_name++; i++; break; /* This character will be emitted into the output stream. The only purpose of this action is to ensure that `writer` is NULL as a flag that we will output the current `c` */ case a_EMIT: writer = NULL; // flag to use c break; /* Now that we've consumed a tag, we will emit the substitution if any has been specified in `replacements`. */ case a_EMIT_SUBS: name[i_name] = '\0'; i_name = 0; k = 0; writer = ""; while ( replacements[k].tag ) { if ( strcmp( replacements[k].tag, name ) == 0 ) { writer = replacements[k].replacement; } k++; } break; /* This action will add to our `result` string, expanding the buffer as necessary in reasonable chunks. */ case a_WRITE: if ( !writer ) writer_len = 1; else writer_len = strlen( writer ); /* Lazy buffer creation */ if ( !result ) { l_result = writer_len + g_result; result = calloc(l_result, 1); } /* Grow the buffer if needed */ if ( i_result + writer_len >= l_result ) { l_result = l_result + writer_len + g_result; result = realloc(result, l_result); } /* Add current writer to the buffer */ if ( !writer ) { result[i_result] = c; result[i_result +1] = '\0'; } else { strncpy( result + i_result, writer, writer_len ); } i_result += writer_len; i++; break; /* This action could be more robust but it serves the current purpose. Cross our fingers and count on our localizers not to give bad HTML descriptions. */ case a_ERROR: printf(" The localized string probably has bad HTML.\n"); goto EXIT_CLEANLY; /* Just a NOP. */ case a_NIL: break; /* The default case also handles the CONSUME action. */ default: i++; break; } state = transition.next_state; break; } j++; } } while ( description[i] ); EXIT_CLEANLY: if ( name ) free(name); return result; } /** ** Handles the -help-option service. */ static void optionDescribe( TidyDoc tdoc, char *tag ) { tmbstr result = NULL; TidyOptionId topt; topt = tidyOptGetIdForName( tag ); if (topt < N_TIDY_OPTIONS) { result = cleanup_description( tidyOptGetDoc( tdoc, tidyGetOption( tdoc, topt ) ) ); } else { result = (tmbstr)tidyLocalizedString(TC_STRING_UNKNOWN_OPTION_B); } printf( "\n" ); printf( "`--%s`\n\n", tag ); print1Column( "%-68.68s\n", 68, result ); printf( "\n" ); if ( (topt < N_TIDY_OPTIONS) && ( result ) ) free ( result ); } /** * Prints the option value for a given option. */ static void printOptionValues( TidyDoc ARG_UNUSED(tdoc), TidyOption topt, OptionDesc *d ) { TidyOptionId optId = tidyOptGetId( topt ); ctmbstr ro = tidyOptIsReadOnly( topt ) ? "*" : "" ; switch ( optId ) { case TidyInlineTags: case TidyBlockTags: case TidyEmptyTags: case TidyPreTags: { TidyIterator pos = tidyOptGetDeclTagList( tdoc ); while ( pos ) { d->def = tidyOptGetNextDeclTag(tdoc, optId, &pos); if ( pos ) { if ( *d->name ) printf( valfmt, d->name, d->type, ro, d->def ); else printf( fmt, d->name, d->type, d->def ); d->name = ""; d->type = ""; } } } break; case TidyNewline: d->def = tidyOptGetCurrPick( tdoc, optId ); break; default: break; } /* fix for http://tidy.sf.net/bug/873921 */ if ( *d->name || *d->type || (d->def && *d->def) ) { if ( ! d->def ) d->def = ""; if ( *d->name ) printf( valfmt, d->name, d->type, ro, d->def ); else printf( fmt, d->name, d->type, d->def ); } } /** ** Handles the -show-config service. */ static void optionvalues( TidyDoc tdoc ) { printf( "\n%s\n\n", tidyLocalizedString(TC_STRING_CONF_HEADER) ); printf( fmt, tidyLocalizedString(TC_STRING_CONF_NAME), tidyLocalizedString(TC_STRING_CONF_TYPE), tidyLocalizedString(TC_STRING_CONF_VALUE) ); printf( fmt, ul, ul, ul ); ForEachSortedOption( tdoc, printOptionValues ); printf( "\n\n%s\n\n", tidyLocalizedString(TC_STRING_CONF_NOTE) ); } /** ** Handles the -version service. */ static void version( void ) { #ifdef PLATFORM_NAME printf( tidyLocalizedString( TC_STRING_VERS_A ), PLATFORM_NAME, tidyLibraryVersion() ); #else printf( tidyLocalizedString( TC_STRING_VERS_B ), tidyLibraryVersion() ); #endif printf("\n"); } /** ** Handles the printing of option description for ** -xml-options-strings service. **/ static void printXMLOptionString( TidyDoc tdoc, TidyOption topt, OptionDesc *d ) { if ( tidyOptIsReadOnly(topt) ) return; printf( " \n" ); } /** ** Handles the -xml-options-strings service. ** This service is primarily helpful to developers and localizers to test ** that option description strings as represented on screen output are ** correct and do not break tidy. **/ static void xml_options_strings( TidyDoc tdoc ) { printf( "\n" "\n", tidyLibraryVersion()); ForEachOption( tdoc, printXMLOptionString); printf( "\n" ); } /** ** Handles the -xml-error-strings service. ** This service is primarily helpful to developers who need to generate ** an updated list of strings to expect when using `TidyReportFilter3`. ** Included in the output is the current string associated with the error ** symbol. **/ static void xml_error_strings( TidyDoc tdoc ) { const tidyErrorFilterKeyItem *item; ctmbstr localizedString; TidyIterator j = getErrorCodeList(); printf( "\n" ); printf( "\n", tidyLibraryVersion()); while (j) { item = getNextErrorCode(&j); localizedString = tidyLocalizedString(item->value); printf( " \n" ); printf( " %s\n",item->key); if ( localizedString ) printf( " \n", tidyGetLanguage(), localizedString ); else printf( " NULL\n", tidyGetLanguage() ); printf( " \n" ); } printf( "\n" ); } /** ** Handles the -xml-strings service. ** This service was primarily helpful to developers and localizers to ** compare localized strings to the built in `en` strings. It's probably ** better to use our POT/PO workflow with your favorite tools, or simply ** diff the language header files directly. ** **Important:** The attribute `id` is not a specification, promise, or ** part of an API. You must not depend on this value. */ static void xml_strings( void ) { uint i; TidyIterator j; ctmbstr current_language = tidyGetLanguage(); Bool skip_current = strcmp( current_language, "en" ) == 0; Bool matches_base; printf( "\n" "\n", tidyLibraryVersion()); j = getStringKeyList(); while (j) { i = getNextStringKey(&j); printf( "\n", i ); printf( " ", "en" ); printf("%s", tidyDefaultString(i)); printf( "\n" ); if ( !skip_current ) { matches_base = strcmp( tidyLocalizedString(i), tidyDefaultString(i) ) == 0; printf( " ", tidyGetLanguage(), matches_base ? "yes" : "no" ); printf("%s", tidyLocalizedString(i)); printf( "\n" ); } printf( "\n"); } printf( "\n" ); } /** ** Handles the -lang help service. */ static void lang_help( void ) { printf( "%s", tidyLocalizedString(TC_TXT_HELP_LANG_1) ); tidyPrintWindowsLanguageNames(" %-20s -> %s\n"); printf( "%s", tidyLocalizedString(TC_TXT_HELP_LANG_2) ); tidyPrintTidyLanguageNames(" %s\n"); printf( tidyLocalizedString(TC_TXT_HELP_LANG_3), tidyGetLanguage() ); } /** ** Provides the `unknown option` output. */ static void unknownOption( uint c ) { fprintf( errout, tidyLocalizedString( TC_STRING_UNKNOWN_OPTION ), (char)c ); fprintf( errout, "\n"); } /** ** MAIN -- let's do something here. */ int main( int argc, char** argv ) { ctmbstr prog = argv[0]; ctmbstr cfgfil = NULL, errfil = NULL, htmlfil = NULL; TidyDoc tdoc = tidyCreate(); int status = 0; tmbstr locale = NULL; uint contentErrors = 0; uint contentWarnings = 0; uint accessWarnings = 0; errout = stderr; /* initialize to stderr */ /* Set an atexit handler. */ atexit( tidy_cleanup ); /* Set the locale for tidy's output. */ locale = tidySystemLocale(locale); tidySetLanguage(locale); if ( locale ) free( locale ); #if defined(_WIN32) /* Force Windows console to use UTF, otherwise many characters will * be garbage. Note that East Asian languages *are* supported, but * only when Windows OS locale (not console only!) is set to an * East Asian language. */ win_cp = GetConsoleOutputCP(); SetConsoleOutputCP(CP_UTF8); #endif #if !defined(NDEBUG) && defined(_MSC_VER) set_log_file((char *)"temptidy.txt", 0); // add_append_log(1); #endif /* * Look for default configuration files using any of * the following possibilities: * - TIDY_CONFIG_FILE - from tidyplatform.h, typically /etc/tidy.conf * - HTML_TIDY - environment variable * - TIDY_USER_CONFIG_FILE - from tidyplatform.h, typically ~/tidy.conf */ #ifdef TIDY_CONFIG_FILE if ( tidyFileExists( tdoc, TIDY_CONFIG_FILE) ) { status = tidyLoadConfig( tdoc, TIDY_CONFIG_FILE ); if ( status != 0 ) { fprintf(errout, tidyLocalizedString( TC_MAIN_ERROR_LOAD_CONFIG ), TIDY_CONFIG_FILE, status); fprintf(errout, "\n"); } } #endif /* TIDY_CONFIG_FILE */ if ( (cfgfil = getenv("HTML_TIDY")) != NULL ) { status = tidyLoadConfig( tdoc, cfgfil ); if ( status != 0 ) { fprintf(errout, tidyLocalizedString( TC_MAIN_ERROR_LOAD_CONFIG ), cfgfil, status); fprintf(errout, "\n"); } } #ifdef TIDY_USER_CONFIG_FILE else if ( tidyFileExists( tdoc, TIDY_USER_CONFIG_FILE) ) { status = tidyLoadConfig( tdoc, TIDY_USER_CONFIG_FILE ); if ( status != 0 ) { fprintf(errout, tidyLocalizedString( TC_MAIN_ERROR_LOAD_CONFIG ), TIDY_USER_CONFIG_FILE, status); fprintf(errout, "\n"); } } #endif /* TIDY_USER_CONFIG_FILE */ /* * Read command line */ while ( argc > 0 ) { if (argc > 1 && argv[1][0] == '-') { /* support -foo and --foo */ ctmbstr arg = argv[1] + 1; if ( strcasecmp(arg, "xml") == 0) tidyOptSetBool( tdoc, TidyXmlTags, yes ); else if ( strcasecmp(arg, "asxml") == 0 || strcasecmp(arg, "asxhtml") == 0 ) { tidyOptSetBool( tdoc, TidyXhtmlOut, yes ); } else if ( strcasecmp(arg, "ashtml") == 0 ) tidyOptSetBool( tdoc, TidyHtmlOut, yes ); else if ( strcasecmp(arg, "indent") == 0 ) { tidyOptSetInt( tdoc, TidyIndentContent, TidyAutoState ); if ( tidyOptGetInt(tdoc, TidyIndentSpaces) == 0 ) tidyOptResetToDefault( tdoc, TidyIndentSpaces ); } else if ( strcasecmp(arg, "omit") == 0 ) tidyOptSetBool( tdoc, TidyOmitOptionalTags, yes ); else if ( strcasecmp(arg, "upper") == 0 ) tidyOptSetBool( tdoc, TidyUpperCaseTags, yes ); else if ( strcasecmp(arg, "clean") == 0 ) tidyOptSetBool( tdoc, TidyMakeClean, yes ); else if ( strcasecmp(arg, "gdoc") == 0 ) tidyOptSetBool( tdoc, TidyGDocClean, yes ); else if ( strcasecmp(arg, "bare") == 0 ) tidyOptSetBool( tdoc, TidyMakeBare, yes ); else if ( strcasecmp(arg, "raw") == 0 || strcasecmp(arg, "ascii") == 0 || strcasecmp(arg, "latin0") == 0 || strcasecmp(arg, "latin1") == 0 || strcasecmp(arg, "utf8") == 0 || #ifndef NO_NATIVE_ISO2022_SUPPORT strcasecmp(arg, "iso2022") == 0 || #endif #if SUPPORT_UTF16_ENCODINGS strcasecmp(arg, "utf16le") == 0 || strcasecmp(arg, "utf16be") == 0 || strcasecmp(arg, "utf16") == 0 || #endif #if SUPPORT_ASIAN_ENCODINGS strcasecmp(arg, "shiftjis") == 0 || strcasecmp(arg, "big5") == 0 || #endif strcasecmp(arg, "mac") == 0 || strcasecmp(arg, "win1252") == 0 || strcasecmp(arg, "ibm858") == 0 ) { tidySetCharEncoding( tdoc, arg ); } else if ( strcasecmp(arg, "numeric") == 0 ) tidyOptSetBool( tdoc, TidyNumEntities, yes ); else if ( strcasecmp(arg, "modify") == 0 || strcasecmp(arg, "change") == 0 || /* obsolete */ strcasecmp(arg, "update") == 0 ) /* obsolete */ { tidyOptSetBool( tdoc, TidyWriteBack, yes ); } else if ( strcasecmp(arg, "errors") == 0 ) tidyOptSetBool( tdoc, TidyShowMarkup, no ); else if ( strcasecmp(arg, "quiet") == 0 ) tidyOptSetBool( tdoc, TidyQuiet, yes ); /* Currenly user must specify a language prior to anything that causes output */ else if ( strcasecmp(arg, "language") == 0 || strcasecmp(arg, "lang") == 0 ) if ( argc >= 3) { if ( strcasecmp(argv[2], "help") == 0 ) { lang_help(); exit(0); } if ( !tidySetLanguage( argv[2] ) ) { printf(tidyLocalizedString(TC_STRING_LANG_NOT_FOUND), argv[2], tidyGetLanguage()); printf("\n"); } --argc; ++argv; } else { printf( "%s\n", tidyLocalizedString(TC_STRING_LANG_MUST_SPECIFY)); } else if ( strcasecmp(arg, "help") == 0 || strcasecmp(arg, "-help") == 0 || strcasecmp(arg, "h") == 0 || *arg == '?' ) { help( prog ); tidyRelease( tdoc ); return 0; /* success */ } else if ( strcasecmp(arg, "xml-help") == 0) { xml_help( ); tidyRelease( tdoc ); return 0; /* success */ } else if ( strcasecmp(arg, "xml-error-strings") == 0) { xml_error_strings( tdoc ); tidyRelease( tdoc ); return 0; /* success */ } else if ( strcasecmp(arg, "xml-options-strings") == 0) { xml_options_strings( tdoc ); tidyRelease( tdoc ); return 0; /* success */ } else if ( strcasecmp(arg, "xml-strings") == 0) { xml_strings( ); tidyRelease( tdoc ); return 0; /* success */ } else if ( strcasecmp(arg, "help-config") == 0 ) { optionhelp( tdoc ); tidyRelease( tdoc ); return 0; /* success */ } else if ( strcasecmp(arg, "help-option") == 0 ) { if ( argc >= 3) { optionDescribe( tdoc, argv[2] ); } else { printf( "%s\n", tidyLocalizedString(TC_STRING_MUST_SPECIFY)); } tidyRelease( tdoc ); return 0; /* success */ } else if ( strcasecmp(arg, "xml-config") == 0 ) { XMLoptionhelp( tdoc ); tidyRelease( tdoc ); return 0; /* success */ } else if ( strcasecmp(arg, "show-config") == 0 ) { optionvalues( tdoc ); tidyRelease( tdoc ); return 0; /* success */ } else if ( strcasecmp(arg, "config") == 0 ) { if ( argc >= 3 ) { ctmbstr post; tidyLoadConfig( tdoc, argv[2] ); /* Set new error output stream if setting changed */ post = tidyOptGetValue( tdoc, TidyErrFile ); if ( post && (!errfil || !samefile(errfil, post)) ) { errfil = post; errout = tidySetErrorFile( tdoc, post ); } --argc; ++argv; } } else if ( strcasecmp(arg, "output") == 0 || strcasecmp(arg, "-output-file") == 0 || strcasecmp(arg, "o") == 0 ) { if ( argc >= 3 ) { tidyOptSetValue( tdoc, TidyOutFile, argv[2] ); --argc; ++argv; } } else if ( strcasecmp(arg, "file") == 0 || strcasecmp(arg, "-file") == 0 || strcasecmp(arg, "f") == 0 ) { if ( argc >= 3 ) { errfil = argv[2]; errout = tidySetErrorFile( tdoc, errfil ); --argc; ++argv; } } else if ( strcasecmp(arg, "wrap") == 0 || strcasecmp(arg, "-wrap") == 0 || strcasecmp(arg, "w") == 0 ) { if ( argc >= 3 ) { uint wraplen = 0; int nfields = sscanf( argv[2], "%u", &wraplen ); tidyOptSetInt( tdoc, TidyWrapLen, wraplen ); if (nfields > 0) { --argc; ++argv; } } } else if ( strcasecmp(arg, "version") == 0 || strcasecmp(arg, "-version") == 0 || strcasecmp(arg, "v") == 0 ) { version(); tidyRelease( tdoc ); return 0; /* success */ } else if ( strncmp(argv[1], "--", 2 ) == 0) { if ( tidyOptParseValue(tdoc, argv[1]+2, argv[2]) ) { /* Set new error output stream if setting changed */ ctmbstr post = tidyOptGetValue( tdoc, TidyErrFile ); if ( post && (!errfil || !samefile(errfil, post)) ) { errfil = post; errout = tidySetErrorFile( tdoc, post ); } ++argv; --argc; } } #if SUPPORT_ACCESSIBILITY_CHECKS else if ( strcasecmp(arg, "access") == 0 ) { if ( argc >= 3 ) { uint acclvl = 0; int nfields = sscanf( argv[2], "%u", &acclvl ); tidyOptSetInt( tdoc, TidyAccessibilityCheckLevel, acclvl ); if (nfields > 0) { --argc; ++argv; } } } #endif else { uint c; ctmbstr s = argv[1]; while ( (c = *++s) != '\0' ) { switch ( c ) { case 'i': tidyOptSetInt( tdoc, TidyIndentContent, TidyAutoState ); if ( tidyOptGetInt(tdoc, TidyIndentSpaces) == 0 ) tidyOptResetToDefault( tdoc, TidyIndentSpaces ); break; /* Usurp -o for output file. Anyone hiding end tags? case 'o': tidyOptSetBool( tdoc, TidyHideEndTags, yes ); break; */ case 'u': tidyOptSetBool( tdoc, TidyUpperCaseTags, yes ); break; case 'c': tidyOptSetBool( tdoc, TidyMakeClean, yes ); break; case 'g': tidyOptSetBool( tdoc, TidyGDocClean, yes ); break; case 'b': tidyOptSetBool( tdoc, TidyMakeBare, yes ); break; case 'n': tidyOptSetBool( tdoc, TidyNumEntities, yes ); break; case 'm': tidyOptSetBool( tdoc, TidyWriteBack, yes ); break; case 'e': tidyOptSetBool( tdoc, TidyShowMarkup, no ); break; case 'q': tidyOptSetBool( tdoc, TidyQuiet, yes ); break; default: unknownOption( c ); break; } } } --argc; ++argv; continue; } if ( argc > 1 ) { htmlfil = argv[1]; #if (!defined(NDEBUG) && defined(_MSC_VER)) SPRTF("Tidying '%s'\n", htmlfil); #endif // DEBUG outout if ( tidyOptGetBool(tdoc, TidyEmacs) ) tidyOptSetValue( tdoc, TidyEmacsFile, htmlfil ); status = tidyParseFile( tdoc, htmlfil ); } else { htmlfil = "stdin"; status = tidyParseStdin( tdoc ); } if ( status >= 0 ) status = tidyCleanAndRepair( tdoc ); if ( status >= 0 ) { status = tidyRunDiagnostics( tdoc ); if ( !tidyOptGetBool(tdoc, TidyQuiet) ) { /* NOT quiet, show DOCTYPE, if not already shown */ if (!tidyOptGetBool(tdoc, TidyShowInfo)) { tidyOptSetBool( tdoc, TidyShowInfo, yes ); tidyReportDoctype( tdoc ); /* FIX20140913: like warnings, errors, ALWAYS report DOCTYPE */ tidyOptSetBool( tdoc, TidyShowInfo, no ); } } } if ( status > 1 ) /* If errors, do we want to force output? */ status = ( tidyOptGetBool(tdoc, TidyForceOutput) ? status : -1 ); if ( status >= 0 && tidyOptGetBool(tdoc, TidyShowMarkup) ) { if ( tidyOptGetBool(tdoc, TidyWriteBack) && argc > 1 ) status = tidySaveFile( tdoc, htmlfil ); else { ctmbstr outfil = tidyOptGetValue( tdoc, TidyOutFile ); if ( outfil ) { status = tidySaveFile( tdoc, outfil ); } else { #if !defined(NDEBUG) && defined(_MSC_VER) static char tmp_buf[264]; sprintf(tmp_buf,"%s.html",get_log_file()); status = tidySaveFile( tdoc, tmp_buf ); SPRTF("Saved tidied content to '%s'\n",tmp_buf); #else status = tidySaveStdout( tdoc ); #endif } } } contentErrors += tidyErrorCount( tdoc ); contentWarnings += tidyWarningCount( tdoc ); accessWarnings += tidyAccessWarningCount( tdoc ); --argc; ++argv; if ( argc <= 1 ) break; } /* read command line loop */ if (!tidyOptGetBool(tdoc, TidyQuiet) && errout == stderr && !contentErrors) fprintf(errout, "\n"); if (contentErrors + contentWarnings > 0 && !tidyOptGetBool(tdoc, TidyQuiet)) tidyErrorSummary(tdoc); if (!tidyOptGetBool(tdoc, TidyQuiet)) tidyGeneralInfo(tdoc); /* called to free hash tables etc. */ tidyRelease( tdoc ); /* return status can be used by scripts */ if ( contentErrors > 0 ) return 2; if ( contentWarnings > 0 ) return 1; /* 0 signifies all is ok */ return 0; } /* * local variables: * mode: c * indent-tabs-mode: nil * c-basic-offset: 4 * eval: (c-set-offset 'substatement-open 0) * end: */ tidy-html5-5.2.0/experimental/000077500000000000000000000000001272601517300162175ustar00rootroot00000000000000tidy-html5-5.2.0/experimental/TidyNodeIter.c000066400000000000000000000023241272601517300207270ustar00rootroot00000000000000#include "tidyplatform.h" #include "tidy-int.h" #include "TidyNodeIter.h" TidyNodeIter *newTidyNodeIter( Node *pStart ) { TidyNodeIter *pThis = NULL; if (NULL != (pThis = MemAlloc( sizeof( TidyNodeIter )))) { ClearMemory( pThis, sizeof( TidyNodeIter )); pThis->pTop = pStart; } return pThis; } Node *nextTidyNode( TidyNodeIter *pThis ) { if (NULL == pThis->pCurrent) { // just starting out, initialize pThis->pCurrent = pThis->pTop->content; } else if (NULL != pThis->pCurrent->content) { // the next element, if any, is my first-born child pThis->pCurrent = pThis->pCurrent->content; } else { // no children, I guess my next younger brother inherits the throne. while ( NULL == pThis->pCurrent->next && pThis->pTop != pThis->pCurrent->parent ) { // no siblings, do any of my ancestors have younger sibs? pThis->pCurrent = pThis->pCurrent->parent; } pThis->pCurrent = pThis->pCurrent->next; } return pThis->pCurrent; } void setCurrentNode( TidyNodeIter *pThis, Node *newCurr ) { if (NULL != newCurr) pThis->pCurrent = newCurr; } tidy-html5-5.2.0/experimental/TidyNodeIter.h000066400000000000000000000030151272601517300207320ustar00rootroot00000000000000/* TidyNodeIter (c) 1998-2003 (W3C) MIT, ERCIM, Keio University See tidy.h for the copyright notice. These files contain utility routines to perform in-order traversals of the Tidy document tree, beginning at an arbitrary node. A traversal of the tree can be performed in a manner similar to the following: Node *testNode; TidyNodeIter *iter = newTidyNodeIter( FindBody( tdoc )); for (testNode = nextTidyNode( &iter ); NULL != testNode; testNode = nextTidyNode( &iter )) { } TODO: Add a prevTidyNode() function. */ #include "lexer.h" typedef struct _TidyNodeIter { Node *pTop, *pCurrent; } TidyNodeIter; TidyNodeIter *newTidyNodeIter( Node *pStart ); /* nextTidyNode( TidyNodeIter *pIter ) if pCurrent is NULL, this function initializes it to match pTop, and returns that value, otherwise it advances to the next node in order, and returns that value. When pTop == pCurrent, the function returns NULL to indicate that the entire tree has been visited. */ Node *nextTidyNode( TidyNodeIter *pIter ); /* setCurrentNode( TidyNodeIter *pThis, Node *newCurr ) Resets pCurrent to match the passed value; useful if you need to back up to an unaltered point in the tree, or to skip a section. The next call to nextTidyNode() will return the node which follows newCurr in order. Minimal error checking is performed; unexpected results _will_ occur if newCurr is not a descendant node of pTop. */ void setCurrentNode( TidyNodeIter *pThis, Node *newCurr ); tidy-html5-5.2.0/experimental/httpio.c000066400000000000000000000137041272601517300176770ustar00rootroot00000000000000#include "tmbstr.h" #include "httpio.h" int makeConnection ( HTTPInputSource *pHttp ) { struct sockaddr_in sock; struct hostent *pHost; /* Get internet address of the host. */ if (!(pHost = gethostbyname ( pHttp->pHostName ))) { return -1; } /* Copy the address of the host to socket description. */ memcpy (&sock.sin_addr, pHost->h_addr, pHost->h_length); /* Set port and protocol */ sock.sin_family = AF_INET; sock.sin_port = htons( pHttp->nPort ); /* Make an internet socket, stream type. */ if ((pHttp->s = socket (AF_INET, SOCK_STREAM, 0)) == -1) return -1; /* Connect the socket to the remote host. */ if (connect (pHttp->s, (struct sockaddr *) &sock, sizeof( sock ))) { if (errno == ECONNREFUSED) return ECONNREFUSED; else return -1; } return 0; } int parseURL( HTTPInputSource *pHttp, tmbstr url ) { int i, j = 0; ctmbstr pStr; pStr = tmbsubstr( url, "://" ); /* If protocol is there, but not http, bail out, else assume http. */ if (NULL != pStr) { if (tmbstrncasecmp( url, "http://", 7 )) return -1; } if (NULL != pStr) j = pStr - url + 3; for (i = j; url[i] && url[i] != ':' && url[i] != '/'; i++) {} if (i == j) return -1; /* Get the hostname. */ pHttp->pHostName = tmbstrndup (&url[j], i - j ); if (url[i] == ':') { /* We have a colon delimiting the hostname. It should mean that a port number is following it */ pHttp->nPort = 0; if (isdigit( url[++i] )) /* A port number */ { for (; url[i] && url[i] != '/'; i++) { if (isdigit( url[i] )) pHttp->nPort = 10 * pHttp->nPort + (url[i] - '0'); else return -1; } if (!pHttp->nPort) return -1; } else /* or just a misformed port number */ return -1; } else /* Assume default port. */ pHttp->nPort = 80; /* skip past the delimiting slash (we'll add it later ) */ while (url[i] && url[i] == '/') i++; pHttp->pResource = tmbstrdup (url + i ); return 0; } int fillBuffer( HTTPInputSource *in ) { if (0 < in->s) { in->nBufSize = recv( in->s, in->buffer, sizeof( in->buffer ), 0); in->nextBytePos = 0; if (in->nBufSize < sizeof( in->buffer )) in->buffer[in->nBufSize] = '\0'; } else in->nBufSize = 0; return in->nBufSize; } int openURL( HTTPInputSource *in, tmbstr pUrl ) { int rc = -1; #ifdef WIN32 WSADATA wsaData; rc = WSAStartup( 514, &wsaData ); #endif in->tis.getByte = (TidyGetByteFunc) HTTPGetByte; in->tis.ungetByte = (TidyUngetByteFunc) HTTPUngetByte; in->tis.eof = (TidyEOFFunc) HTTPIsEOF; in->tis.sourceData = (uint) in; in->nextBytePos = in->nextUnGotBytePos = in->nBufSize = 0; parseURL( in, pUrl ); if (0 == (rc = makeConnection( in ))) { char ch, lastCh = '\0'; int blanks = 0; char *getCmd = MemAlloc( 48 + strlen( in->pResource )); sprintf( getCmd, "GET /%s HTTP/1.0\r\nAccept: text/html\r\n\r\n", in->pResource ); send( in->s, getCmd, strlen( getCmd ), 0 ); MemFree( getCmd ); /* skip past the header information */ while ( in->nextBytePos >= in->nBufSize && 0 < (rc = fillBuffer( in ))) { if (1 < blanks) break; for (; in->nextBytePos < sizeof( in->buffer ) && 0 != in->buffer[ in->nextBytePos ]; in->nextBytePos++ ) { ch = in->buffer[ in->nextBytePos ]; if (ch == '\r' || ch == '\n') { if (ch == lastCh) { /* Two carriage returns or two newlines in a row, that's good enough */ blanks++; } if (lastCh == '\r' || lastCh == '\n') { blanks++; } } else blanks = 0; lastCh = ch; if (1 < blanks) { /* end of header, scan to first non-white and return */ while ('\0' != ch && isspace( ch )) ch = in->buffer[ ++in->nextBytePos ]; break; } } } } return rc; } void closeURL( HTTPInputSource *source ) { if (0 < source->s) closesocket( source->s ); source->s = -1; source->tis.sourceData = 0; #ifdef WIN32 WSACleanup(); #endif } int HTTPGetByte( HTTPInputSource *source ) { if (source->nextUnGotBytePos) return source->unGetBuffer[ --source->nextUnGotBytePos ]; if (0 != source->nBufSize && source->nextBytePos >= source->nBufSize) { fillBuffer( source ); } if (0 == source->nBufSize) return EndOfStream; return source->buffer[ source->nextBytePos++ ]; } void HTTPUngetByte( HTTPInputSource *source, uint byteValue ) { if (source->nextUnGotBytePos < 16 ) /* Only you can prevent buffer overflows */ source->unGetBuffer[ source->nextUnGotBytePos++ ] = (char) byteValue; } Bool HTTPIsEOF( HTTPInputSource *source ) { if (source->nextUnGotBytePos) /* pending ungot bytes, not done */ return no; if ( 0 != source->nBufSize && source->nextBytePos >= source->nBufSize) /* We've consumed the existing buffer, get another */ fillBuffer( source ); if (source->nextBytePos < source->nBufSize) /* we have stuff in the buffer, must not be done. */ return no; /* Nothing in the buffer, and the last receive failed, must be done. */ return yes; } tidy-html5-5.2.0/experimental/httpio.h000066400000000000000000000020371272601517300177010ustar00rootroot00000000000000#ifndef __HTTPIO_H__ #define __HTTPIO_H__ #include "platform.h" #include "tidy.h" #ifdef WIN32 # include # define ECONNREFUSED WSAECONNREFUSED #else # include # include # include #ifndef __BEOS__ # include #endif #endif /* WIN32 */ TIDY_STRUCT typedef struct _HTTPInputSource { TidyInputSource tis; // This declaration must be first and must not be changed! tmbstr pHostName; tmbstr pResource; unsigned short nPort, nextBytePos, nextUnGotBytePos, nBufSize; SOCKET s; char buffer[1024]; char unGetBuffer[16]; } HTTPInputSource; /* get next byte from input source */ int HTTPGetByte( HTTPInputSource *source ); /* unget byte back to input source */ void HTTPUngetByte( HTTPInputSource *source, uint byteValue ); /* check if input source at end */ Bool HTTPIsEOF( HTTPInputSource *source ); int parseURL( HTTPInputSource* source, tmbstr pUrl ); int openURL( HTTPInputSource* source, tmbstr pUrl ); void closeURL( HTTPInputSource *source ); #endiftidy-html5-5.2.0/include/000077500000000000000000000000001272601517300151455ustar00rootroot00000000000000tidy-html5-5.2.0/include/tidy.h000077500000000000000000001273601272601517300163030ustar00rootroot00000000000000#ifndef __TIDY_H__ #define __TIDY_H__ /** @file tidy.h - Defines HTML Tidy API implemented by tidy library. Public interface is const-correct and doesn't explicitly depend on any globals. Thus, thread-safety may be introduced w/out changing the interface. Looking ahead to a C++ wrapper, C functions always pass this-equivalent as 1st arg. Copyright (c) 1998-2008 World Wide Web Consortium (Massachusetts Institute of Technology, European Research Consortium for Informatics and Mathematics, Keio University). All Rights Reserved. Contributing Author(s): Dave Raggett The contributing author(s) would like to thank all those who helped with testing, bug fixes and suggestions for improvements. This wouldn't have been possible without your help. COPYRIGHT NOTICE: This software and documentation is provided "as is," and the copyright holders and contributing author(s) make no representations or warranties, express or implied, including but not limited to, warranties of merchantability or fitness for any particular purpose or that the use of the software or documentation will not infringe any third party patents, copyrights, trademarks or other rights. The copyright holders and contributing author(s) will not be held liable for any direct, indirect, special or consequential damages arising out of any use of the software or documentation, even if advised of the possibility of such damage. Permission is hereby granted to use, copy, modify, and distribute this source code, or portions hereof, documentation and executables, for any purpose, without fee, subject to the following restrictions: 1. The origin of this source code must not be misrepresented. 2. Altered versions must be plainly marked as such and must not be misrepresented as being the original source. 3. This Copyright notice may not be removed or altered from any source or altered source distribution. The copyright holders and contributing author(s) specifically permit, without fee, and encourage the use of this source code as a component for supporting the Hypertext Markup Language in commercial products. If you use this source code in a product, acknowledgment is not required but would be appreciated. Created 2001-05-20 by Charles Reitzel Updated 2002-07-01 by Charles Reitzel - 1st Implementation Updated 2015-06-09 by Geoff R. McLane - Add more doxygen syntax */ #include "tidyplatform.h" #include "tidyenum.h" #ifdef __cplusplus extern "C" { #endif /** @defgroup Opaque Opaque Types ** ** Cast to implementation types within lib. ** Reduces inter-dependencies/conflicts w/ application code. ** @{ */ /** @struct TidyDoc ** Opaque document datatype */ opaque_type( TidyDoc ); /** @struct TidyOption ** Opaque option datatype */ opaque_type( TidyOption ); /** @struct TidyNode ** Opaque node datatype */ opaque_type( TidyNode ); /** @struct TidyAttr ** Opaque attribute datatype */ opaque_type( TidyAttr ); /** @} end Opaque group */ TIDY_STRUCT struct _TidyBuffer; typedef struct _TidyBuffer TidyBuffer; /** @defgroup Memory Memory Allocation ** ** Tidy uses a user provided allocator for all ** memory allocations. If this allocator is ** not provided, then a default allocator is ** used which simply wraps standard C malloc/free ** calls. These wrappers call the panic function ** upon any failure. The default panic function ** prints an out of memory message to stderr, and ** calls exit(2). ** ** For applications in which it is unacceptable to ** abort in the case of memory allocation, then the ** panic function can be replaced with one which ** longjmps() out of the tidy code. For this to ** clean up completely, you should be careful not ** to use any tidy methods that open files as these ** will not be closed before panic() is called. ** ** TODO: associate file handles with tidyDoc and ** ensure that tidyDocRelease() can close them all. ** ** Calling the withAllocator() family ( ** tidyCreateWithAllocator, tidyBufInitWithAllocator, ** tidyBufAllocWithAllocator) allow settings custom ** allocators). ** ** All parts of the document use the same allocator. ** Calls that require a user provided buffer can ** optionally use a different allocator. ** ** For reference in designing a plug-in allocator, ** most allocations made by tidy are less than 100 ** bytes, corresponding to attribute names/values, etc. ** ** There is also an additional class of much larger ** allocations which are where most of the data from ** the lexer is stored. (It is not currently possible ** to use a separate allocator for the lexer, this ** would be a useful extension). ** ** In general, approximately 1/3rd of the memory ** used by tidy is freed during the parse, so if ** memory usage is an issue then an allocator that ** can reuse this memory is a good idea. ** ** @{ */ /** Prototype for the allocator's function table */ struct _TidyAllocatorVtbl; /** The allocators function table */ typedef struct _TidyAllocatorVtbl TidyAllocatorVtbl; /** Prototype for the allocator */ struct _TidyAllocator; /** The allocator **/ typedef struct _TidyAllocator TidyAllocator; /** An allocator's function table. All functions here must be provided. */ struct _TidyAllocatorVtbl { /** Called to allocate a block of nBytes of memory */ void* (TIDY_CALL *alloc)( TidyAllocator *self, size_t nBytes ); /** Called to resize (grow, in general) a block of memory. Must support being called with NULL. */ void* (TIDY_CALL *realloc)( TidyAllocator *self, void *block, size_t nBytes ); /** Called to free a previously allocated block of memory */ void (TIDY_CALL *free)( TidyAllocator *self, void *block); /** Called when a panic condition is detected. Must support block == NULL. This function is not called if either alloc or realloc fails; it is up to the allocator to do this. Currently this function can only be called if an error is detected in the tree integrity via the internal function CheckNodeIntegrity(). This is a situation that can only arise in the case of a programming error in tidylib. You can turn off node integrity checking by defining the constant NO_NODE_INTEGRITY_CHECK during the build. **/ void (TIDY_CALL *panic)( TidyAllocator *self, ctmbstr msg ); }; /** An allocator. To create your own allocator, do something like the following: \code typedef struct _MyAllocator { TidyAllocator base; ...other custom allocator state... } MyAllocator; void* MyAllocator_alloc(TidyAllocator *base, void *block, size_t nBytes) { MyAllocator *self = (MyAllocator*)base; ... } (etc) static const TidyAllocatorVtbl MyAllocatorVtbl = { MyAllocator_alloc, MyAllocator_realloc, MyAllocator_free, MyAllocator_panic }; myAllocator allocator; TidyDoc doc; allocator.base.vtbl = &MyAllocatorVtbl; ...initialise allocator specific state... doc = tidyCreateWithAllocator(&allocator); \endcode Although this looks slightly long winded, the advantage is that to create a custom allocator you simply need to set the vtbl pointer correctly. The vtbl itself can reside in static/global data, and hence does not need to be initialised each time an allocator is created, and furthermore the memory is shared amongst all created allocators. */ struct _TidyAllocator { const TidyAllocatorVtbl *vtbl; }; /** Callback for "malloc" replacement */ typedef void* (TIDY_CALL *TidyMalloc)( size_t len ); /** Callback for "realloc" replacement */ typedef void* (TIDY_CALL *TidyRealloc)( void* buf, size_t len ); /** Callback for "free" replacement */ typedef void (TIDY_CALL *TidyFree)( void* buf ); /** Callback for "out of memory" panic state */ typedef void (TIDY_CALL *TidyPanic)( ctmbstr mssg ); /** Give Tidy a malloc() replacement */ TIDY_EXPORT Bool TIDY_CALL tidySetMallocCall( TidyMalloc fmalloc ); /** Give Tidy a realloc() replacement */ TIDY_EXPORT Bool TIDY_CALL tidySetReallocCall( TidyRealloc frealloc ); /** Give Tidy a free() replacement */ TIDY_EXPORT Bool TIDY_CALL tidySetFreeCall( TidyFree ffree ); /** Give Tidy an "out of memory" handler */ TIDY_EXPORT Bool TIDY_CALL tidySetPanicCall( TidyPanic fpanic ); /** @} end Memory group */ /** @defgroup Basic Basic Operations ** ** Tidy public interface ** ** Several functions return an integer document status: ** **
** 0    -> SUCCESS
** >0   -> 1 == TIDY WARNING, 2 == TIDY ERROR
** <0   -> SEVERE ERROR
** 
** The following is a short example program.
\#include <tidy.h>
\#include <tidybuffio.h>
\#include <stdio.h>
\#include <errno.h>


int main(int argc, char **argv )
{
  const char* input = "<title>Foo</title><p>Foo!";
  TidyBuffer output;
  TidyBuffer errbuf;
  int rc = -1;
  Bool ok;

  TidyDoc tdoc = tidyCreate();                     // Initialize "document"
  tidyBufInit( &output );
  tidyBufInit( &errbuf );
  printf( "Tidying:\t\%s\\n", input );

  ok = tidyOptSetBool( tdoc, TidyXhtmlOut, yes );  // Convert to XHTML
  if ( ok )
    rc = tidySetErrorBuffer( tdoc, &errbuf );      // Capture diagnostics
  if ( rc >= 0 )
    rc = tidyParseString( tdoc, input );           // Parse the input
  if ( rc >= 0 )
    rc = tidyCleanAndRepair( tdoc );               // Tidy it up!
  if ( rc >= 0 )
    rc = tidyRunDiagnostics( tdoc );               // Kvetch
  if ( rc > 1 )                                    // If error, force output.
    rc = ( tidyOptSetBool(tdoc, TidyForceOutput, yes) ? rc : -1 );
  if ( rc >= 0 )
    rc = tidySaveBuffer( tdoc, &output );          // Pretty Print

  if ( rc >= 0 )
  {
    if ( rc > 0 )
      printf( "\\nDiagnostics:\\n\\n\%s", errbuf.bp );
    printf( "\\nAnd here is the result:\\n\\n\%s", output.bp );
  }
  else
    printf( "A severe error (\%d) occurred.\\n", rc );

  tidyBufFree( &output );
  tidyBufFree( &errbuf );
  tidyRelease( tdoc );
  return rc;
}
** @{ */ /** The primary creation of a TidyDoc. ** This must be the first call before most of the Tidy API which require the TidyDoc parameter. ** When completed tidyRelease( TidyDoc tdoc ); should be called to release all memory */ TIDY_EXPORT TidyDoc TIDY_CALL tidyCreate(void); /** Create a Tidoc supplying the TidyAllocator. ** See the TidyAllocator structure for creating an allocator */ TIDY_EXPORT TidyDoc TIDY_CALL tidyCreateWithAllocator( TidyAllocator *allocator ); /** Free all memory and release the TidyDoc. ** TidyDoc can not be used after this call. */ TIDY_EXPORT void TIDY_CALL tidyRelease( TidyDoc tdoc ); /** Let application store a chunk of data w/ each Tidy instance. ** Useful for callbacks. */ TIDY_EXPORT void TIDY_CALL tidySetAppData( TidyDoc tdoc, void* appData ); /** Get application data set previously */ TIDY_EXPORT void* TIDY_CALL tidyGetAppData( TidyDoc tdoc ); /** Get release date (version) for current library ** @deprecated tidyReleaseDate() is deprecated in favor of semantic ** versioning and should be replaced with tidyLibraryVersion(). */ TIDY_EXPORT ctmbstr TIDY_CALL tidyReleaseDate(void); /** Get version number for the current library */ TIDY_EXPORT ctmbstr TIDY_CALL tidyLibraryVersion(void); /* Diagnostics and Repair */ /** Get status of current document. */ TIDY_EXPORT int TIDY_CALL tidyStatus( TidyDoc tdoc ); /** Detected HTML version: 0, 2, 3 or 4 */ TIDY_EXPORT int TIDY_CALL tidyDetectedHtmlVersion( TidyDoc tdoc ); /** Input is XHTML? */ TIDY_EXPORT Bool TIDY_CALL tidyDetectedXhtml( TidyDoc tdoc ); /** Input is generic XML (not HTML or XHTML)? */ TIDY_EXPORT Bool TIDY_CALL tidyDetectedGenericXml( TidyDoc tdoc ); /** Number of Tidy errors encountered. If > 0, output is suppressed ** unless TidyForceOutput is set. */ TIDY_EXPORT uint TIDY_CALL tidyErrorCount( TidyDoc tdoc ); /** Number of Tidy warnings encountered. */ TIDY_EXPORT uint TIDY_CALL tidyWarningCount( TidyDoc tdoc ); /** Number of Tidy accessibility warnings encountered. */ TIDY_EXPORT uint TIDY_CALL tidyAccessWarningCount( TidyDoc tdoc ); /** Number of Tidy configuration errors encountered. */ TIDY_EXPORT uint TIDY_CALL tidyConfigErrorCount( TidyDoc tdoc ); /* Get/Set configuration options */ /** Load an ASCII Tidy configuration file */ TIDY_EXPORT int TIDY_CALL tidyLoadConfig( TidyDoc tdoc, ctmbstr configFile ); /** Load a Tidy configuration file with the specified character encoding */ TIDY_EXPORT int TIDY_CALL tidyLoadConfigEnc( TidyDoc tdoc, ctmbstr configFile, ctmbstr charenc ); TIDY_EXPORT Bool TIDY_CALL tidyFileExists( TidyDoc tdoc, ctmbstr filename ); /** Set the input/output character encoding for parsing markup. ** Values include: ascii, latin1, raw, utf8, iso2022, mac, ** win1252, utf16le, utf16be, utf16, big5 and shiftjis. Case in-sensitive. */ TIDY_EXPORT int TIDY_CALL tidySetCharEncoding( TidyDoc tdoc, ctmbstr encnam ); /** Set the input encoding for parsing markup. ** As for tidySetCharEncoding but only affects the input encoding **/ TIDY_EXPORT int TIDY_CALL tidySetInCharEncoding( TidyDoc tdoc, ctmbstr encnam ); /** Set the output encoding. **/ TIDY_EXPORT int TIDY_CALL tidySetOutCharEncoding( TidyDoc tdoc, ctmbstr encnam ); /** @} end Basic group */ /** @defgroup Configuration Configuration Options ** ** Functions for getting and setting Tidy configuration options. ** @{ */ /** Applications using TidyLib may want to augment command-line and ** configuration file options. Setting this callback allows an application ** developer to examine command-line and configuration file options after ** TidyLib has examined them and failed to recognize them. **/ typedef Bool (TIDY_CALL *TidyOptCallback)( ctmbstr option, ctmbstr value ); TIDY_EXPORT Bool TIDY_CALL tidySetOptionCallback( TidyDoc tdoc, TidyOptCallback pOptCallback ); /** Get option ID by name */ TIDY_EXPORT TidyOptionId TIDY_CALL tidyOptGetIdForName( ctmbstr optnam ); /** Get iterator for list of option */ /** Example:
TidyIterator itOpt = tidyGetOptionList( tdoc );
while ( itOpt )
{
  TidyOption opt = tidyGetNextOption( tdoc, &itOpt );
  .. get/set option values ..
}
*/ TIDY_EXPORT TidyIterator TIDY_CALL tidyGetOptionList( TidyDoc tdoc ); /** Get next Option */ TIDY_EXPORT TidyOption TIDY_CALL tidyGetNextOption( TidyDoc tdoc, TidyIterator* pos ); /** Lookup option by ID */ TIDY_EXPORT TidyOption TIDY_CALL tidyGetOption( TidyDoc tdoc, TidyOptionId optId ); /** Lookup option by name */ TIDY_EXPORT TidyOption TIDY_CALL tidyGetOptionByName( TidyDoc tdoc, ctmbstr optnam ); /** Get ID of given Option */ TIDY_EXPORT TidyOptionId TIDY_CALL tidyOptGetId( TidyOption opt ); /** Get name of given Option */ TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetName( TidyOption opt ); /** Get datatype of given Option */ TIDY_EXPORT TidyOptionType TIDY_CALL tidyOptGetType( TidyOption opt ); /** Is Option read-only? */ TIDY_EXPORT Bool TIDY_CALL tidyOptIsReadOnly( TidyOption opt ); /** Get category of given Option */ TIDY_EXPORT TidyConfigCategory TIDY_CALL tidyOptGetCategory( TidyOption opt ); /** Get default value of given Option as a string */ TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetDefault( TidyOption opt ); /** Get default value of given Option as an unsigned integer */ TIDY_EXPORT ulong TIDY_CALL tidyOptGetDefaultInt( TidyOption opt ); /** Get default value of given Option as a Boolean value */ TIDY_EXPORT Bool TIDY_CALL tidyOptGetDefaultBool( TidyOption opt ); /** Iterate over Option "pick list" */ TIDY_EXPORT TidyIterator TIDY_CALL tidyOptGetPickList( TidyOption opt ); /** Get next string value of Option "pick list" */ TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetNextPick( TidyOption opt, TidyIterator* pos ); /** Get current Option value as a string */ TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetValue( TidyDoc tdoc, TidyOptionId optId ); /** Set Option value as a string */ TIDY_EXPORT Bool TIDY_CALL tidyOptSetValue( TidyDoc tdoc, TidyOptionId optId, ctmbstr val ); /** Set named Option value as a string. Good if not sure of type. */ TIDY_EXPORT Bool TIDY_CALL tidyOptParseValue( TidyDoc tdoc, ctmbstr optnam, ctmbstr val ); /** Get current Option value as an integer */ TIDY_EXPORT ulong TIDY_CALL tidyOptGetInt( TidyDoc tdoc, TidyOptionId optId ); /** Set Option value as an integer */ TIDY_EXPORT Bool TIDY_CALL tidyOptSetInt( TidyDoc tdoc, TidyOptionId optId, ulong val ); /** Get current Option value as a Boolean flag */ TIDY_EXPORT Bool TIDY_CALL tidyOptGetBool( TidyDoc tdoc, TidyOptionId optId ); /** Set Option value as a Boolean flag */ TIDY_EXPORT Bool TIDY_CALL tidyOptSetBool( TidyDoc tdoc, TidyOptionId optId, Bool val ); /** Reset option to default value by ID */ TIDY_EXPORT Bool TIDY_CALL tidyOptResetToDefault( TidyDoc tdoc, TidyOptionId opt ); /** Reset all options to their default values */ TIDY_EXPORT Bool TIDY_CALL tidyOptResetAllToDefault( TidyDoc tdoc ); /** Take a snapshot of current config settings */ TIDY_EXPORT Bool TIDY_CALL tidyOptSnapshot( TidyDoc tdoc ); /** Reset config settings to snapshot (after document processing) */ TIDY_EXPORT Bool TIDY_CALL tidyOptResetToSnapshot( TidyDoc tdoc ); /** Any settings different than default? */ TIDY_EXPORT Bool TIDY_CALL tidyOptDiffThanDefault( TidyDoc tdoc ); /** Any settings different than snapshot? */ TIDY_EXPORT Bool TIDY_CALL tidyOptDiffThanSnapshot( TidyDoc tdoc ); /** Copy current configuration settings from one document to another */ TIDY_EXPORT Bool TIDY_CALL tidyOptCopyConfig( TidyDoc tdocTo, TidyDoc tdocFrom ); /** Get character encoding name. Used with TidyCharEncoding, ** TidyOutCharEncoding, TidyInCharEncoding */ TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetEncName( TidyDoc tdoc, TidyOptionId optId ); /** Get current pick list value for option by ID. Useful for enum types. */ TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetCurrPick( TidyDoc tdoc, TidyOptionId optId); /** Iterate over user declared tags */ TIDY_EXPORT TidyIterator TIDY_CALL tidyOptGetDeclTagList( TidyDoc tdoc ); /** Get next declared tag of specified type: TidyInlineTags, TidyBlockTags, ** TidyEmptyTags, TidyPreTags */ TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetNextDeclTag( TidyDoc tdoc, TidyOptionId optId, TidyIterator* iter ); /** Get option description */ TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetDoc( TidyDoc tdoc, TidyOption opt ); /** Iterate over a list of related options */ TIDY_EXPORT TidyIterator TIDY_CALL tidyOptGetDocLinksList( TidyDoc tdoc, TidyOption opt ); /** Get next related option */ TIDY_EXPORT TidyOption TIDY_CALL tidyOptGetNextDocLinks( TidyDoc tdoc, TidyIterator* pos ); /** @} end Configuration group */ /** @defgroup IO I/O and Messages ** ** By default, Tidy will define, create and use ** instances of input and output handlers for ** standard C buffered I/O (i.e. FILE* stdin, ** FILE* stdout and FILE* stderr for content ** input, content output and diagnostic output, ** respectively. A FILE* cfgFile input handler ** will be used for config files. Command line ** options will just be set directly. ** ** @{ */ /***************** Input Source *****************/ /** Input Callback: get next byte of input */ typedef int (TIDY_CALL *TidyGetByteFunc)( void* sourceData ); /** Input Callback: unget a byte of input */ typedef void (TIDY_CALL *TidyUngetByteFunc)( void* sourceData, byte bt ); /** Input Callback: is end of input? */ typedef Bool (TIDY_CALL *TidyEOFFunc)( void* sourceData ); /** End of input "character" */ #define EndOfStream (~0u) /** TidyInputSource - Delivers raw bytes of input */ TIDY_STRUCT typedef struct _TidyInputSource { /* Instance data */ void* sourceData; /**< Input context. Passed to callbacks */ /* Methods */ TidyGetByteFunc getByte; /**< Pointer to "get byte" callback */ TidyUngetByteFunc ungetByte; /**< Pointer to "unget" callback */ TidyEOFFunc eof; /**< Pointer to "eof" callback */ } TidyInputSource; /** Facilitates user defined source by providing ** an entry point to marshal pointers-to-functions. ** Needed by .NET and possibly other language bindings. */ TIDY_EXPORT Bool TIDY_CALL tidyInitSource( TidyInputSource* source, void* srcData, TidyGetByteFunc gbFunc, TidyUngetByteFunc ugbFunc, TidyEOFFunc endFunc ); /** Helper: get next byte from input source */ TIDY_EXPORT uint TIDY_CALL tidyGetByte( TidyInputSource* source ); /** Helper: unget byte back to input source */ TIDY_EXPORT void TIDY_CALL tidyUngetByte( TidyInputSource* source, uint byteValue ); /** Helper: check if input source at end */ TIDY_EXPORT Bool TIDY_CALL tidyIsEOF( TidyInputSource* source ); /**************** Output Sink ****************/ /** Output callback: send a byte to output */ typedef void (TIDY_CALL *TidyPutByteFunc)( void* sinkData, byte bt ); /** TidyOutputSink - accepts raw bytes of output */ TIDY_STRUCT typedef struct _TidyOutputSink { /* Instance data */ void* sinkData; /**< Output context. Passed to callbacks */ /* Methods */ TidyPutByteFunc putByte; /**< Pointer to "put byte" callback */ } TidyOutputSink; /** Facilitates user defined sinks by providing ** an entry point to marshal pointers-to-functions. ** Needed by .NET and possibly other language bindings. */ TIDY_EXPORT Bool TIDY_CALL tidyInitSink( TidyOutputSink* sink, void* snkData, TidyPutByteFunc pbFunc ); /** Helper: send a byte to output */ TIDY_EXPORT void TIDY_CALL tidyPutByte( TidyOutputSink* sink, uint byteValue ); /**************** Errors ****************/ /** Callback to filter messages by diagnostic level: ** info, warning, etc. Just set diagnostic output ** handler to redirect all diagnostics output. Return true ** to proceed with output, false to cancel. */ typedef Bool (TIDY_CALL *TidyReportFilter)( TidyDoc tdoc, TidyReportLevel lvl, uint line, uint col, ctmbstr mssg ); typedef Bool (TIDY_CALL *TidyReportFilter2)( TidyDoc tdoc, TidyReportLevel lvl, uint line, uint col, ctmbstr mssg, va_list args ); typedef Bool (TIDY_CALL *TidyReportFilter3)( TidyDoc tdoc, TidyReportLevel lvl, uint line, uint col, ctmbstr code, va_list args ); /** Give Tidy a filter callback to use */ TIDY_EXPORT Bool TIDY_CALL tidySetReportFilter( TidyDoc tdoc, TidyReportFilter filtCallback ); TIDY_EXPORT Bool TIDY_CALL tidySetReportFilter2( TidyDoc tdoc, TidyReportFilter2 filtCallback ); TIDY_EXPORT Bool TIDY_CALL tidySetReportFilter3( TidyDoc tdoc, TidyReportFilter3 filtCallback ); /** Set error sink to named file */ TIDY_EXPORT FILE* TIDY_CALL tidySetErrorFile( TidyDoc tdoc, ctmbstr errfilnam ); /** Set error sink to given buffer */ TIDY_EXPORT int TIDY_CALL tidySetErrorBuffer( TidyDoc tdoc, TidyBuffer* errbuf ); /** Set error sink to given generic sink */ TIDY_EXPORT int TIDY_CALL tidySetErrorSink( TidyDoc tdoc, TidyOutputSink* sink ); /**************** Printing ****************/ /** Callback to track the progress of the pretting printing process. ** */ typedef void (TIDY_CALL *TidyPPProgress)( TidyDoc tdoc, uint line, uint col, uint destLine ); TIDY_EXPORT Bool TIDY_CALL tidySetPrettyPrinterCallback( TidyDoc tdoc, TidyPPProgress callback ); /** @} end IO group */ /* TODO: Catalog all messages for easy translation TIDY_EXPORT ctmbstr tidyLookupMessage( int errorNo ); */ /** @defgroup Parse Document Parse ** ** Parse markup from a given input source. String and filename ** functions added for convenience. HTML/XHTML version determined ** from input. ** @{ */ /** Parse markup in named file */ TIDY_EXPORT int TIDY_CALL tidyParseFile( TidyDoc tdoc, ctmbstr filename ); /** Parse markup from the standard input */ TIDY_EXPORT int TIDY_CALL tidyParseStdin( TidyDoc tdoc ); /** Parse markup in given string */ TIDY_EXPORT int TIDY_CALL tidyParseString( TidyDoc tdoc, ctmbstr content ); /** Parse markup in given buffer */ TIDY_EXPORT int TIDY_CALL tidyParseBuffer( TidyDoc tdoc, TidyBuffer* buf ); /** Parse markup in given generic input source */ TIDY_EXPORT int TIDY_CALL tidyParseSource( TidyDoc tdoc, TidyInputSource* source); /** @} End Parse group */ /** @defgroup Clean Diagnostics and Repair ** ** @{ */ /** Execute configured cleanup and repair operations on parsed markup */ TIDY_EXPORT int TIDY_CALL tidyCleanAndRepair( TidyDoc tdoc ); /** Run configured diagnostics on parsed and repaired markup. ** Must call tidyCleanAndRepair() first. */ TIDY_EXPORT int TIDY_CALL tidyRunDiagnostics( TidyDoc tdoc ); TIDY_EXPORT int TIDY_CALL tidyReportDoctype( TidyDoc tdoc ); /** @} end Clean group */ /** @defgroup Save Document Save Functions ** ** Save currently parsed document to the given output sink. File name ** and string/buffer functions provided for convenience. ** @{ */ /** Save to named file */ TIDY_EXPORT int TIDY_CALL tidySaveFile( TidyDoc tdoc, ctmbstr filename ); /** Save to standard output (FILE*) */ TIDY_EXPORT int TIDY_CALL tidySaveStdout( TidyDoc tdoc ); /** Save to given TidyBuffer object */ TIDY_EXPORT int TIDY_CALL tidySaveBuffer( TidyDoc tdoc, TidyBuffer* buf ); /** Save document to application buffer. If TidyShowMarkup and ** the document has no errors, or TidyForceOutput, the current ** document, per the current configuration, will be Pretty Printed ** to the application buffer. The document byte length, ** not character length, will be placed in *buflen. The document ** will not be null terminated. If the buffer is not big enough, ** ENOMEM will be returned, else the actual document status. */ TIDY_EXPORT int TIDY_CALL tidySaveString( TidyDoc tdoc, tmbstr buffer, uint* buflen ); /** Save to given generic output sink */ TIDY_EXPORT int TIDY_CALL tidySaveSink( TidyDoc tdoc, TidyOutputSink* sink ); /** @} end Save group */ /** @addtogroup Basic ** @{ */ /** Save current settings to named file. Only non-default values are written. */ TIDY_EXPORT int TIDY_CALL tidyOptSaveFile( TidyDoc tdoc, ctmbstr cfgfil ); /** Save current settings to given output sink. Only non-default values are written. */ TIDY_EXPORT int TIDY_CALL tidyOptSaveSink( TidyDoc tdoc, TidyOutputSink* sink ); /* Error reporting functions */ /** Write more complete information about errors to current error sink. */ TIDY_EXPORT void TIDY_CALL tidyErrorSummary( TidyDoc tdoc ); /** Write more general information about markup to current error sink. */ TIDY_EXPORT void TIDY_CALL tidyGeneralInfo( TidyDoc tdoc ); /** @} end Basic group (again) */ /** @defgroup Tree Document Tree ** ** A parsed and, optionally, repaired document is ** represented by Tidy as a Tree, much like a W3C DOM. ** This tree may be traversed using these functions. ** The following snippet gives a basic idea how these ** functions can be used. **
void dumpNode( TidyNode tnod, int indent )
{
  TidyNode child;

  for ( child = tidyGetChild(tnod); child; child = tidyGetNext(child) )
  {
    ctmbstr name;
    switch ( tidyNodeGetType(child) )
    {
    case TidyNode_Root:       name = "Root";                    break;
    case TidyNode_DocType:    name = "DOCTYPE";                 break;
    case TidyNode_Comment:    name = "Comment";                 break;
    case TidyNode_ProcIns:    name = "Processing Instruction";  break;
    case TidyNode_Text:       name = "Text";                    break;
    case TidyNode_CDATA:      name = "CDATA";                   break;
    case TidyNode_Section:    name = "XML Section";             break;
    case TidyNode_Asp:        name = "ASP";                     break;
    case TidyNode_Jste:       name = "JSTE";                    break;
    case TidyNode_Php:        name = "PHP";                     break;
    case TidyNode_XmlDecl:    name = "XML Declaration";         break;

    case TidyNode_Start:
    case TidyNode_End:
    case TidyNode_StartEnd:
    default:
      name = tidyNodeGetName( child );
      break;
    }
    assert( name != NULL );
    printf( "\%*.*sNode: \%s\\n", indent, indent, " ", name );
    dumpNode( child, indent + 4 );
  }
}

void dumpDoc( TidyDoc tdoc )
{
  dumpNode( tidyGetRoot(tdoc), 0 );
}

void dumpBody( TidyDoc tdoc )
{
  dumpNode( tidyGetBody(tdoc), 0 );
}
@{ */ TIDY_EXPORT TidyNode TIDY_CALL tidyGetRoot( TidyDoc tdoc ); TIDY_EXPORT TidyNode TIDY_CALL tidyGetHtml( TidyDoc tdoc ); TIDY_EXPORT TidyNode TIDY_CALL tidyGetHead( TidyDoc tdoc ); TIDY_EXPORT TidyNode TIDY_CALL tidyGetBody( TidyDoc tdoc ); /* remove a node */ TIDY_EXPORT TidyNode TIDY_CALL tidyDiscardElement( TidyDoc tdoc, TidyNode tnod ); /* parent / child */ TIDY_EXPORT TidyNode TIDY_CALL tidyGetParent( TidyNode tnod ); TIDY_EXPORT TidyNode TIDY_CALL tidyGetChild( TidyNode tnod ); /* siblings */ TIDY_EXPORT TidyNode TIDY_CALL tidyGetNext( TidyNode tnod ); TIDY_EXPORT TidyNode TIDY_CALL tidyGetPrev( TidyNode tnod ); /* Null for non-element nodes and all pure HTML TIDY_EXPORT ctmbstr tidyNodeNsLocal( TidyNode tnod ); TIDY_EXPORT ctmbstr tidyNodeNsPrefix( TidyNode tnod ); TIDY_EXPORT ctmbstr tidyNodeNsUri( TidyNode tnod ); */ /* Iterate over attribute values */ TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrFirst( TidyNode tnod ); TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrNext( TidyAttr tattr ); TIDY_EXPORT ctmbstr TIDY_CALL tidyAttrName( TidyAttr tattr ); TIDY_EXPORT ctmbstr TIDY_CALL tidyAttrValue( TidyAttr tattr ); TIDY_EXPORT void TIDY_CALL tidyAttrDiscard( TidyDoc itdoc, TidyNode tnod, TidyAttr tattr ); /* Null for pure HTML TIDY_EXPORT ctmbstr tidyAttrNsLocal( TidyAttr tattr ); TIDY_EXPORT ctmbstr tidyAttrNsPrefix( TidyAttr tattr ); TIDY_EXPORT ctmbstr tidyAttrNsUri( TidyAttr tattr ); */ /** @} end Tree group */ /** @defgroup NodeAsk Node Interrogation ** ** Get information about any givent node. ** @{ */ /* Node info */ TIDY_EXPORT TidyNodeType TIDY_CALL tidyNodeGetType( TidyNode tnod ); TIDY_EXPORT ctmbstr TIDY_CALL tidyNodeGetName( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsText( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsProp( TidyDoc tdoc, TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsHeader( TidyNode tnod ); /* h1, h2, ... */ TIDY_EXPORT Bool TIDY_CALL tidyNodeHasText( TidyDoc tdoc, TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeGetText( TidyDoc tdoc, TidyNode tnod, TidyBuffer* buf ); /* Copy the unescaped value of this node into the given TidyBuffer as UTF-8 */ TIDY_EXPORT Bool TIDY_CALL tidyNodeGetValue( TidyDoc tdoc, TidyNode tnod, TidyBuffer* buf ); TIDY_EXPORT TidyTagId TIDY_CALL tidyNodeGetId( TidyNode tnod ); TIDY_EXPORT uint TIDY_CALL tidyNodeLine( TidyNode tnod ); TIDY_EXPORT uint TIDY_CALL tidyNodeColumn( TidyNode tnod ); /** @defgroup NodeIsElementName Deprecated node interrogation per TagId ** ** @deprecated The functions tidyNodeIs{ElementName} are deprecated and ** should be replaced by tidyNodeGetId. ** @{ */ TIDY_EXPORT Bool TIDY_CALL tidyNodeIsHTML( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsHEAD( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsTITLE( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsBASE( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsMETA( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsBODY( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsFRAMESET( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsFRAME( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsIFRAME( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsNOFRAMES( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsHR( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsH1( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsH2( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsPRE( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsLISTING( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsP( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsUL( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsOL( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsDL( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsDIR( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsLI( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsDT( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsDD( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsTABLE( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsCAPTION( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsTD( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsTH( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsTR( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsCOL( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsCOLGROUP( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsBR( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsA( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsLINK( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsB( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsI( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSTRONG( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsEM( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsBIG( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSMALL( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsPARAM( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsOPTION( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsOPTGROUP( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsIMG( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsMAP( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsAREA( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsNOBR( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsWBR( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsFONT( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsLAYER( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSPACER( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsCENTER( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSTYLE( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSCRIPT( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsNOSCRIPT( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsFORM( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsTEXTAREA( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsBLOCKQUOTE( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsAPPLET( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsOBJECT( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsDIV( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSPAN( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsINPUT( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsQ( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsLABEL( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsH3( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsH4( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsH5( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsH6( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsADDRESS( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsXMP( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSELECT( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsBLINK( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsMARQUEE( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsEMBED( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsBASEFONT( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsISINDEX( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsS( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSTRIKE( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsU( TidyNode tnod ); TIDY_EXPORT Bool TIDY_CALL tidyNodeIsMENU( TidyNode tnod ); /* HTML5 */ TIDY_EXPORT Bool TIDY_CALL tidyNodeIsDATALIST( TidyNode tnod ); // bit like OPTIONS /** @} End NodeIsElementName group */ /** @} End NodeAsk group */ /** @defgroup Attribute Attribute Interrogation ** ** Get information about any given attribute. ** @{ */ TIDY_EXPORT TidyAttrId TIDY_CALL tidyAttrGetId( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsEvent( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsProp( TidyAttr tattr ); /** @defgroup AttrIsAttributeName Deprecated attribute interrogation per AttrId ** ** @deprecated The functions tidyAttrIs{AttributeName} are deprecated and ** should be replaced by tidyAttrGetId. ** @{ */ TIDY_EXPORT Bool TIDY_CALL tidyAttrIsHREF( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsSRC( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsID( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsNAME( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsSUMMARY( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsALT( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsLONGDESC( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsUSEMAP( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsISMAP( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsLANGUAGE( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsTYPE( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsVALUE( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsCONTENT( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsTITLE( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsXMLNS( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsDATAFLD( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsWIDTH( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsHEIGHT( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsFOR( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsSELECTED( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsCHECKED( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsLANG( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsTARGET( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsHTTP_EQUIV( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsREL( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnMOUSEMOVE( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnMOUSEDOWN( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnMOUSEUP( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnCLICK( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnMOUSEOVER( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnMOUSEOUT( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnKEYDOWN( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnKEYUP( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnKEYPRESS( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnFOCUS( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnBLUR( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsBGCOLOR( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsLINK( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsALINK( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsVLINK( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsTEXT( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsSTYLE( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsABBR( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsCOLSPAN( TidyAttr tattr ); TIDY_EXPORT Bool TIDY_CALL tidyAttrIsROWSPAN( TidyAttr tattr ); /** @} End AttrIsAttributeName group */ /** @} end AttrAsk group */ /** @defgroup AttrGet Attribute Retrieval ** ** Lookup an attribute from a given node ** @{ */ TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetById( TidyNode tnod, TidyAttrId attId ); /** @defgroup AttrGetAttributeName Deprecated attribute retrieval per AttrId ** ** @deprecated The functions tidyAttrGet{AttributeName} are deprecated and ** should be replaced by tidyAttrGetById. ** For instance, tidyAttrGetID( TidyNode tnod ) can be replaced by ** tidyAttrGetById( TidyNode tnod, TidyAttr_ID ). This avoids a potential ** name clash with tidyAttrGetId for case-insensitive languages. ** @{ */ TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetHREF( TidyNode tnod ); TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetSRC( TidyNode tnod ); TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetID( TidyNode tnod ); TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetNAME( TidyNode tnod ); TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetSUMMARY( TidyNode tnod ); TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetALT( TidyNode tnod ); TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetLONGDESC( TidyNode tnod ); TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetUSEMAP( TidyNode tnod ); TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetISMAP( TidyNode tnod ); TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetLANGUAGE( TidyNode tnod ); TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetTYPE( TidyNode tnod ); TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetVALUE( TidyNode tnod ); TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetCONTENT( TidyNode tnod ); TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetTITLE( TidyNode tnod ); TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetXMLNS( TidyNode tnod ); TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetDATAFLD( TidyNode tnod ); TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetWIDTH( TidyNode tnod ); TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetHEIGHT( TidyNode tnod ); TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetFOR( TidyNode tnod ); TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetSELECTED( TidyNode tnod ); TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetCHECKED( TidyNode tnod ); TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetLANG( TidyNode tnod ); TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetTARGET( TidyNode tnod ); TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetHTTP_EQUIV( TidyNode tnod ); TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetREL( TidyNode tnod ); TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnMOUSEMOVE( TidyNode tnod ); TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnMOUSEDOWN( TidyNode tnod ); TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnMOUSEUP( TidyNode tnod ); TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnCLICK( TidyNode tnod ); TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnMOUSEOVER( TidyNode tnod ); TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnMOUSEOUT( TidyNode tnod ); TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnKEYDOWN( TidyNode tnod ); TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnKEYUP( TidyNode tnod ); TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnKEYPRESS( TidyNode tnod ); TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnFOCUS( TidyNode tnod ); TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnBLUR( TidyNode tnod ); TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetBGCOLOR( TidyNode tnod ); TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetLINK( TidyNode tnod ); TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetALINK( TidyNode tnod ); TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetVLINK( TidyNode tnod ); TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetTEXT( TidyNode tnod ); TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetSTYLE( TidyNode tnod ); TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetABBR( TidyNode tnod ); TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetCOLSPAN( TidyNode tnod ); TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetROWSPAN( TidyNode tnod ); /** @} End AttrGetAttributeName group */ /** @} end AttrGet group */ #ifdef __cplusplus } /* extern "C" */ #endif #endif /* __TIDY_H__ */ /* * local variables: * mode: c * indent-tabs-mode: nil * c-basic-offset: 4 * eval: (c-set-offset 'substatement-open 0) * end: */ tidy-html5-5.2.0/include/tidybuffio.h000066400000000000000000000066071272601517300174730ustar00rootroot00000000000000#ifndef __TIDY_BUFFIO_H__ #define __TIDY_BUFFIO_H__ /** @file tidybuffio.h - Treat buffer as an I/O stream. (c) 1998-2007 (W3C) MIT, ERCIM, Keio University See tidy.h for the copyright notice. Requires buffer to automatically grow as bytes are added. Must keep track of current read and write points. */ #include "tidyplatform.h" #include "tidy.h" #ifdef __cplusplus extern "C" { #endif /** TidyBuffer - A chunk of memory */ TIDY_STRUCT struct _TidyBuffer { TidyAllocator* allocator; /**< Memory allocator */ byte* bp; /**< Pointer to bytes */ uint size; /**< # bytes currently in use */ uint allocated; /**< # bytes allocated */ uint next; /**< Offset of current input position */ }; /** Initialize data structure using the default allocator */ TIDY_EXPORT void TIDY_CALL tidyBufInit( TidyBuffer* buf ); /** Initialize data structure using the given custom allocator */ TIDY_EXPORT void TIDY_CALL tidyBufInitWithAllocator( TidyBuffer* buf, TidyAllocator* allocator ); /** Free current buffer, allocate given amount, reset input pointer, use the default allocator */ TIDY_EXPORT void TIDY_CALL tidyBufAlloc( TidyBuffer* buf, uint allocSize ); /** Free current buffer, allocate given amount, reset input pointer, use the given custom allocator */ TIDY_EXPORT void TIDY_CALL tidyBufAllocWithAllocator( TidyBuffer* buf, TidyAllocator* allocator, uint allocSize ); /** Expand buffer to given size. ** Chunk size is minimum growth. Pass 0 for default of 256 bytes. */ TIDY_EXPORT void TIDY_CALL tidyBufCheckAlloc( TidyBuffer* buf, uint allocSize, uint chunkSize ); /** Free current contents and zero out */ TIDY_EXPORT void TIDY_CALL tidyBufFree( TidyBuffer* buf ); /** Set buffer bytes to 0 */ TIDY_EXPORT void TIDY_CALL tidyBufClear( TidyBuffer* buf ); /** Attach to existing buffer */ TIDY_EXPORT void TIDY_CALL tidyBufAttach( TidyBuffer* buf, byte* bp, uint size ); /** Detach from buffer. Caller must free. */ TIDY_EXPORT void TIDY_CALL tidyBufDetach( TidyBuffer* buf ); /** Append bytes to buffer. Expand if necessary. */ TIDY_EXPORT void TIDY_CALL tidyBufAppend( TidyBuffer* buf, void* vp, uint size ); /** Append one byte to buffer. Expand if necessary. */ TIDY_EXPORT void TIDY_CALL tidyBufPutByte( TidyBuffer* buf, byte bv ); /** Get byte from end of buffer */ TIDY_EXPORT int TIDY_CALL tidyBufPopByte( TidyBuffer* buf ); /** Get byte from front of buffer. Increment input offset. */ TIDY_EXPORT int TIDY_CALL tidyBufGetByte( TidyBuffer* buf ); /** At end of buffer? */ TIDY_EXPORT Bool TIDY_CALL tidyBufEndOfInput( TidyBuffer* buf ); /** Put a byte back into the buffer. Decrement input offset. */ TIDY_EXPORT void TIDY_CALL tidyBufUngetByte( TidyBuffer* buf, byte bv ); /************** TIDY **************/ /* Forward declarations */ /** Initialize a buffer input source */ TIDY_EXPORT void TIDY_CALL tidyInitInputBuffer( TidyInputSource* inp, TidyBuffer* buf ); /** Initialize a buffer output sink */ TIDY_EXPORT void TIDY_CALL tidyInitOutputBuffer( TidyOutputSink* outp, TidyBuffer* buf ); #ifdef __cplusplus } #endif #endif /* __TIDY_BUFFIO_H__ */ /* * local variables: * mode: c * indent-tabs-mode: nil * c-basic-offset: 4 * eval: (c-set-offset 'substatement-open 0) * end: */ tidy-html5-5.2.0/include/tidyenum.h000066400000000000000000000742321272601517300171640ustar00rootroot00000000000000#ifndef __TIDYENUM_H__ #define __TIDYENUM_H__ /* @file tidyenum.h -- Split public enums into separate header Simplifies enum re-use in various wrappers. e.g. SWIG generated wrappers and COM IDL files. Copyright (c) 1998-2008 World Wide Web Consortium (Massachusetts Institute of Technology, European Research Consortium for Informatics and Mathematics, Keio University). All Rights Reserved. Contributing Author(s): Dave Raggett The contributing author(s) would like to thank all those who helped with testing, bug fixes and suggestions for improvements. This wouldn't have been possible without your help. COPYRIGHT NOTICE: This software and documentation is provided "as is," and the copyright holders and contributing author(s) make no representations or warranties, express or implied, including but not limited to, warranties of merchantability or fitness for any particular purpose or that the use of the software or documentation will not infringe any third party patents, copyrights, trademarks or other rights. The copyright holders and contributing author(s) will not be held liable for any direct, indirect, special or consequential damages arising out of any use of the software or documentation, even if advised of the possibility of such damage. Permission is hereby granted to use, copy, modify, and distribute this source code, or portions hereof, documentation and executables, for any purpose, without fee, subject to the following restrictions: 1. The origin of this source code must not be misrepresented. 2. Altered versions must be plainly marked as such and must not be misrepresented as being the original source. 3. This Copyright notice may not be removed or altered from any source or altered source distribution. The copyright holders and contributing author(s) specifically permit, without fee, and encourage the use of this source code as a component for supporting the Hypertext Markup Language in commercial products. If you use this source code in a product, acknowledgment is not required but would be appreciated. Created 2001-05-20 by Charles Reitzel Updated 2002-07-01 by Charles Reitzel - 1st Implementation */ #ifdef __cplusplus extern "C" { #endif /* Enumerate configuration options */ /** Categories of Tidy configuration options */ typedef enum { TidyMarkup, /**< Markup options: (X)HTML version, etc */ TidyDiagnostics, /**< Diagnostics */ TidyPrettyPrint, /**< Output layout */ TidyEncoding, /**< Character encodings */ TidyMiscellaneous /**< File handling, message format, etc. */ } TidyConfigCategory; /** Option IDs Used to get/set option values. These TidyOptionId are used throughout libtidy, and also have associated localized strings to describe them. Note this enum MUST start at zero due to historical design-time decisions that make assumptions about this starting value. */ typedef enum { TidyUnknownOption, /**< Unknown option! */ TidyIndentSpaces, /**< Indentation n spaces/tabs */ TidyWrapLen, /**< Wrap margin */ TidyTabSize, /**< Expand tabs to n spaces */ TidyCharEncoding, /**< In/out character encoding */ TidyInCharEncoding, /**< Input character encoding (if different) */ TidyOutCharEncoding, /**< Output character encoding (if different) */ TidyNewline, /**< Output line ending (default to platform) */ TidyDoctypeMode, /**< See doctype property */ TidyDoctype, /**< User specified doctype */ TidyDuplicateAttrs, /**< Keep first or last duplicate attribute */ TidyAltText, /**< Default text for alt attribute */ /* obsolete */ TidySlideStyle, /**< Style sheet for slides: not used for anything yet */ TidyErrFile, /**< File name to write errors to */ TidyOutFile, /**< File name to write markup to */ TidyWriteBack, /**< If true then output tidied markup */ TidyShowMarkup, /**< If false, normal output is suppressed */ TidyShowInfo, /**< If true, info-level messages are shown */ TidyShowWarnings, /**< However errors are always shown */ TidyQuiet, /**< No 'Parsing X', guessed DTD or summary */ TidyIndentContent, /**< Indent content of appropriate tags */ /**< "auto" does text/block level content indentation */ TidyCoerceEndTags, /**< Coerce end tags from start tags where probably intended */ TidyOmitOptionalTags,/**< Suppress optional start tags and end tags */ TidyHideEndTags, /**< Legacy name for TidyOmitOptionalTags */ TidyXmlTags, /**< Treat input as XML */ TidyXmlOut, /**< Create output as XML */ TidyXhtmlOut, /**< Output extensible HTML */ TidyHtmlOut, /**< Output plain HTML, even for XHTML input. Yes means set explicitly. */ TidyXmlDecl, /**< Add for XML docs */ TidyUpperCaseTags, /**< Output tags in upper not lower case */ TidyUpperCaseAttrs, /**< Output attributes in upper not lower case */ TidyMakeBare, /**< Make bare HTML: remove Microsoft cruft */ TidyMakeClean, /**< Replace presentational clutter by style rules */ TidyGDocClean, /**< Clean up HTML exported from Google Docs */ TidyLogicalEmphasis, /**< Replace i by em and b by strong */ TidyDropPropAttrs, /**< Discard proprietary attributes */ TidyDropFontTags, /**< Discard presentation tags */ TidyDropEmptyElems, /**< Discard empty elements */ TidyDropEmptyParas, /**< Discard empty p elements */ TidyFixComments, /**< Fix comments with adjacent hyphens */ TidyBreakBeforeBR, /**< Output newline before
or not? */ /* obsolete */ TidyBurstSlides, /**< Create slides on each h2 element */ TidyNumEntities, /**< Use numeric entities */ TidyQuoteMarks, /**< Output " marks as " */ TidyQuoteNbsp, /**< Output non-breaking space as entity */ TidyQuoteAmpersand, /**< Output naked ampersand as & */ TidyWrapAttVals, /**< Wrap within attribute values */ TidyWrapScriptlets, /**< Wrap within JavaScript string literals */ TidyWrapSection, /**< Wrap within section tags */ TidyWrapAsp, /**< Wrap within ASP pseudo elements */ TidyWrapJste, /**< Wrap within JSTE pseudo elements */ TidyWrapPhp, /**< Wrap within PHP pseudo elements */ TidyFixBackslash, /**< Fix URLs by replacing \ with / */ TidyIndentAttributes,/**< Newline+indent before each attribute */ TidyXmlPIs, /**< If set to yes PIs must end with ?> */ TidyXmlSpace, /**< If set to yes adds xml:space attr as needed */ TidyEncloseBodyText, /**< If yes text at body is wrapped in P's */ TidyEncloseBlockText,/**< If yes text in blocks is wrapped in P's */ TidyKeepFileTimes, /**< If yes last modied time is preserved */ TidyWord2000, /**< Draconian cleaning for Word2000 */ TidyMark, /**< Add meta element indicating tidied doc */ TidyEmacs, /**< If true format error output for GNU Emacs */ TidyEmacsFile, /**< Name of current Emacs file */ TidyLiteralAttribs, /**< If true attributes may use newlines */ TidyBodyOnly, /**< Output BODY content only */ TidyFixUri, /**< Applies URI encoding if necessary */ TidyLowerLiterals, /**< Folds known attribute values to lower case */ TidyHideComments, /**< Hides all (real) comments in output */ TidyIndentCdata, /**< Indent section */ TidyForceOutput, /**< Output document even if errors were found */ TidyShowErrors, /**< Number of errors to put out */ TidyAsciiChars, /**< Convert quotes and dashes to nearest ASCII char */ TidyJoinClasses, /**< Join multiple class attributes */ TidyJoinStyles, /**< Join multiple style attributes */ TidyEscapeCdata, /**< Replace sections with escaped text */ #if SUPPORT_ASIAN_ENCODINGS TidyLanguage, /**< Language property: not used for anything yet */ TidyNCR, /**< Allow numeric character references */ #else TidyLanguageNotUsed, TidyNCRNotUsed, #endif #if SUPPORT_UTF16_ENCODINGS TidyOutputBOM, /**< Output a Byte Order Mark (BOM) for UTF-16 encodings */ /**< auto: if input stream has BOM, we output a BOM */ #else TidyOutputBOMNotUsed, #endif TidyReplaceColor, /**< Replace hex color attribute values with names */ TidyCSSPrefix, /**< CSS class naming for -clean option */ TidyInlineTags, /**< Declared inline tags */ TidyBlockTags, /**< Declared block tags */ TidyEmptyTags, /**< Declared empty tags */ TidyPreTags, /**< Declared pre tags */ TidyAccessibilityCheckLevel, /**< Accessibility check level 0 (old style), or 1, 2, 3 */ TidyVertSpace, /**< degree to which markup is spread out vertically */ #if SUPPORT_ASIAN_ENCODINGS TidyPunctWrap, /**< consider punctuation and breaking spaces for wrapping */ #else TidyPunctWrapNotUsed, #endif TidyMergeEmphasis, /**< Merge nested B and I elements */ TidyMergeDivs, /**< Merge multiple DIVs */ TidyDecorateInferredUL, /**< Mark inferred UL elements with no indent CSS */ TidyPreserveEntities, /**< Preserve entities */ TidySortAttributes, /**< Sort attributes */ TidyMergeSpans, /**< Merge multiple SPANs */ TidyAnchorAsName, /**< Define anchors as name attributes */ TidyPPrintTabs, /**< Indent using tabs istead of spaces */ TidySkipNested, /**< Skip nested tags in script and style CDATA */ TidyStrictTagsAttr, /**< Ensure tags and attributes match output HTML version */ TidyEscapeScripts, /**< Escape items that look like closing tags in script tags */ N_TIDY_OPTIONS /**< Must be last */ } TidyOptionId; /** Option data types */ typedef enum { TidyString, /**< String */ TidyInteger, /**< Integer or enumeration */ TidyBoolean /**< Boolean flag */ } TidyOptionType; /** AutoBool values used by ParseBool, ParseTriState, ParseIndent, ParseBOM */ typedef enum { TidyNoState, /**< maps to 'no' */ TidyYesState, /**< maps to 'yes' */ TidyAutoState /**< Automatic */ } TidyTriState; /** TidyNewline option values to control output line endings. */ typedef enum { TidyLF, /**< Use Unix style: LF */ TidyCRLF, /**< Use DOS/Windows style: CR+LF */ TidyCR /**< Use Macintosh style: CR */ } TidyLineEnding; /** Mode controlling treatment of doctype */ typedef enum { TidyDoctypeHtml5, /**< */ TidyDoctypeOmit, /**< Omit DOCTYPE altogether */ TidyDoctypeAuto, /**< Keep DOCTYPE in input. Set version to content */ TidyDoctypeStrict, /**< Convert document to HTML 4 strict content model */ TidyDoctypeLoose, /**< Convert document to HTML 4 transitional content model */ TidyDoctypeUser /**< Set DOCTYPE FPI explicitly */ } TidyDoctypeModes; /** Mode controlling treatment of duplicate Attributes */ typedef enum { TidyKeepFirst, TidyKeepLast } TidyDupAttrModes; /** Mode controlling treatment of sorting attributes */ typedef enum { TidySortAttrNone, TidySortAttrAlpha } TidyAttrSortStrategy; /* I/O and Message handling interface ** ** By default, Tidy will define, create and use ** instances of input and output handlers for ** standard C buffered I/O (i.e. FILE* stdin, ** FILE* stdout and FILE* stderr for content ** input, content output and diagnostic output, ** respectively. A FILE* cfgFile input handler ** will be used for config files. Command line ** options will just be set directly. */ /** Message severity level * These TidyReportLevel are used throughout libtidy, but don't * have associated localized strings to describe them because * TidyReportLevel is externally-facing, and changing the enum * starting int can break existing API's for poorly-written * applications using libtidy. See enum `TidyReportLevelKeys`. */ typedef enum { TidyInfo, /**< Information about markup usage */ TidyWarning, /**< Warning message */ TidyConfig, /**< Configuration error */ TidyAccess, /**< Accessibility message */ TidyError, /**< Error message - output suppressed */ TidyBadDocument, /**< I/O or file system error */ TidyFatal /**< Crash! */ } TidyReportLevel; /** Message severity level - string lookup keys * These TidyReportLevelKeys are used throughout libtidy, and * have associated localized strings to describe them. They * correspond to enum `TidyReportLevel`. */ typedef enum { TidyInfoString = 600, TidyWarningString, TidyConfigString, TidyAccessString, TidyErrorString, TidyBadDocumentString, TidyFatalString } TidyReportLevelKeys; /* Document tree traversal functions */ /** Node types */ typedef enum { TidyNode_Root, /**< Root */ TidyNode_DocType, /**< DOCTYPE */ TidyNode_Comment, /**< Comment */ TidyNode_ProcIns, /**< Processing Instruction */ TidyNode_Text, /**< Text */ TidyNode_Start, /**< Start Tag */ TidyNode_End, /**< End Tag */ TidyNode_StartEnd, /**< Start/End (empty) Tag */ TidyNode_CDATA, /**< Unparsed Text */ TidyNode_Section, /**< XML Section */ TidyNode_Asp, /**< ASP Source */ TidyNode_Jste, /**< JSTE Source */ TidyNode_Php, /**< PHP Source */ TidyNode_XmlDecl /**< XML Declaration */ } TidyNodeType; /** Known HTML element types */ typedef enum { TidyTag_UNKNOWN, /**< Unknown tag! */ TidyTag_A, /**< A */ TidyTag_ABBR, /**< ABBR */ TidyTag_ACRONYM, /**< ACRONYM */ TidyTag_ADDRESS, /**< ADDRESS */ TidyTag_ALIGN, /**< ALIGN */ TidyTag_APPLET, /**< APPLET */ TidyTag_AREA, /**< AREA */ TidyTag_B, /**< B */ TidyTag_BASE, /**< BASE */ TidyTag_BASEFONT, /**< BASEFONT */ TidyTag_BDO, /**< BDO */ TidyTag_BGSOUND, /**< BGSOUND */ TidyTag_BIG, /**< BIG */ TidyTag_BLINK, /**< BLINK */ TidyTag_BLOCKQUOTE, /**< BLOCKQUOTE */ TidyTag_BODY, /**< BODY */ TidyTag_BR, /**< BR */ TidyTag_BUTTON, /**< BUTTON */ TidyTag_CAPTION, /**< CAPTION */ TidyTag_CENTER, /**< CENTER */ TidyTag_CITE, /**< CITE */ TidyTag_CODE, /**< CODE */ TidyTag_COL, /**< COL */ TidyTag_COLGROUP, /**< COLGROUP */ TidyTag_COMMENT, /**< COMMENT */ TidyTag_DD, /**< DD */ TidyTag_DEL, /**< DEL */ TidyTag_DFN, /**< DFN */ TidyTag_DIR, /**< DIR */ TidyTag_DIV, /**< DIF */ TidyTag_DL, /**< DL */ TidyTag_DT, /**< DT */ TidyTag_EM, /**< EM */ TidyTag_EMBED, /**< EMBED */ TidyTag_FIELDSET, /**< FIELDSET */ TidyTag_FONT, /**< FONT */ TidyTag_FORM, /**< FORM */ TidyTag_FRAME, /**< FRAME */ TidyTag_FRAMESET, /**< FRAMESET */ TidyTag_H1, /**< H1 */ TidyTag_H2, /**< H2 */ TidyTag_H3, /**< H3 */ TidyTag_H4, /**< H4 */ TidyTag_H5, /**< H5 */ TidyTag_H6, /**< H6 */ TidyTag_HEAD, /**< HEAD */ TidyTag_HR, /**< HR */ TidyTag_HTML, /**< HTML */ TidyTag_I, /**< I */ TidyTag_IFRAME, /**< IFRAME */ TidyTag_ILAYER, /**< ILAYER */ TidyTag_IMG, /**< IMG */ TidyTag_INPUT, /**< INPUT */ TidyTag_INS, /**< INS */ TidyTag_ISINDEX, /**< ISINDEX */ TidyTag_KBD, /**< KBD */ TidyTag_KEYGEN, /**< KEYGEN */ TidyTag_LABEL, /**< LABEL */ TidyTag_LAYER, /**< LAYER */ TidyTag_LEGEND, /**< LEGEND */ TidyTag_LI, /**< LI */ TidyTag_LINK, /**< LINK */ TidyTag_LISTING, /**< LISTING */ TidyTag_MAP, /**< MAP */ TidyTag_MATHML, /**< MATH (HTML5) [i_a]2 MathML embedded in [X]HTML */ TidyTag_MARQUEE, /**< MARQUEE */ TidyTag_MENU, /**< MENU */ TidyTag_META, /**< META */ TidyTag_MULTICOL, /**< MULTICOL */ TidyTag_NOBR, /**< NOBR */ TidyTag_NOEMBED, /**< NOEMBED */ TidyTag_NOFRAMES, /**< NOFRAMES */ TidyTag_NOLAYER, /**< NOLAYER */ TidyTag_NOSAVE, /**< NOSAVE */ TidyTag_NOSCRIPT, /**< NOSCRIPT */ TidyTag_OBJECT, /**< OBJECT */ TidyTag_OL, /**< OL */ TidyTag_OPTGROUP, /**< OPTGROUP */ TidyTag_OPTION, /**< OPTION */ TidyTag_P, /**< P */ TidyTag_PARAM, /**< PARAM */ TidyTag_PICTURE, /**< PICTURE (HTML5) */ TidyTag_PLAINTEXT,/**< PLAINTEXT */ TidyTag_PRE, /**< PRE */ TidyTag_Q, /**< Q */ TidyTag_RB, /**< RB */ TidyTag_RBC, /**< RBC */ TidyTag_RP, /**< RP */ TidyTag_RT, /**< RT */ TidyTag_RTC, /**< RTC */ TidyTag_RUBY, /**< RUBY */ TidyTag_S, /**< S */ TidyTag_SAMP, /**< SAMP */ TidyTag_SCRIPT, /**< SCRIPT */ TidyTag_SELECT, /**< SELECT */ TidyTag_SERVER, /**< SERVER */ TidyTag_SERVLET, /**< SERVLET */ TidyTag_SMALL, /**< SMALL */ TidyTag_SPACER, /**< SPACER */ TidyTag_SPAN, /**< SPAN */ TidyTag_STRIKE, /**< STRIKE */ TidyTag_STRONG, /**< STRONG */ TidyTag_STYLE, /**< STYLE */ TidyTag_SUB, /**< SUB */ TidyTag_SUP, /**< SUP */ TidyTag_SVG, /**< SVG (HTML5) */ TidyTag_TABLE, /**< TABLE */ TidyTag_TBODY, /**< TBODY */ TidyTag_TD, /**< TD */ TidyTag_TEXTAREA, /**< TEXTAREA */ TidyTag_TFOOT, /**< TFOOT */ TidyTag_TH, /**< TH */ TidyTag_THEAD, /**< THEAD */ TidyTag_TITLE, /**< TITLE */ TidyTag_TR, /**< TR */ TidyTag_TT, /**< TT */ TidyTag_U, /**< U */ TidyTag_UL, /**< UL */ TidyTag_VAR, /**< VAR */ TidyTag_WBR, /**< WBR */ TidyTag_XMP, /**< XMP */ TidyTag_NEXTID, /**< NEXTID */ TidyTag_ARTICLE, TidyTag_ASIDE, TidyTag_AUDIO, TidyTag_BDI, TidyTag_CANVAS, TidyTag_COMMAND, TidyTag_DATALIST, TidyTag_DETAILS, TidyTag_DIALOG, TidyTag_FIGCAPTION, TidyTag_FIGURE, TidyTag_FOOTER, TidyTag_HEADER, TidyTag_HGROUP, TidyTag_MAIN, TidyTag_MARK, TidyTag_MENUITEM, TidyTag_METER, TidyTag_NAV, TidyTag_OUTPUT, TidyTag_PROGRESS, TidyTag_SECTION, TidyTag_SOURCE, TidyTag_SUMMARY, TidyTag_TEMPLATE, TidyTag_TIME, TidyTag_TRACK, TidyTag_VIDEO, N_TIDY_TAGS /**< Must be last */ } TidyTagId; /* Attribute interrogation */ /** Known HTML attributes */ typedef enum { TidyAttr_UNKNOWN, /**< UNKNOWN= */ TidyAttr_ABBR, /**< ABBR= */ TidyAttr_ACCEPT, /**< ACCEPT= */ TidyAttr_ACCEPT_CHARSET, /**< ACCEPT_CHARSET= */ TidyAttr_ACCESSKEY, /**< ACCESSKEY= */ TidyAttr_ACTION, /**< ACTION= */ TidyAttr_ADD_DATE, /**< ADD_DATE= */ TidyAttr_ALIGN, /**< ALIGN= */ TidyAttr_ALINK, /**< ALINK= */ TidyAttr_ALLOWFULLSCREEN, /**< ALLOWFULLSCREEN= */ TidyAttr_ALT, /**< ALT= */ TidyAttr_ARCHIVE, /**< ARCHIVE= */ TidyAttr_AXIS, /**< AXIS= */ TidyAttr_BACKGROUND, /**< BACKGROUND= */ TidyAttr_BGCOLOR, /**< BGCOLOR= */ TidyAttr_BGPROPERTIES, /**< BGPROPERTIES= */ TidyAttr_BORDER, /**< BORDER= */ TidyAttr_BORDERCOLOR, /**< BORDERCOLOR= */ TidyAttr_BOTTOMMARGIN, /**< BOTTOMMARGIN= */ TidyAttr_CELLPADDING, /**< CELLPADDING= */ TidyAttr_CELLSPACING, /**< CELLSPACING= */ TidyAttr_CHAR, /**< CHAR= */ TidyAttr_CHAROFF, /**< CHAROFF= */ TidyAttr_CHARSET, /**< CHARSET= */ TidyAttr_CHECKED, /**< CHECKED= */ TidyAttr_CITE, /**< CITE= */ TidyAttr_CLASS, /**< CLASS= */ TidyAttr_CLASSID, /**< CLASSID= */ TidyAttr_CLEAR, /**< CLEAR= */ TidyAttr_CODE, /**< CODE= */ TidyAttr_CODEBASE, /**< CODEBASE= */ TidyAttr_CODETYPE, /**< CODETYPE= */ TidyAttr_COLOR, /**< COLOR= */ TidyAttr_COLS, /**< COLS= */ TidyAttr_COLSPAN, /**< COLSPAN= */ TidyAttr_COMPACT, /**< COMPACT= */ TidyAttr_CONTENT, /**< CONTENT= */ TidyAttr_COORDS, /**< COORDS= */ TidyAttr_DATA, /**< DATA= */ TidyAttr_DATAFLD, /**< DATAFLD= */ TidyAttr_DATAFORMATAS, /**< DATAFORMATAS= */ TidyAttr_DATAPAGESIZE, /**< DATAPAGESIZE= */ TidyAttr_DATASRC, /**< DATASRC= */ TidyAttr_DATETIME, /**< DATETIME= */ TidyAttr_DECLARE, /**< DECLARE= */ TidyAttr_DEFER, /**< DEFER= */ TidyAttr_DIR, /**< DIR= */ TidyAttr_DISABLED, /**< DISABLED= */ TidyAttr_ENCODING, /**< ENCODING= */ TidyAttr_ENCTYPE, /**< ENCTYPE= */ TidyAttr_FACE, /**< FACE= */ TidyAttr_FOR, /**< FOR= */ TidyAttr_FRAME, /**< FRAME= */ TidyAttr_FRAMEBORDER, /**< FRAMEBORDER= */ TidyAttr_FRAMESPACING, /**< FRAMESPACING= */ TidyAttr_GRIDX, /**< GRIDX= */ TidyAttr_GRIDY, /**< GRIDY= */ TidyAttr_HEADERS, /**< HEADERS= */ TidyAttr_HEIGHT, /**< HEIGHT= */ TidyAttr_HREF, /**< HREF= */ TidyAttr_HREFLANG, /**< HREFLANG= */ TidyAttr_HSPACE, /**< HSPACE= */ TidyAttr_HTTP_EQUIV, /**< HTTP_EQUIV= */ TidyAttr_ID, /**< ID= */ TidyAttr_ISMAP, /**< ISMAP= */ TidyAttr_ITEMID, /**< ITEMID= */ TidyAttr_ITEMPROP, /**< ITEMPROP= */ TidyAttr_ITEMREF, /**< ITEMREF= */ TidyAttr_ITEMSCOPE, /**< ITEMSCOPE= */ TidyAttr_ITEMTYPE, /**< ITEMTYPE= */ TidyAttr_LABEL, /**< LABEL= */ TidyAttr_LANG, /**< LANG= */ TidyAttr_LANGUAGE, /**< LANGUAGE= */ TidyAttr_LAST_MODIFIED, /**< LAST_MODIFIED= */ TidyAttr_LAST_VISIT, /**< LAST_VISIT= */ TidyAttr_LEFTMARGIN, /**< LEFTMARGIN= */ TidyAttr_LINK, /**< LINK= */ TidyAttr_LONGDESC, /**< LONGDESC= */ TidyAttr_LOWSRC, /**< LOWSRC= */ TidyAttr_MARGINHEIGHT, /**< MARGINHEIGHT= */ TidyAttr_MARGINWIDTH, /**< MARGINWIDTH= */ TidyAttr_MAXLENGTH, /**< MAXLENGTH= */ TidyAttr_MEDIA, /**< MEDIA= */ TidyAttr_METHOD, /**< METHOD= */ TidyAttr_MULTIPLE, /**< MULTIPLE= */ TidyAttr_NAME, /**< NAME= */ TidyAttr_NOHREF, /**< NOHREF= */ TidyAttr_NORESIZE, /**< NORESIZE= */ TidyAttr_NOSHADE, /**< NOSHADE= */ TidyAttr_NOWRAP, /**< NOWRAP= */ TidyAttr_OBJECT, /**< OBJECT= */ TidyAttr_OnAFTERUPDATE, /**< OnAFTERUPDATE= */ TidyAttr_OnBEFOREUNLOAD, /**< OnBEFOREUNLOAD= */ TidyAttr_OnBEFOREUPDATE, /**< OnBEFOREUPDATE= */ TidyAttr_OnBLUR, /**< OnBLUR= */ TidyAttr_OnCHANGE, /**< OnCHANGE= */ TidyAttr_OnCLICK, /**< OnCLICK= */ TidyAttr_OnDATAAVAILABLE, /**< OnDATAAVAILABLE= */ TidyAttr_OnDATASETCHANGED, /**< OnDATASETCHANGED= */ TidyAttr_OnDATASETCOMPLETE, /**< OnDATASETCOMPLETE= */ TidyAttr_OnDBLCLICK, /**< OnDBLCLICK= */ TidyAttr_OnERRORUPDATE, /**< OnERRORUPDATE= */ TidyAttr_OnFOCUS, /**< OnFOCUS= */ TidyAttr_OnKEYDOWN, /**< OnKEYDOWN= */ TidyAttr_OnKEYPRESS, /**< OnKEYPRESS= */ TidyAttr_OnKEYUP, /**< OnKEYUP= */ TidyAttr_OnLOAD, /**< OnLOAD= */ TidyAttr_OnMOUSEDOWN, /**< OnMOUSEDOWN= */ TidyAttr_OnMOUSEMOVE, /**< OnMOUSEMOVE= */ TidyAttr_OnMOUSEOUT, /**< OnMOUSEOUT= */ TidyAttr_OnMOUSEOVER, /**< OnMOUSEOVER= */ TidyAttr_OnMOUSEUP, /**< OnMOUSEUP= */ TidyAttr_OnRESET, /**< OnRESET= */ TidyAttr_OnROWENTER, /**< OnROWENTER= */ TidyAttr_OnROWEXIT, /**< OnROWEXIT= */ TidyAttr_OnSELECT, /**< OnSELECT= */ TidyAttr_OnSUBMIT, /**< OnSUBMIT= */ TidyAttr_OnUNLOAD, /**< OnUNLOAD= */ TidyAttr_PROFILE, /**< PROFILE= */ TidyAttr_PROMPT, /**< PROMPT= */ TidyAttr_RBSPAN, /**< RBSPAN= */ TidyAttr_READONLY, /**< READONLY= */ TidyAttr_REL, /**< REL= */ TidyAttr_REV, /**< REV= */ TidyAttr_RIGHTMARGIN, /**< RIGHTMARGIN= */ TidyAttr_ROLE, /**< ROLE= */ TidyAttr_ROWS, /**< ROWS= */ TidyAttr_ROWSPAN, /**< ROWSPAN= */ TidyAttr_RULES, /**< RULES= */ TidyAttr_SCHEME, /**< SCHEME= */ TidyAttr_SCOPE, /**< SCOPE= */ TidyAttr_SCROLLING, /**< SCROLLING= */ TidyAttr_SELECTED, /**< SELECTED= */ TidyAttr_SHAPE, /**< SHAPE= */ TidyAttr_SHOWGRID, /**< SHOWGRID= */ TidyAttr_SHOWGRIDX, /**< SHOWGRIDX= */ TidyAttr_SHOWGRIDY, /**< SHOWGRIDY= */ TidyAttr_SIZE, /**< SIZE= */ TidyAttr_SPAN, /**< SPAN= */ TidyAttr_SRC, /**< SRC= */ TidyAttr_SRCSET, /**< SRCSET= (HTML5) */ TidyAttr_STANDBY, /**< STANDBY= */ TidyAttr_START, /**< START= */ TidyAttr_STYLE, /**< STYLE= */ TidyAttr_SUMMARY, /**< SUMMARY= */ TidyAttr_TABINDEX, /**< TABINDEX= */ TidyAttr_TARGET, /**< TARGET= */ TidyAttr_TEXT, /**< TEXT= */ TidyAttr_TITLE, /**< TITLE= */ TidyAttr_TOPMARGIN, /**< TOPMARGIN= */ TidyAttr_TRANSLATE, /**< TRANSLATE= */ TidyAttr_TYPE, /**< TYPE= */ TidyAttr_USEMAP, /**< USEMAP= */ TidyAttr_VALIGN, /**< VALIGN= */ TidyAttr_VALUE, /**< VALUE= */ TidyAttr_VALUETYPE, /**< VALUETYPE= */ TidyAttr_VERSION, /**< VERSION= */ TidyAttr_VLINK, /**< VLINK= */ TidyAttr_VSPACE, /**< VSPACE= */ TidyAttr_WIDTH, /**< WIDTH= */ TidyAttr_WRAP, /**< WRAP= */ TidyAttr_XML_LANG, /**< XML_LANG= */ TidyAttr_XML_SPACE, /**< XML_SPACE= */ TidyAttr_XMLNS, /**< XMLNS= */ TidyAttr_EVENT, /**< EVENT= */ TidyAttr_METHODS, /**< METHODS= */ TidyAttr_N, /**< N= */ TidyAttr_SDAFORM, /**< SDAFORM= */ TidyAttr_SDAPREF, /**< SDAPREF= */ TidyAttr_SDASUFF, /**< SDASUFF= */ TidyAttr_URN, /**< URN= */ TidyAttr_ASYNC, TidyAttr_AUTOCOMPLETE, TidyAttr_AUTOFOCUS, TidyAttr_AUTOPLAY, TidyAttr_CHALLENGE, TidyAttr_CONTENTEDITABLE, TidyAttr_CONTEXTMENU, TidyAttr_CONTROLS, TidyAttr_DEFAULT, TidyAttr_DIRNAME, TidyAttr_DRAGGABLE, TidyAttr_DROPZONE, TidyAttr_FORM, TidyAttr_FORMACTION, TidyAttr_FORMENCTYPE, TidyAttr_FORMMETHOD, TidyAttr_FORMNOVALIDATE, TidyAttr_FORMTARGET, TidyAttr_HIDDEN, TidyAttr_HIGH, TidyAttr_ICON, TidyAttr_KEYTYPE, TidyAttr_KIND, TidyAttr_LIST, TidyAttr_LOOP, TidyAttr_LOW, TidyAttr_MANIFEST, TidyAttr_MAX, TidyAttr_MEDIAGROUP, TidyAttr_MIN, TidyAttr_NOVALIDATE, TidyAttr_OPEN, TidyAttr_OPTIMUM, TidyAttr_OnABORT, TidyAttr_OnAFTERPRINT, TidyAttr_OnBEFOREPRINT, TidyAttr_OnCANPLAY, TidyAttr_OnCANPLAYTHROUGH, TidyAttr_OnCONTEXTMENU, TidyAttr_OnCUECHANGE, TidyAttr_OnDRAG, TidyAttr_OnDRAGEND, TidyAttr_OnDRAGENTER, TidyAttr_OnDRAGLEAVE, TidyAttr_OnDRAGOVER, TidyAttr_OnDRAGSTART, TidyAttr_OnDROP, TidyAttr_OnDURATIONCHANGE, TidyAttr_OnEMPTIED, TidyAttr_OnENDED, TidyAttr_OnERROR, TidyAttr_OnHASHCHANGE, TidyAttr_OnINPUT, TidyAttr_OnINVALID, TidyAttr_OnLOADEDDATA, TidyAttr_OnLOADEDMETADATA, TidyAttr_OnLOADSTART, TidyAttr_OnMESSAGE, TidyAttr_OnMOUSEWHEEL, TidyAttr_OnOFFLINE, TidyAttr_OnONLINE, TidyAttr_OnPAGEHIDE, TidyAttr_OnPAGESHOW, TidyAttr_OnPAUSE, TidyAttr_OnPLAY, TidyAttr_OnPLAYING, TidyAttr_OnPOPSTATE, TidyAttr_OnPROGRESS, TidyAttr_OnRATECHANGE, TidyAttr_OnREADYSTATECHANGE, TidyAttr_OnREDO, TidyAttr_OnRESIZE, TidyAttr_OnSCROLL, TidyAttr_OnSEEKED, TidyAttr_OnSEEKING, TidyAttr_OnSHOW, TidyAttr_OnSTALLED, TidyAttr_OnSTORAGE, TidyAttr_OnSUSPEND, TidyAttr_OnTIMEUPDATE, TidyAttr_OnUNDO, TidyAttr_OnVOLUMECHANGE, TidyAttr_OnWAITING, TidyAttr_PATTERN, TidyAttr_PLACEHOLDER, TidyAttr_POSTER, TidyAttr_PRELOAD, TidyAttr_PUBDATE, TidyAttr_RADIOGROUP, TidyAttr_REQUIRED, TidyAttr_REVERSED, TidyAttr_SANDBOX, TidyAttr_SCOPED, TidyAttr_SEAMLESS, TidyAttr_SIZES, TidyAttr_SPELLCHECK, TidyAttr_SRCDOC, TidyAttr_SRCLANG, TidyAttr_STEP, TidyAttr_ARIA_ACTIVEDESCENDANT, TidyAttr_ARIA_ATOMIC, TidyAttr_ARIA_AUTOCOMPLETE, TidyAttr_ARIA_BUSY, TidyAttr_ARIA_CHECKED, TidyAttr_ARIA_CONTROLS, TidyAttr_ARIA_DESCRIBEDBY, TidyAttr_ARIA_DISABLED, TidyAttr_ARIA_DROPEFFECT, TidyAttr_ARIA_EXPANDED, TidyAttr_ARIA_FLOWTO, TidyAttr_ARIA_GRABBED, TidyAttr_ARIA_HASPOPUP, TidyAttr_ARIA_HIDDEN, TidyAttr_ARIA_INVALID, TidyAttr_ARIA_LABEL, TidyAttr_ARIA_LABELLEDBY, TidyAttr_ARIA_LEVEL, TidyAttr_ARIA_LIVE, TidyAttr_ARIA_MULTILINE, TidyAttr_ARIA_MULTISELECTABLE, TidyAttr_ARIA_ORIENTATION, TidyAttr_ARIA_OWNS, TidyAttr_ARIA_POSINSET, TidyAttr_ARIA_PRESSED, TidyAttr_ARIA_READONLY, TidyAttr_ARIA_RELEVANT, TidyAttr_ARIA_REQUIRED, TidyAttr_ARIA_SELECTED, TidyAttr_ARIA_SETSIZE, TidyAttr_ARIA_SORT, TidyAttr_ARIA_VALUEMAX, TidyAttr_ARIA_VALUEMIN, TidyAttr_ARIA_VALUENOW, TidyAttr_ARIA_VALUETEXT, /* SVG attributes (SVG 1.1) */ TidyAttr_X, /**< X= */ TidyAttr_Y, /**< Y= */ TidyAttr_VIEWBOX, /**< VIEWBOX= */ TidyAttr_PRESERVEASPECTRATIO, /**< PRESERVEASPECTRATIO= */ TidyAttr_ZOOMANDPAN, /**< ZOOMANDPAN= */ TidyAttr_BASEPROFILE, /**< BASEPROFILE= */ TidyAttr_CONTENTSCRIPTTYPE, /**< CONTENTSCRIPTTYPE= */ TidyAttr_CONTENTSTYLETYPE, /**< CONTENTSTYLETYPE= */ /* MathML attributes */ TidyAttr_DISPLAY, /**< DISPLAY= (html5) */ /* RDFa global attributes */ TidyAttr_ABOUT, /**< ABOUT= */ TidyAttr_DATATYPE, /**< DATATYPE= */ TidyAttr_INLIST, /**< INLIST= */ TidyAttr_PREFIX, /**< PREFIX= */ TidyAttr_PROPERTY, /**< PROPERTY= */ TidyAttr_RESOURCE, /**< RESOURCE= */ TidyAttr_TYPEOF, /**< TYPEOF= */ TidyAttr_VOCAB, /**< VOCAB= */ N_TIDY_ATTRIBS /**< Must be last */ } TidyAttrId; #ifdef __cplusplus } /* extern "C" */ #endif #endif /* __TIDYENUM_H__ */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������tidy-html5-5.2.0/include/tidyplatform.h�������������������������������������������������������������0000664�0000000�0000000�00000033462�12726015173�0020044�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef __TIDY_PLATFORM_H__ #define __TIDY_PLATFORM_H__ /* tidyplatform.h -- Platform specifics (c) 1998-2008 (W3C) MIT, ERCIM, Keio University See tidy.h for the copyright notice. */ #ifdef __cplusplus extern "C" { #endif /* Uncomment and edit one of the following #defines if you want to specify the config file at compile-time. */ /* #define TIDY_CONFIG_FILE "/etc/tidy_config.txt" */ /* original */ /* #define TIDY_CONFIG_FILE "/etc/tidyrc" */ /* #define TIDY_CONFIG_FILE "/etc/tidy.conf" */ /* Uncomment the following #define if you are on a system supporting the HOME environment variable. It enables tidy to find config files named ~/.tidyrc if the HTML_TIDY environment variable is not set. */ /* #define TIDY_USER_CONFIG_FILE "~/.tidyrc" */ /* Uncomment the following #define if your system supports the call getpwnam(). E.g. Unix and Linux. It enables tidy to find files named ~your/foo for use in the HTML_TIDY environment variable or CONFIG_FILE or USER_CONFIGFILE or on the command line: -config ~joebob/tidy.cfg Contributed by Todd Lewis. */ /* #define SUPPORT_GETPWNAM */ /* Enable/disable support for Big5 and Shift_JIS character encodings */ #ifndef SUPPORT_ASIAN_ENCODINGS #define SUPPORT_ASIAN_ENCODINGS 1 #endif /* Enable/disable support for UTF-16 character encodings */ #ifndef SUPPORT_UTF16_ENCODINGS #define SUPPORT_UTF16_ENCODINGS 1 #endif /* Enable/disable support for additional accessibility checks */ #ifndef SUPPORT_ACCESSIBILITY_CHECKS #define SUPPORT_ACCESSIBILITY_CHECKS 1 #endif /* Enable/disable support for additional languages */ #ifndef SUPPORT_LOCALIZATIONS #define SUPPORT_LOCALIZATIONS 1 #endif /* Convenience defines for Mac platforms */ #if defined(macintosh) /* Mac OS 6.x/7.x/8.x/9.x, with or without CarbonLib - MPW or Metrowerks 68K/PPC compilers */ #define MAC_OS_CLASSIC #ifndef PLATFORM_NAME #define PLATFORM_NAME "Mac OS" #endif /* needed for access() */ #if !defined(_POSIX) && !defined(NO_ACCESS_SUPPORT) #define NO_ACCESS_SUPPORT #endif #ifdef SUPPORT_GETPWNAM #undef SUPPORT_GETPWNAM #endif #elif defined(__APPLE__) && defined(__MACH__) /* Mac OS X (client) 10.x (or server 1.x/10.x) - gcc or Metrowerks MachO compilers */ #define MAC_OS_X #ifndef PLATFORM_NAME #define PLATFORM_NAME "Mac OS X" #endif #endif #if defined(MAC_OS_CLASSIC) || defined(MAC_OS_X) /* Any OS on Mac platform */ #define MAC_OS #define FILENAMES_CASE_SENSITIVE 0 #define strcasecmp strcmp #endif /* Convenience defines for BSD like platforms */ #if defined(__FreeBSD__) #define BSD_BASED_OS #ifndef PLATFORM_NAME #define PLATFORM_NAME "FreeBSD" #endif #elif defined(__NetBSD__) #define BSD_BASED_OS #ifndef PLATFORM_NAME #define PLATFORM_NAME "NetBSD" #endif #elif defined(__OpenBSD__) #define BSD_BASED_OS #ifndef PLATFORM_NAME #define PLATFORM_NAME "OpenBSD" #endif #elif defined(__DragonFly__) #define BSD_BASED_OS #ifndef PLATFORM_NAME #define PLATFORM_NAME "DragonFly" #endif #elif defined(__MINT__) #define BSD_BASED_OS #ifndef PLATFORM_NAME #define PLATFORM_NAME "FreeMiNT" #endif #elif defined(__bsdi__) #define BSD_BASED_OS #ifndef PLATFORM_NAME #define PLATFORM_NAME "BSD/OS" #endif #endif /* Convenience defines for Windows platforms */ #if defined(WINDOWS) || defined(_WIN32) #define WINDOWS_OS #ifndef PLATFORM_NAME #define PLATFORM_NAME "Windows" #endif #if defined(__MWERKS__) || defined(__MSL__) /* not available with Metrowerks Standard Library */ #ifdef SUPPORT_GETPWNAM #undef SUPPORT_GETPWNAM #endif /* needed for setmode() */ #if !defined(NO_SETMODE_SUPPORT) #define NO_SETMODE_SUPPORT #endif #define strcasecmp _stricmp #endif #if defined(__BORLANDC__) #define strcasecmp stricmp #endif #define FILENAMES_CASE_SENSITIVE 0 #define SUPPORT_POSIX_MAPPED_FILES 0 #endif /* Convenience defines for Linux platforms */ #if defined(linux) && defined(__alpha__) /* Linux on Alpha - gcc compiler */ #define LINUX_OS #ifndef PLATFORM_NAME #define PLATFORM_NAME "Linux/Alpha" #endif #elif defined(linux) && defined(__sparc__) /* Linux on Sparc - gcc compiler */ #define LINUX_OS #ifndef PLATFORM_NAME #define PLATFORM_NAME "Linux/Sparc" #endif #elif defined(linux) && (defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__)) /* Linux on x86 - gcc compiler */ #define LINUX_OS #ifndef PLATFORM_NAME #define PLATFORM_NAME "Linux/x86" #endif #elif defined(linux) && defined(__powerpc__) /* Linux on PPC - gcc compiler */ #define LINUX_OS #if defined(__linux__) && defined(__powerpc__) /* #if #system(linux) */ /* MkLinux on PPC - gcc (egcs) compiler */ /* #define MAC_OS_MKLINUX */ #ifndef PLATFORM_NAME #define PLATFORM_NAME "MkLinux" #endif #else #ifndef PLATFORM_NAME #define PLATFORM_NAME "Linux/PPC" #endif #endif #elif defined(linux) || defined(__linux__) /* generic Linux */ #define LINUX_OS #ifndef PLATFORM_NAME #define PLATFORM_NAME "Linux" #endif #endif /* Convenience defines for Solaris platforms */ #if defined(sun) #define SOLARIS_OS #ifndef PLATFORM_NAME #define PLATFORM_NAME "Solaris" #endif #endif /* Convenience defines for HPUX + gcc platforms */ #if defined(__hpux) #define HPUX_OS #ifndef PLATFORM_NAME #define PLATFORM_NAME "HPUX" #endif #endif /* Convenience defines for RISCOS + gcc platforms */ #if defined(__riscos__) #define RISC_OS #ifndef PLATFORM_NAME #define PLATFORM_NAME "RISC OS" #endif #endif /* Convenience defines for OS/2 + icc/gcc platforms */ #if defined(__OS2__) || defined(__EMX__) #define OS2_OS #ifndef PLATFORM_NAME #define PLATFORM_NAME "OS/2" #endif #define FILENAMES_CASE_SENSITIVE 0 #define strcasecmp stricmp #endif /* Convenience defines for IRIX */ #if defined(__sgi) #define IRIX_OS #ifndef PLATFORM_NAME #define PLATFORM_NAME "SGI IRIX" #endif #endif /* Convenience defines for AIX */ #if defined(_AIX) #define AIX_OS #ifndef PLATFORM_NAME #define PLATFORM_NAME "IBM AIX" #endif #endif /* Convenience defines for BeOS platforms */ #if defined(__BEOS__) #define BE_OS #ifndef PLATFORM_NAME #define PLATFORM_NAME "BeOS" #endif #endif /* Convenience defines for Cygwin platforms */ #if defined(__CYGWIN__) #define CYGWIN_OS #ifndef PLATFORM_NAME #define PLATFORM_NAME "Cygwin" #endif #define FILENAMES_CASE_SENSITIVE 0 #endif /* Convenience defines for OpenVMS */ #if defined(__VMS) #define OPENVMS_OS #ifndef PLATFORM_NAME #define PLATFORM_NAME "OpenVMS" #endif #define FILENAMES_CASE_SENSITIVE 0 #endif /* Convenience defines for DEC Alpha OSF + gcc platforms */ #if defined(__osf__) #define OSF_OS #ifndef PLATFORM_NAME #define PLATFORM_NAME "DEC Alpha OSF" #endif #endif /* Convenience defines for ARM platforms */ #if defined(__arm) #define ARM_OS #if defined(forARM) && defined(__NEWTON_H) /* Using Newton C++ Tools ARMCpp compiler */ #define NEWTON_OS #ifndef PLATFORM_NAME #define PLATFORM_NAME "Newton" #endif #else #ifndef PLATFORM_NAME #define PLATFORM_NAME "ARM" #endif #endif #endif #include #include #include /* for longjmp on error exit */ #include #include /* may need for Unix V */ #include #include #ifdef NEEDS_MALLOC_H #include #endif #ifdef SUPPORT_GETPWNAM #include #endif #ifdef NEEDS_UNISTD_H #include /* needed for unlink on some Unix systems */ #endif /* By default, use case-sensitive filename comparison. */ #ifndef FILENAMES_CASE_SENSITIVE #define FILENAMES_CASE_SENSITIVE 1 #endif /* Tidy preserves the last modified time for the files it cleans up. */ /* If your platform doesn't support and the utime() function, or and the futime() function then set PRESERVE_FILE_TIMES to 0. If your platform doesn't support and the futime() function, then set HAS_FUTIME to 0. If your platform supports and the utime() function requires the file to be closed first, then set UTIME_NEEDS_CLOSED_FILE to 1. */ /* Keep old PRESERVEFILETIMES define for compatibility */ #ifdef PRESERVEFILETIMES #undef PRESERVE_FILE_TIMES #define PRESERVE_FILE_TIMES PRESERVEFILETIMES #endif #ifndef PRESERVE_FILE_TIMES #if defined(RISC_OS) || defined(OPENVMS_OS) || defined(OSF_OS) #define PRESERVE_FILE_TIMES 0 #else #define PRESERVE_FILE_TIMES 1 #endif #endif #if PRESERVE_FILE_TIMES #ifndef HAS_FUTIME #if defined(CYGWIN_OS) || defined(BE_OS) || defined(OS2_OS) || defined(HPUX_OS) || defined(SOLARIS_OS) || defined(LINUX_OS) || defined(BSD_BASED_OS) || defined(MAC_OS) || defined(__MSL__) || defined(IRIX_OS) || defined(AIX_OS) || defined(__BORLANDC__) #define HAS_FUTIME 0 #else #define HAS_FUTIME 1 #endif #endif #ifndef UTIME_NEEDS_CLOSED_FILE #if defined(SOLARIS_OS) || defined(BSD_BASED_OS) || defined(MAC_OS) || defined(__MSL__) || defined(LINUX_OS) #define UTIME_NEEDS_CLOSED_FILE 1 #else #define UTIME_NEEDS_CLOSED_FILE 0 #endif #endif #if defined(MAC_OS_X) || (!defined(MAC_OS_CLASSIC) && !defined(__MSL__)) #include #include #else #include #endif #if HAS_FUTIME #include #else #include #endif /* HASFUTIME */ /* MS Windows needs _ prefix for Unix file functions. Not required by Metrowerks Standard Library (MSL). Tidy uses following for preserving the last modified time. WINDOWS automatically set by Win16 compilers. _WIN32 automatically set by Win32 compilers. */ #if defined(_WIN32) && !defined(__MSL__) && !defined(__BORLANDC__) #define futime _futime #define fstat _fstat #define utimbuf _utimbuf /* Windows seems to want utimbuf */ #define stat _stat #define utime _utime #define vsnprintf _vsnprintf #endif /* _WIN32 */ #endif /* PRESERVE_FILE_TIMES */ /* MS Windows needs _ prefix for Unix file functions. Not required by Metrowerks Standard Library (MSL). WINDOWS automatically set by Win16 compilers. _WIN32 automatically set by Win32 compilers. */ #if defined(_WIN32) && !defined(__MSL__) && !defined(__BORLANDC__) #if !(defined(__WATCOMC__) || defined(__MINGW32__)) #define fileno _fileno #define setmode _setmode #endif #define access _access #define strcasecmp _stricmp #ifndef va_copy #define va_copy(dest, src) (dest = src) #endif #if _MSC_VER > 1000 #pragma warning( disable : 4189 ) /* local variable is initialized but not referenced */ #pragma warning( disable : 4100 ) /* unreferenced formal parameter */ #pragma warning( disable : 4706 ) /* assignment within conditional expression */ #endif #if _MSC_VER > 1300 #pragma warning( disable : 4996 ) /* disable depreciation warning */ #endif #endif /* _WIN32 */ #if defined(_WIN32) #if (defined(_USRDLL) || defined(_WINDLL) || defined(BUILD_SHARED_LIB)) && !defined(TIDY_EXPORT) && !defined(TIDY_STATIC) #ifdef BUILDING_SHARED_LIB #define TIDY_EXPORT __declspec( dllexport ) #else #define TIDY_EXPORT __declspec( dllimport ) #endif #else #define TIDY_EXPORT extern #endif #ifndef TIDY_CALL #ifdef _WIN64 # define TIDY_CALL __fastcall #else # define TIDY_CALL __stdcall #endif #endif #endif /* _WIN32 */ /* hack for gnu sys/types.h file which defines uint and ulong */ #if defined(BE_OS) || defined(SOLARIS_OS) || defined(BSD_BASED_OS) || defined(OSF_OS) || defined(IRIX_OS) || defined(AIX_OS) #include #endif #if !defined(HPUX_OS) && !defined(CYGWIN_OS) && !defined(MAC_OS_X) && !defined(BE_OS) && !defined(SOLARIS_OS) && !defined(BSD_BASED_OS) && !defined(OSF_OS) && !defined(IRIX_OS) && !defined(AIX_OS) && !defined(LINUX_OS) # undef uint typedef unsigned int uint; #endif #if defined(HPUX_OS) || defined(CYGWIN_OS) || defined(MAC_OS) || defined(BSD_BASED_OS) || defined(_WIN32) # undef ulong typedef unsigned long ulong; #endif /* With GCC 4, __attribute__ ((visibility("default"))) can be used along compiling with tidylib with "-fvisibility=hidden". See http://gcc.gnu.org/wiki/Visibility and build/gmake/Makefile. */ /* #if defined(__GNUC__) && __GNUC__ >= 4 #define TIDY_EXPORT __attribute__ ((visibility("default"))) #endif */ #ifndef TIDY_EXPORT /* Define it away for most builds */ #define TIDY_EXPORT #endif #ifndef TIDY_STRUCT #define TIDY_STRUCT #endif typedef unsigned char byte; typedef uint tchar; /* single, full character */ typedef char tmbchar; /* single, possibly partial character */ #ifndef TMBSTR_DEFINED typedef tmbchar* tmbstr; /* pointer to buffer of possibly partial chars */ typedef const tmbchar* ctmbstr; /* Ditto, but const */ #define NULLSTR (tmbstr)"" #define TMBSTR_DEFINED #endif #ifndef TIDY_CALL #define TIDY_CALL #endif #if defined(__GNUC__) || defined(__INTEL_COMPILER) # define ARG_UNUSED(x) x __attribute__((unused)) #else # define ARG_UNUSED(x) x #endif /* HAS_VSNPRINTF triggers the use of "vsnprintf", which is safe related to buffer overflow. Therefore, we make it the default unless HAS_VSNPRINTF has been defined. */ #ifndef HAS_VSNPRINTF # define HAS_VSNPRINTF 1 #endif #ifndef SUPPORT_POSIX_MAPPED_FILES # define SUPPORT_POSIX_MAPPED_FILES 1 #endif /* bool is a reserved word in some but not all C++ compilers depending on age work around is to avoid bool altogether by introducing a new enum called Bool */ /* We could use the C99 definition where supported typedef _Bool Bool; #define no (_Bool)0 #define yes (_Bool)1 */ typedef enum { no, yes } Bool; /* for NULL pointers #define null ((const void*)0) extern void* null; */ #if defined(DMALLOC) #include "dmalloc.h" #endif /* Opaque data structure. * Cast to implementation type struct within lib. * This will reduce inter-dependencies/conflicts w/ application code. */ #if 1 #define opaque_type( typenam )\ struct _##typenam { int _opaque; };\ typedef struct _##typenam const * typenam #else #define opaque_type(typenam) typedef const void* typenam #endif /* Opaque data structure used to pass back ** and forth to keep current position in a ** list or other collection. */ opaque_type( TidyIterator ); #ifdef __cplusplus } /* extern "C" */ #endif #endif /* __TIDY_PLATFORM_H__ */ /* * local variables: * mode: c * indent-tabs-mode: nil * c-basic-offset: 4 * eval: (c-set-offset 'substatement-open 0) * end: */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������tidy-html5-5.2.0/localize/��������������������������������������������������������������������������0000775�0000000�0000000�00000000000�12726015173�0015324�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������tidy-html5-5.2.0/localize/.gitignore����������������������������������������������������������������0000664�0000000�0000000�00000000166�12726015173�0017317�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Ignore user-generated files: Gemfile.lock *.pot *.po *.h translations/*.* !translations/tidy.pot !translations/*.po ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������tidy-html5-5.2.0/localize/Gemfile�������������������������������������������������������������������0000664�0000000�0000000�00000000077�12726015173�0016623�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������source 'https://rubygems.org' gem 'thor' gem 'i18n' gem 'git' �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������tidy-html5-5.2.0/localize/README.md�����������������������������������������������������������������0000664�0000000�0000000�00000044522�12726015173�0016612�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# README.md - Localize HTML Tidy Thank you for your interest in helping us localize HTML Tidy and LibTidy. Users throughout the world will thank you. The document describes Tidy's localization philosophy and instructs you on how you can use standard `gettext` tools to generate language and region localizations that will work with Tidy. Optionally instructions are included in the event that you want to build Tidy with your new language. ## Contents: - [Introduction](#introduction) - [PO and POT files](#po-and-pot-files) - [H files](#h-files) - [Differences for translators](#differences-for-translators) - [`poconvert.rb` versus `gettext`' tools](#poconvertrb-versus-gettext-tools) - [How to Contribute](#how-to-contribute) - [Find or Create the Translation Files](#find-or-create-the-translation-files) - [Issue a Pull Request to HTML Tidy](#issue-a-pull-request-to-html-tidy) - [Using Git appropriately](#using-git-appropriately) - [Repository Notes](#repository-notes) - [Adding Languages to Tidy](#adding-languages-to-tidy) - [Best Practices](#best-practices) - [Language Inheritance](#language-inheritance) - [String Inheritance](#string-inheritance) - [Base Language First and Regional Variants](#base-language-first-and-regional-variants) - [Positional Parameters](#positional-parameters) - [Testing](#testing) - [Command line option](#command-line-option) - [Changing your locale](#changing-your-locale) - [East Asian Languages](#east-asian-languages) - [gettext](#gettext) - [poconvert.rb](#poconvertrb) - [Create a new POT file](#create-a-new-pot-file) - [Create a new POT file with non-English `msgid` strings](#create-a-new-pot-file-with-non-english-msgid-strings) - [Convert an existing H to PO](#convert-an-existing-h-to-po) - [Convert an existing H to PO using a different `msgid` language](#convert-an-existing-h-to-po-using-a-different-msgid-language) - [Create a blank PO file for a particular region](#create-a-blank-po-file-for-a-particular-region) - [Create a Tidy Language Header H file](#create-a-tidy-language-header-h-file) - [Prepare your non-English PO for a PR](#prepare-your-non-english-po-for-a-pr) - [Update your PO to match the new POT](#update-your-po-to-match-the-new-pot) - [Help Tidy Get Better](#help-tidy-get-better) ## Introduction HTML Tidy is built around the localization file `language_en.h`; without this file HTML Tidy will not work. As such _all_ language localization work originates from this single file. Language localizations use header files that are identical to `language_en.h`, except that they have different strings. For the convenience of language translators, though, Tidy source code includes a Ruby `poconvert.rb` script that enables _optional_ gettext PO/POT work streams that may be more comfortable to them. ### PO and POT files HTML Tidy provides PO and POT files for language translations. The file `tidy.pot` is the correct template to use as a basis for new translations. In a typical `gettext` workflow a translator will use the `tidy.pot` file to create a language translation PO file that contains original English strings and the translated strings. If a language has already been translated (or if the translation has begun) then PO files may already exist. These files are named `language_ll.po` or `langage_ll_CC.po`, where `ll` represents the language code, and optionally, `CC` represents the region code of the translation. Tidy does not use MO files that `gettext` tools generate from PO files. Please note that these PO and POT files are provided for translator convenience only. Tidy's [header files](#h-files) constitute the true, controlled source code for Tidy. ### H files Tidy does not use `gettext` to display strings and so `gettext`-generated MO files are not necessary. Instead translated PO files must be converted to Tidy's language header H file format. Translators are not required to perform this step, but we provide a tool to perform this function if desired. ### Differences for translators Experienced users and translators of PO files may note that we use the PO file's `msgctxt` field a bit uniquely. Rather than point to a line in the source code, it contains a reference to the string's identifier. Because the PO format does not allow for arbitrary metadata this is a requirement for generating our header files. If you're the type of translator the does dig into the source code, then this `msgtext` symbol is still useful to you and adds a single extra step to finding where a string is in context: a symbol or string search using the `msgctxt` value will reveal the context in source code. Finally the `msgid` field is a throwaway; Tidy's language tools do not use this value and so it's only for the translator's convenience. This fact makes it convenient for translators to translate from languages other than English, which is fully supported by our tools. ### `poconvert.rb` versus `gettext`' tools Please don't use `gettext`' tools with our PO and POT files (unless you are using our strings for a different project). Instead all workflows can be accomplished with our `poconvert.rb` tool. [More information about this tool](#h-files) can be found below. ## How to Contribute ### Find or Create the Translation Files If you've not already cloned the HTML Tidy source code repository that will be your first step. In the `localize\translations\` directory you can find existing languages, e.g., - `tidy.pot` (Tidy's POT template for translations). - `language_en_gb.po` (British English variants for the built in language) - …and perhaps more. In the `src\` directory you can find the master files for existing languages, e.g., - `language_en.h` (Tidy's native, built-in language, mostly U.S. English) - `language_en_gb.po` (British English variants for the built in language) - …and perhaps more. Although the header files are the master files for HTML Tidy, we understand that not all potential translators want to edit C files directly. Therefore as an option, the following workflow to use POT and PO files is offered. If the language that you want to work on is already present: - Simply open the file in your favorite PO editor and then get to work. - Note that although you can use a text editor, we recommend that you use a dedicated PO editor so that you don't accidentally make the file illegible to our conversion utility. If the language that you want to work on is _not_ already present: - You can open `tidy.pot` in your favorite PO editor and use its functions to begin a new translation into your desired language. - Note that although you can use a text editor, we recommend that you use a dedicated PO editor so that you don't accidentally make the file illegible to our conversion utility. - To perform the work manually: - Copy `tidy.pot` to `language_ll.po` (for a non-regional variant, or base language), or to `language_ll_cc.po` (for a region-specific variant), where `ll` indicates the two letter language code and `cc` indicates the two letter region or country code. - Change the pertinent PO header section accordingly. - Use `poconvert.rb` to generate a PO: - `poconvert.rb msginit --locale ll`, where `ll` indicates the language code for the language you want to translate to. The tool recognizes the same languages as `gettext`' `msginit`. If your chosen language is not supported, then please see the manual method, above. - See also `poconvert.rb help` for more options. - See GNU's [The Format of PO Files](https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html) for more specific instructions and important information. ### Issue a Pull Request to HTML Tidy Once your translation is complete commit your entire HTML Tidy repository to GitHub and issue a pull request (PR) against the `master` branch. If accepted a friendly developer will convert your PO into a format useful to Tidy if your PR is a PO, or will simply merge your changed header file if you changed it directly. You are also welcome to perform any conversions yourself, add new languages to Tidy, and issue a PR for the whole change. ### Using Git appropriately 1. Fork the repository to your GitHub account. 2. Optionally create a **topical branch** - a branch whose name is succinct but explains what you're doing, such as "localize Portuguese". 3. Make your changes, committing at logical breaks. 4. Push your work to your personal account. 5. [Create a pull request](https://help.github.com/articles/using-pull-requests). 6. Watch for comments or acceptance. ### Repository Notes If you are working with PO files then please **only** commit PO files with _English_ `msgid` fields. The `gettext` convention specifies only English `msgid`, and other translators may not understand the original strings. Our `poconvert.rb` script can generate PO files using another language as `msgid`. This can be very useful if it's easier for you to translate from another language instead of English. It can also be useful for translating from a base language to a regional variant, such as from Spanish to Mexican Spanish. If you choose to work locally with a non-English PO, you can easily convert your PO to a Tidy header file and back to an English-based PO using our `poconvert.rb` script. See its documentation (`poconvert.rb help`) for instructions. ## Adding Languages to Tidy Although we don't require you to follow these steps to contribute a language to Tidy, you may want to add the language to Tidy yourself to test the translation, or to save one of the developer team a few extra steps. - Generate the header files if necessary: - Convert your PO file to a Tidy header file by executing `poconvert.rb msgfmt `. Note that on Windows you will likely have to preface this line with `ruby`. - The tool should generate a file named `language_ll_cc.h` in the working directory, where `ll_cc` will be replaced with the language/region of your translation. - Copy this `.h` file into `src\`. - Modify Tidy's source: - Edit the file `src\language.c` to ensure that the new `.h` file you added is in the `#include` section. - Look for the `static tidyLanguagesType tidyLanguages` structure starting near line 40, and look for the comment `These languages are installed.`. You can add your new language to the list along with the other languages present, following the same format. - Build Tidy: - Build Tidy per the usual instructions, and try it out using the `-lang` option. ## Best Practices ### Language Inheritance HTML Tidy will fallback from the specified language to the base language and then finally to the default English as required. This means, for example, a programmer might set `libtidy` to use “es_mx”, and if it doesn’t exist Tidy will automatically use “es”. If that doesn’t exist `libtidy` will continue to use whatever language it is currently using. ### String Inheritance HTML Tidy will also fallback for individual strings. For example if `libtidy` is set to use “es_mx” and a particular string is requested and not found, the library will look for the string in “es”. If the string is not found there then the “en” string will be given. ### Base Language First and Regional Variants Because of this inheritance we hope to localize base languages first, as the only strings then required for regional variants are the strings that differ. This will help us keep HTML Tidy and `libtidy` small. If you are working on a regional variation (such as “us_CA”) please only localize strings that are actually _different_ from the base language! ### Positional Parameters Please note that HTML Tidy does not current support positional parameters. Due to the nature of most of Tidy's output, it's not expected that they will be required. In any case, please translate strings so that substitution values are in the same order as the original string. ## Testing We hope to develop a comprehensive test suite in the future, but in the meantime you can test localized output like this. ### Command line option Use the `-lang`/`-language` option and specify a POSIX or Windows language name. This option should be first option used because the console application parses and acts on options first-in, first-out. ### Changing your locale On Unix/Mac and Linux operating systems you can change your shell’s locale temporarily with: `export LANG=en_GB` `export LC_ALL=en_GB` …substituting, of course the language of your choice. ### East Asian Languages East Asian languages are completely supported and have been tested on Linux, Mac OS X, and Windows, although Windows requires you to set your operating system (not the console locale!) to an East Asian locale to enable this in Windows Console and PowerShell. Note that PowerShell ISE always supports East Asian languages without requiring you to change your operating system locale. ## gettext Although HTML Tidy uses `gettext`-compatible tools and PO files for language localization, Tidy itself does _not_ use `gettext`. Tidy's build philosophy is build it anywhere and build it with anything. As `gettext` is not universally available on every platform under the sun, Tidy cannot count on `gettext`. Instead Tidy builds all translations into its library (and command line executable if built monolithically), and can run on virtually any general purpose computer with any operating system. While this does not pose a significant problem for storage or execution space on modern PC's, we understand that certain applications may still be space critical. As such it's trivial to build Tidy without this extra language support using the `-DSUPPORT_LOCALIZATIONS=NO` switch. ## poconvert.rb Tidy's source code includes a Ruby batch file called `poconvert.rb` which can be used to generate POT, PO, and H files, and convert them back and forth. It has been designed to work in a similar fashion as `gettext`'s tools, and includes conveniences that let translators work in different source languages. Please use `poconvert.rb help` for complete information (`ruby poconvert.rb help` on Windows). Note that you must install Ruby on your system, as well as install the required dependencies. These can be manually installed with `[sudo] gem install xxx`, where `xxx` represents the packages listed in `Gemfile`. For convenience, if you have the Bundler gem installed, you can `bundle install` for automated dependency installation. Also take note of these two important characteristics: - `poconvert.rb` is currently dependent on its current path. You can move it from its current location, but you will have to change the values of the `@@default_en` and `@@header_template` variables within the script. - All files will be output in the current working directory. This will prevent accidental overwrites of important files while we all get used to the workflows. Below are some sample workflows. ### Create a new POT file Although we provide `tidy.pot` in the source, you can generate your own. `./poconvert.rb xgettext` This will put a fresh, new copy of `tidy.pot` in the working directory. ### Create a new POT file with non-English `msgid` strings Although `gettext` officially recognizes English as the one, true source language for PO and POT files, if you're more comfortable translating from a non-English language, we can support you. `./poconvert.rb xgettext ` Where `` is the path to an existing Tidy language header file. This will produce a `tidy.pot` using the translated strings as `msgid`, using English as a backup when translated strings are not present. This can be valuable in producing regional variant translations, e.g., when translating from `es` to `es_mx`. ### Convert an existing H to PO In many cases you may want to have a fresh PO generated from a Tidy H file. This can be accomplished with: `./poconvert.rb msgunfmt ` ### Convert an existing H to PO using a different `msgid` language If you want to generate a fresh PO file from a Tidy H file, but _also_ want to have untranslated strings from a language other than English, try: `./poconvert.rb msgunfmt --baselang=` ### Create a blank PO file for a particular region `./poconvert.rb msginit` or `./poconvert.rb msginit --locale=LOCALE` The first example will try to guess your current region, and the second will use a region specified. Tidy only knows about the same regions that `gettext` knows; if our `msginit` does not recognize the region you specify, you will have to create a new PO and modify the region settings yourself. To create the blank PO using `msgid` strings from a different Tidy language, you can use: `./poconvert.rb msginit [--locale=LOCALE]` ### Create a Tidy Language Header H file When you're ready to include the language in Tidy, you can generate its header file with: `./poconvert.rb msgfmt ` In the event you are creating a regional variant of a language, it's an excellent idea to have Tidy exclude strings that are already present in the parent language in order to reduce library and executable size. For example if `es` already includes the string "archivo" there is no reason for your translation to `es_mx` to include it, too. You can tell `poconvert.rb` to exclude strings matching another localization like so: `./poconvert.rb msgfmt --baselang=` ### Prepare your non-English PO for a PR Although we have provided tools to allow you to work in languages other than English, we can only accept PO's in the repository that have English `msgid` fields. It's easy to convert your PO back to English: `./poconvert msgfmt ` `./poconvert msgunfmt ` The first command converts your non-standard PO into a Tidy Language Header file, and the second will create a fresh, new PO file from the header that you've just created. ### Update your PO to match the new POT If Tidy's POT changes, e.g., new strings are added, new comments, etc., the simplest way to update your PO is to convert it to a header (which normalizes it to the latest Tidy standard), and then convert the header to a new PO again. `./poconvert msgfmt ` `./poconvert msgunfmt ` ## Help Tidy Get Better It goes without saying **all help is appreciated**. We need to work together to make Tidy better! ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������tidy-html5-5.2.0/localize/language_ll_cc.h.erb������������������������������������������������������0000664�0000000�0000000�00000004634�12726015173�0021172�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef language_<%= po_content.language %>_h #define language_<%= po_content.language %>_h /* * language_<%= po_content.language %>.h * Localization support for HTML Tidy. * * * This file is a localization file for HTML Tidy. It will have been machine * generated or created and/or edited by hand. Both are valid options, but * please help keep our localization efforts simple to maintain by maintaining * the structure of this file, and changing the check box below if you make * changes (so others know the file origin): * * [X] THIS FILE IS MACHINE GENERATED. It is a localization file for the * language (and maybe region) "<%= po_content.language %>". The source of * these strings is a gettext PO file in Tidy's source, probably called * "language_<%= po_content.language %>.po". * * [ ] THIS FILE WAS HAND MODIFIED. Translators, please feel to edit this file * directly (and check this box). If you prefer to edit PO files then use * `poconvert.rb msgunfmt language_<%= po_content.language %>.h` (our own * conversion tool) to generate a fresh PO from this file first! * * (c) 2015 HTACG * See tidy.h and access.h for the copyright notice. * * Template Created by Jim Derry on 01/14/2016. * * Orginating PO file metadata: * PO_LAST_TRANSLATOR=<%= po_content.last_translator %> * PO_REVISION_DATE=<%= po_content.po_revision_date %> */ #ifdef _MSC_VER #pragma execution_character_set("utf-8") #endif #include "language.h" #include "access.h" #include "message.h" /** * This language-specific function returns the correct pluralForm * to use given n items, and is used as a member of each language * definition. */ static uint whichPluralForm_<%= po_content.language %>(uint n) { /* <%= po_content.plural_forms %> */ return <%= po_content.plural_formula %> } /** * This structure specifies all of the strings needed by Tidy for a * single language. Static definition in a header file makes it * easy to include and exclude languages without tinkering with * the build system. */ static languageDefinition language_<%= po_content.language %> = { whichPluralForm_<%= po_content.language %>, { /*************************************** ** This MUST be present and first. ** Specify the code for this language. ***************************************/ <%= report_body %> <%= report_body_last %> }}; #endif /* language_<%= po_content.language %>_h */ ����������������������������������������������������������������������������������������������������tidy-html5-5.2.0/localize/poconvert.rb��������������������������������������������������������������0000775�0000000�0000000�00000142437�12726015173�0017706�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env ruby ############################################################################### # poconvert.rb # Run this script with `help` for more information (or examine this file.) ############################################################################### require 'bundler/setup' # Provides environment for this script. require 'logger' # Log output simplified. require 'fileutils' # File utilities. require 'date' # Make sure DateTime works. require 'fileutils' # compare_file, etc. require 'erb' # Needed for templating. require 'thor' # thor provides robust command line parameter parsing. require 'i18n' # Cross-platform access to `locale`. require 'digest' # For computing checksums. require 'git' # For working with old versions of files. ################################################################################ # module PoConvertModule # This module encapsulates module-level variables, utilities, logging, # the CLI handling class, and the po<->h conversion class. ############################################################################### module PoConvertModule ########################################################### # Setup # Change these variables in case directories are changed. ########################################################### @@default_en = File.expand_path(File.join('..', 'src', 'language_en.h' )) @@header_template = File.expand_path(File.join('.', 'language_ll_cc.h.erb')) @@header_digest = 'b597e5948de1611ab6cde11934df6fc792c7ec4d21f3cd2030fb2e9bcfb94991' ########################################################### # Logging ########################################################### @@log = Logger.new(STDOUT) @@log.level = Logger::ERROR @@log.datetime_format = '%Y-%m-%d %H:%M:%S' ########################################################### # property log_level ########################################################### def self.log_level @@log.level end def self.log_level=(level) @@log.level = level end ############################################################################# # class PoPoFile # This class contains information about a parsed PO file. ############################################################################# class PoPoFile include PoConvertModule attr_accessor :language attr_accessor :plural_forms attr_accessor :plural_formula attr_accessor :po_revision_date attr_accessor :last_translator attr_accessor :items ######################################################### # initialize ######################################################### def initialize( file = nil ) @source_file = nil # File path of the header file @language = nil # From the header @plural_forms = nil # From the header @plural_formula = nil # From the header @po_revision_date = nil # String, from the header @last_translator = nil # From the header @items = {} self.source_file = file if file end ######################################################### # property source_file ######################################################### def source_file @source_file end def source_file=( value ) @source_file = nil unless value @@log.error "#{__method__}: A source file must be specified." return end unless value && %w[.po].include?(File.extname(value)) @@log.error "#{__method__}: Source file must be a *.po file." return end unless value && File.exists?(value) @@log.error "#{__method__}: Source file #{value} not found." return end @@log.info "#{__method__}: Source file #{value} will be used." if parse_po( value ) @source_file = value else @@log.error "#{__method__}: Source file #{value} was not able to be parsed properly." end end ######################################################### # parse_po( file ) # Parses a given PO file, returning true/false on # success/failure. ######################################################### def parse_po(file) content = File.open(file) { |f| f.read } # Get the stuff we want to keep from the PO header. tmp = content.match(/"Language: (.*?)\\n"/i) self.language = tmp[1].downcase if tmp tmp = content.match(/"(Plural-Forms: .*?;)\s*?plural=\s*?(.*?)\\n"/i) self.plural_forms = tmp[1] if tmp self.plural_formula = tmp[2] if tmp tmp = content.match(/"PO-Revision-Date: (.*?)\\n"/i) self.po_revision_date = tmp[1] if tmp tmp = content.match(/"Last-Translator: (.*?)\\n"/i) self.last_translator = tmp[1] if tmp # Build a catalogue of all items. Note that whitespace around blocks # is required in the PO files. content.scan(%r!((?:^#|^msgctxt).*?)(?:\z|^\n)!im) do | section | item = parse_po_section(section[0]) if item self.items.merge!(item) unless item[item.keys[0]].empty? unless item.empty? else return false end end language && plural_forms && plural_formula && po_revision_date && last_translator && items end # parse_po ######################################################### # parse_po_section( content ) # Parses a single PO section. ######################################################### def parse_po_section( content ) # Maybe this is a bit of overkill, but it's easy to extend # if we want to capture more PO stuff in the future. map = [ [ :START, :COMMENT, :SET_COMMENT, :START ], [ :START, :FLAG, :SET_FLAG, :START ], [ :START, :NEW_ITEM, :SET_INIT, :CONTINUE ], [ :START, :OTHER, :NOOP, :START ], [ :START, :EMPTY, :NOOP, :START ], [ :CONTINUE, :COMMENT, :ERROR, nil ], [ :CONTINUE, :FLAG, :ERROR, nil ], [ :CONTINUE, :NEW_ITEM, :SET_FINAL, :CONTINUE ], [ :CONTINUE, :EMPTY, :SET_FINAL, :START ], [ :CONTINUE, :OTHER, :ADD_TO, :CONTINUE ], ].collect { |item| [:STATE, :CONDITION, :ACTION, :NEXT].zip(item).to_h } current_label = nil current_comment = nil current_flag = nil current_cases = {} # 'case' => string state = :START buffer = '' item = '' content << "\n\n" # ensure that we have a final transition. content.each_line do |line| # Determine the input condition input = :OTHER input = :EMPTY if line == "\n" input = :COMMENT if line.start_with?('#.') input = :FLAG if line.start_with?('#,') input = :NEW_ITEM if line.start_with?('msgctxt', 'msgid', 'msgstr') # Find our current state-input pair map.each do | transition | if transition[:STATE] == state && transition[:CONDITION] == input case transition[:ACTION] when :SET_INIT regex = line[/".*"/] buffer = regex unless regex == '""' item = line[/^(.*?)\s/, 1] when :ADD_TO buffer << "\n#{line[/".*"/]}" when :SET_FINAL if item == 'msgctxt' current_label = buffer.tr('"', '') elsif item == 'msgstr' current_cases['0'] = buffer elsif item.start_with?('msgstr') subscript = item.match(/msgstr\[(.*)\]/)[1] current_cases[subscript] = buffer end buffer = '' regex = line[/".*"/] buffer = regex unless regex == '""' item = line[/^(.*?)\s/, 1] when :SET_COMMENT current_comment = line.match(/#\.\s*(.*?)$/)[1] when :SET_FLAG current_flag = line.match(/#\,\s*(.*?)$/)[1] when :ERROR @@log.error "#{__method__}: Could NOT parse part of the PO file. Aborting!\n" @@log.error "#{__method__}: Last known label was \"#{current_label}\".\n" return nil else # consume, other end state = transition[:NEXT] break end # if end # do end # content.each # We have some nice local vars but let's put these into a hash # just like PoHeader file uses: # :keyword => { '#' => { :comment, :fuzzy, :case, :string } } # We will also reject items that have no string value. result = {} if current_label current_label = current_label.to_sym result[current_label] = {} current_cases.each do | key, value | unless value == '' fuzzy = ( current_flag =~ /fuzzy/i ) != nil result[current_label][key] = {} result[current_label][key][:comment] = fuzzy ? "(fuzzy) #{current_comment}" : current_comment result[current_label][key][:fuzzy] = fuzzy result[current_label][key][:if_group] = nil result[current_label][key][:case] = key result[current_label][key][:string] = value end end end result end # parse_po_section end # class PoPoFile ############################################################################# # class PoHeaderFile # This class contains information about a parsed header file. ############################################################################# class PoHeaderFile include PoConvertModule attr_accessor :lang_name attr_accessor :items #:keyword => { '#' => { :comment, :if_group, :case, :string } } attr_accessor :plural_count attr_accessor :plural_form ######################################################### # initialize ######################################################### def initialize( file = nil ) @source_file = nil # File path of the header file @lang_name = nil # Name of the languageDictionary instance in C. @items = nil @plural_count = 0 @plural_form = nil self.source_file = file if file end ######################################################### # property source_file ######################################################### def source_file @source_file end def source_file=( value ) @source_file = nil unless value @@log.error "#{__method__}: A source file must be specified." return end unless value && %w[.h].include?(File.extname(value)) @@log.error "#{__method__}: Source file must be a *.h file." return end unless value && File.exists?(value) @@log.error "#{__method__}: Source file #{value} not found." return end @@log.info "#{__method__}: Source file #{value} will be used." if parse_header( value ) @source_file = value else @@log.error "#{__method__}: Source file #{value} was not able to be parsed properly." end end ######################################################### # parse_header( file ) # Parses a given header file and returns the language # plural count, form, name, and a hash of strings: # # We don't want to set instance variables directly. ######################################################### def parse_header(file) self.plural_count = 0 self.plural_form = nil self.lang_name = nil self.items = {} content = File.open(file) { |f| f.read } # Get the plural form data from the correct location in the header. # These will be written to the header area of the PO/POT file. match = content.match(%r!^static uint whichPluralForm.*?\{.*?/\* Plural-Forms: nplurals=(.*?);.*?\*/.*return (.*?;).*?\}!m) if match self.plural_count = match[1] self.plural_form = match[2] else @@log.error "#{__method__}: Could not determine the plural form. Something wrong with source file?" return false end # The language name is used for file names and setting PO information. match = content.match(/^static languageDefinition (.*) =.*$/) if match self.lang_name = match[1] else @@log.error "#{__method__}: Could not determine the language name. Something wrong with source file?" return false end # Build a catalogue of all items. content.scan(%r!^\s*\{(?:/\* (.*?) \*/)?\s*(.*?),\s*(.*?),\s*(.*?)\s*\},?!m) do | comment, key, num_case, string | l_key = key.to_sym self.items[l_key] = {} unless items.has_key?(l_key) self.items[l_key][num_case] = {} self.items[l_key][num_case][:comment] = comment ? comment.sub( /\(fuzzy\) /i, '') : nil self.items[l_key][num_case][:fuzzy] = ( comment =~ /\(fuzzy\) /i ) != nil self.items[l_key][num_case][:case] = num_case self.items[l_key][num_case][:if_group] = nil # Reconstitute Hex Escapes tmp = string.each_line.collect do |line| line.lstrip.gsub(/\\x(..)/) { |g| [$1.hex].pack('c*').force_encoding('UTF-8') } end # Eliminate C double-double-quotes. tmp = tmp.join.gsub(/(? 1);' ], [ 'fr', 'French', 'nplurals=2; plural=(n > 1);' ], [ 'lv', 'Latvian', 'nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2);' ], [ 'ga', 'Irish', 'nplurals=3; plural=n==1 ? 0 : n==2 ? 1 : 2;' ], [ 'ro', 'Romanian', 'nplurals=3; plural=n==1 ? 0 : (n==0 || (n%100 > 0 && n%100 < 20)) ? 1 : 2;' ], [ 'lt', 'Lithuanian', 'nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2);' ], [ 'ru', 'Russian', 'nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);' ], [ 'uk', 'Ukrainian', 'nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);' ], [ 'be', 'Belarusian', 'nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);' ], [ 'sr', 'Serbian', 'nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);' ], [ 'hr', 'Croatian', 'nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);' ], [ 'cs', 'Czech', 'nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;' ], [ 'sk', 'Slovak', 'nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;' ], [ 'pl', 'Polish', 'nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);' ], [ 'sl', 'Slovenian', 'nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);' ] ].each do | array_item | key = array_item[0].to_sym lang = array_item[1] plural_form = array_item[2] @known_locales[key] = {} @known_locales[key][:lang] = lang @known_locales[key][:plural_form] = plural_form end end @known_locales end ######################################################### # property english_header? # Indicates whether or not the default en header file # can be found. ######################################################### def english_header? result = File.exists?(@@default_en) if result @@log.info "#{__method__}: Default English was found at #{@@default_en}" else @@log.error "#{__method__}: Cannot find the default English localization file. Check the value of @@default_en in this script." end result end ######################################################### # property header_template? # Indicates whether or not the header template file # can be found and hasn't been tampered with. ######################################################### def header_template? result = File.exists?(@@header_template) if result @@log.info "#{__method__}: The header template was found at #{@@header_template}" else @@log.error "#{__method__}: Cannot find the header template file. Check the value of @@header_template in this script." return false end digest = Digest::SHA256.file(@@header_template.to_s) result = digest == @@header_digest unless result @@log.error "#{__method__}: Did someone tamper with the header template? If you" @@log.error "#{__method__}: meant to change the template and know what you're doing," @@log.error "#{__method__}: then the new digest is:" @@log.error "#{__method__}: #{digest}" end result end ######################################################### # property safe_backup_name( file ) # Determines a safe name for a backup file name. ######################################################### def safe_backup_name( filename ) file = filename orig_file = filename index = 1 while File.exists?(file) index = index + 1 file = "#{File.basename(orig_file, '.*')}-#{index}#{File.extname(orig_file)}" end file end ######################################################### # convert_to_po( source_file_h, base_file, fuzzy_list ) # Perform the conversion for xgettext, msginit, and # msgunfmt. ######################################################### def convert_to_po( source_file_h = nil, base_file = nil, fuzzy_list = nil ) return false unless english_header? # What we actually do depends on what was setup for us. # If source_file_h is nil and po_locale is nil, we are xgettext. # If source_file_h is nil and we have po_locale, we are msginit. # If we have a source_file_h, then we are msgunfmt. action = :msgunfmt action = :msginit if source_file_h.nil? && po_locale action = :xgettext if source_file_h.nil? && po_locale.nil? # lang_en serves as the master reference for all output, especially # comments and metadata. lang_en = PoHeaderFile.new(@@default_en) return false unless lang_en.source_file # untranslated_items serves as the source for *untranslated* strings. # This differs from lang_en in that we may overwrite some of the # lang_en strings from the base_file, later. This can help when # translating, e.g., regional formats. untranslated_items = lang_en.items.clone if base_file lang_base = PoHeaderFile.new(base_file) return false unless lang_base.source_file untranslated_items.merge!(lang_base.items) end # We will use lang_source if we have a source_file_h, i.e., msgunfmt, # as the source for *translated* strings. if source_file_h lang_source = PoHeaderFile.new(source_file_h) return false unless lang_source.source_file else lang_source = nil end # If we were given a fuzzy_list and we have a source_file, then # we have to mark appropriate items as fuzzy. if fuzzy_list && fuzzy_list.count > 0 && lang_source untranslated_items.each do |key, value| if fuzzy_list.include?(key) value.each_value do |v| v[:fuzzy] = true end end end end # The information in the PO header can come from a few different sources # depending on what we're doing. header_plural_forms = nil header_pot_line = nil header_translate_to = nil if action == :xgettext header_plural_forms = "Plural-Forms: nplurals=#{lang_en.plural_count}; plural=#{lang_en.plural_form}" header_pot_line = "POT-Creation-Date: #{DateTime.now.strftime('%Y-%m-%d %H:%M:%S')}" header_translate_to = lang_en.items[:TIDY_LANGUAGE]['0'][:string].tr('"', '') end if action == :msginit header_plural_forms = "Plural-Forms: #{known_locales[po_locale.to_sym][:plural_form]}" header_pot_line = "PO-Revision-Date: #{DateTime.now.strftime('%Y-%m-%d %H:%M:%S')}" header_translate_to = po_locale end if action == :msgunfmt header_plural_forms = "Plural-Forms: nplurals=#{lang_source.plural_count}; plural=#{lang_source.plural_form}" header_pot_line = "PO-Revision-Date: #{DateTime.now.strftime('%Y-%m-%d %H:%M:%S')}" header_translate_to = lang_source.items[:TIDY_LANGUAGE]['0'][:string].tr('"', '') end header_plural_count = header_plural_forms.match(/nplurals=(.*?);/i)[1].to_i - 1 # We'll use this closure to perform a repetitive task in the report. item_output = lambda do | label, string | result = '' if string.lines.count > 1 result << "#{label} \"\"\n" result << "#{string}\n" else result << "#{label} #{string}\n" end result end report = <<-HEREDOC msgid "" msgstr "" "Content-Type: text/plain; charset=UTF-8\\n" "Language: #{header_translate_to}\\n" "#{header_plural_forms}\\n" "X-Generator: HTML Tidy #{File.basename($0)}\\n" "Project-Id-Version: \\n" "#{header_pot_line}\\n" "Last-Translator: #{ENV['USER']}#{ENV['USERNAME']}\\n" "Language-Team: \\n" HEREDOC untranslated_items.delete(:TIDY_LANGUAGE) untranslated_items.delete(:TIDY_MESSAGE_TYPE_LAST) untranslated_items.each do |key, value| if value['0'][:comment] value['0'][:comment].each_line { |line| report << "#. #{line.strip}\n"} end attribs = [] attribs << 'fuzzy' if value['0'][:fuzzy] && action == :msgunfmt attribs << 'c-format' if %w(%u %s %d).any? { | find | value['0'][:string].include?(find) } if attribs.count > 0 report << "#, #{attribs.join(', ')}\n" end report << "msgctxt \"#{key.to_s}\"\n" # Handle the untranslated strings, with the possibility that there # are two forms. PO/POT is English-based and supports only a singular # and plural form. value.each_value do | subitem | label = subitem[:case] == '0' ? 'msgid' : 'msgid_plural' report << item_output.(label, subitem[:string]) end # Handle translated strings, with the possibility that there # are multiple plural forms for them. en_is_singular = value.count == 1 if lang_source && lang_source.items[key] # Print translated strings. if en_is_singular report << item_output.( 'msgstr', lang_source.items[key]['0'][:string]) else # Print available plural forms and write blanks for the rest. (0..header_plural_count).each do |i| if lang_source.items[key].has_key?(i.to_s) report << item_output.( "msgstr[#{i}]", lang_source.items[key][i.to_s][:string]) else report << "msgstr[#{i}] \"\"\n" end end end else # Print empty translated strings. if en_is_singular report << "msgstr \"\"\n" else (0..header_plural_count).each do |i| report << "msgstr[#{i}] \"\"\n" end end end report << "\n" end # do if emacs_footer report << <<-HEREDOC # Local Variables: # mode: po # eval: (add-hook 'po-subedit-mode-hook '(lambda () (setq fill-column 78))) # End: HEREDOC end output_file = action == :xgettext ? 'tidy.pot' : "language_#{header_translate_to}.po" if File.exists?(output_file) File.rename(output_file, safe_backup_name(output_file)) end File.open(output_file, 'w') { |f| f.write(report) } @@log.info "#{__method__}: Results written to #{output_file}" puts "Wrote a new file to #{File.expand_path(output_file)}" true end # convert_to_po ######################################################### # convert_to_h( file, base-file ) # Perform the conversion. ######################################################### def convert_to_h( file, base_file ) po_content = PoPoFile.new(file) return false unless po_content.source_file && english_header? && header_template? # We will use English to ensure that no English strings are # included in the translation. lang_en = PoHeaderFile.new(@@default_en) return false unless lang_en.source_file filter_items = lang_en.items.clone # We will also filter out items that are already the same # in the base language, in order to keep Tidy small. It's # actually possible to miss some English strings if, for # some reason, the PO has English strings that the base # language does not, but severity * likelihood == unimportant. if base_file lang_base = PoHeaderFile.new(base_file) return false unless lang_base.source_file filter_items.merge!(lang_base.items) end # We will hard code these into the generated file. filter_items.delete(:TIDY_LANGUAGE) filter_items.delete(:TIDY_MESSAGE_TYPE_LAST) # Eliminate PO items if they match inherited items (in the filter), or # if they're not included in English (i.e., entries not used by Tidy). # We are comparing _complete entries_ right here, with the PO as the # official source. Therefore all plurals are accounted for, #IF groups, # and comments. po_content.items.reject! do |key, value| ( (filter_items.has_key?(key) && filter_items[key] == value) ) || !filter_items.has_key?(key) end # #if groups and comments: # We need to know which translated items belong in #if groups. Since we # don't store this metadata in the PO, find out which #if groups they # belong to from the original language_en.h. # Additionally we will only use comments from language_en.h. Besides # preventing us from having to format them, we ensure that only the # canonical comments are put into the H file in the event of changes. # Additionally only include comments if enabled. # Finally add fuzzy notes to comments if the PO item is fuzzy. po_content.items.each do |key, value| value.each_value do |item_entry| item_entry[:if_group] = lang_en.items[key]['0'][:if_group] item_entry[:comment] = force_comments ? lang_en.items[key]['0'][:comment] : nil item_entry[:comment] = "(fuzzy) #{item_entry[:comment]}" if item_entry[:fuzzy] end end # Gather some information to format this nicely, and perform # UTF escaping if necessary. longest_key = 22 # length of TIDY_MESSAGE_TYPE_LAST. longest_value = 10 # reasonable default in case no single-line strings are found. po_content.items.each do |key, value| longest_key = key.length if key.length > longest_key value.each_value do |value_inner| # If we're not plaintext then escape UTF sequences. unless plaintext value_inner[:string].gsub!(/[^\u0000-\u007e][0-9a-fA-F]?/) do |c| esc = c[0].bytes.map{ |b| '\\x' + b.to_s(16) }.join('') if c[1] esc += '""' + c[1] end esc end end length = value_inner[:string].length longest_value = length if length > longest_value && !value_inner[:string].start_with?("\n") end end # Manually build the first line with the proper language code. report_body = " {/* Specify the ll or ll_cc language code here. */\n" report_body << " #{'TIDY_LANGUAGE,'.ljust(longest_key+2)}0, \"#{po_content.language}\"\n" report_body << " },\n" # Generate the main header body. Although it's a machine-generated # document we still care that it's pretty-printed and readable. In # this respect we have four output formats: single line values; # single line values with developer comment; multiline values; and # multiline values with developer comment. if_group = nil po_content.items.each do |item_key, item_value| item_group = item_value[item_value.keys[0]][:if_group] unless item_group == if_group # The current if grouping has changed. unless if_group.nil? # Close current group. report_body << "#endif /* #{if_group} */\n\n" end if_group = item_group unless if_group.nil? # Open new group. report_body << "\n#if #{if_group}\n" end end # Handle each entry individually. item_value.each_value do |entry_value| if entry_value[:string].start_with?("\n") # Format a multiline value. if entry_value[:comment] report_body << " {/* #{entry_value[:comment]} */\n" report_body << " #{(item_key.to_s + ',').ljust(longest_key+2)}#{entry_value[:case]}," else report_body << " { #{(item_key.to_s + ',').ljust(longest_key+2)}#{entry_value[:case]}," end entry_value[:string].lines.each do |line| report_body << " #{line}" end report_body << "\n },\n" else # Format a single line value. if entry_value[:comment] report_body << " {/* #{entry_value[:comment]} */\n" report_body << " #{(item_key.to_s + ',').ljust(longest_key+2)}#{entry_value[:case]}, #{entry_value[:string]}\n" report_body << " },\n" else # known issue: ljust doesn't work for certain unicode characters, so no pretty-printing, e.g., Chinese. report_body << " { #{(item_key.to_s + ',').ljust(longest_key+2)}#{entry_value[:case]}, #{entry_value[:string].ljust(longest_value+2)} },\n" end end end end # po_content.items.each # Close off current if_group if any, because there will # not be another state change to do so. unless if_group.nil? report_body << "#endif /* #{if_group} */\n" end # Force the final closing line manually; can't count on PO. We # could add this to the template, but let's give it the same # pretty-printing as the other items. report_body_last = " {/* This MUST be present and last. */\n" report_body_last << " #{'TIDY_MESSAGE_TYPE_LAST,'.ljust(longest_key+2)}0, NULL\n" report_body_last << " }\n" # We are going to use an external ERB template to build the report file. # Although it's trivial to hard-code all of the required text into this # method directly, it will be more convenient to keep an external file # synchronized with changes to language_en.h if we make changes. header_file = File.open(@@header_template) { |f| f.read } report = ERB.new(header_file).result(binding) # will use in-context vars. # Save output_file = "language_#{po_content.language}.h" if File.exists?(output_file) File.rename(output_file, safe_backup_name(output_file)) end File.open(output_file, 'w') do |f| f.write "\uFEFF" if plaintext # MSVC requires a BOM. f.write(report) end @@log.info "#{__method__}: Results written to #{output_file}" puts "Wrote a new header file to #{File.expand_path(output_file)}" true end # convert_to_h end # class PoConverter ############################################################################# # class PoConvertCLI # This class provides handlers for CLI parameters. ############################################################################# class PoConvertCLI < Thor include PoConvertModule class_option :verbose, :type => :boolean, :desc => 'Provides verbose debug output.', :aliases => '-v' class_option :debug, :type => :boolean, :desc => 'Provides really, really verbose debug output.', :aliases => '-d' ######################################################### # initialize ######################################################### def initialize(*args) super end ######################################################### # help # Override the default help in order to better describe # what we're doing. ######################################################### def help(*args) if args.count == 0 puts <<-HEREDOC This script (#{File.basename($0)}) converts back and forth between GNU gettext PO files preferred by localizers and Tidy's language header H files which ensure that Tidy stays small and cross-platform. All output files are placed into the current working directory using a file name appropriate to the operation being performed. Complete Help: -------------- HEREDOC end super end # help ######################################################### # xgettext # See long_desc ######################################################### desc 'xgettext [input_file.h]', 'Creates a POT file for use with HTML Tidy.' option :emacs, :type => :boolean, :desc => 'Appends emacs editor information to the end of the PO file.', :aliases => '-e' long_desc <<-LONG_DESC Creates an empty POT from Tidy's native English header, or optionally from a specified language using English as a backup source. POT files have no translated strings; they are empty templates. Use case: in the Tidy localization process there's probably no real reason to use this unless you prefer to set the header manually compared to how #{File.basename($0)} msginit does it. LONG_DESC def xgettext(input_file = nil) converter = PoConverter.new converter.emacs_footer = options[:emacs] set_options if converter.convert_to_po( nil, input_file) puts 'xgettext exited without errors.' else puts 'xgettext exited with errors. Consider using the --verbose or --debug options.' exit 1 end end # xgettext ######################################################### # msginit # See long_desc ######################################################### option :locale, :type => :string, :desc => 'Specifies the locale in ll or ll_CC format for the generated PO file.', :aliases => '-l' option :emacs, :type => :boolean, :desc => 'Appends emacs editor information to the end of the PO file.', :aliases => '-e' desc 'msginit [input_file.h]', 'Creates a blank PO file for the current or specified locale.' long_desc <<-LONG_DESC Creates an empty PO file and tries to set locale-specific header information. The untranslated strings are Tidy's native English strings unless [input_file.h] is specified (English will still be used as a backup). This tool will try to use the current locale to generate the PO file unless the --locale option specifies a different locale. Use case: use this to generate a PO file for a language that Tidy has not yet been translated to. LONG_DESC def msginit(input_file = nil) converter = PoConverter.new converter.emacs_footer = options[:emacs] set_options unless (converter.po_locale = options[:locale] ? options[:locale] : I18n.locale) puts 'msginit exited with errors. Consider using the --verbose or --debug options.' exit 1 end if converter.convert_to_po(nil, input_file) puts 'msginit exited without errors.' else puts 'msginit exited with errors. Consider using the --verbose or --debug options.' exit 1 end end # msginit ######################################################### # msgunfmt # See long_desc ######################################################### option :baselang, :type => :string, :desc => 'Specifies a base language from which to include untranslated strings.', :aliases => '-b' option :emacs, :type => :boolean, :desc => 'Appends emacs editor information to the end of the PO file.', :aliases => '-e' desc 'msgunfmt ', 'Converts an existing Tidy header H file to PO format.' long_desc <<-LONG_DESC Converts an existing Tidy header H file to a PO file using the locale specified in the H file. Specifying is required, and multiple input files may be specified. The resulting file will consist of English original strings, the translated strings from the header, and blank translated strings if not specified in the header. You can use the --baselang option to gather the untranslated strings from a different header file. This may be useful for translators that want to implement a region-specific localization, for example, translating `es` to `es_mx`. Use case: create a PO file from an existing Tidy header H file using a combination of languages that are suitable to you. LONG_DESC def msgunfmt(*args) error_count = 0 args.each do |input_file| converter = PoConverter.new converter.emacs_footer = options[:emacs] set_options error_count = converter.convert_to_po(input_file, options[:baselang]) ? error_count : error_count + 1 end if error_count == 0 puts 'msgunfmt exited without errors.' else puts "msgunfmt exited with errors #{error_count} time(s). Consider using the --verbose or --debug options." exit 1 end end # msgunfmt ######################################################### # msgfmt # See long_desc ######################################################### option :baselang, :type => :string, :desc => 'Specifies a base language from which to exclude translated strings.', :aliases => '-b' option :hex, :type => :boolean, :desc => 'Specifies that the generated file contain hex escaped characters.', :aliases => '-h' option :force_comments, :type =>:boolean, :desc => 'Forces comments into the header file. Base language_en.h always has comments.', :aliases => '-f' desc 'msgfmt ', 'Creates a Tidy header H file from the given PO file.' long_desc <<-LONG_DESC Creates a Tidy header H file from the specified PO file, which is a required argument. Multiple input files may be specified. You can use the --baselang option to exclude already translated strings from an inherited base language. This will help keep Tidy's library and executable size to a minimum. For example if you wish to generate a header for es_mx (which uses es as its base language), then you should specify the "--baselang es" option. This will ensure that the generated header includes only strings that are unique to es_mx. Use case: Tidy can only build H files, and so this command will convert PO files to something useful. LONG_DESC def msgfmt(*args) error_count = 0 args.each do |input_file| converter = PoConverter.new converter.plaintext = !options[:hex] converter.force_comments = options[:force_comments] set_options error_count = converter.convert_to_h( input_file, options[:baselang] ) ? error_count : error_count + 1 end if error_count == 0 puts 'msgfmt exited without errors.' else puts "msgfmt exited with errors #{error_count} time(s). Consider using the --verbose or --debug options." exit 1 end end # msgfmt ######################################################### # rebase # See long_desc ######################################################### option :sha, :type =>:string, :desc => 'Specify the hash against which to check for changed strings.', :aliases => '-c' desc 'rebase [--sha=HASH]', 'Creates fresh POT, POs, and headers after updates to language_en.h.' long_desc <<-LONG_DESC After changing strings in language_en.h, this command will generate a fresh POT template, as well as regenerate POs for each language in src/. Finally, it will regenerate the language header files for each of the new PO files. Items that have changed in English will be appropriately marked as fuzzy in the PO files. Source files will *not* be overwritten. All generated files will be placed into the working directory. Please review them before committing them to source. If you specify the SHA-1 checksum of the commit for comparison purposes, then this command identifies fuzzy items by comparing language_en.h with a previous version as identified by the SHA-1. Use case: If you change language_en.h, this handy command updates everything else nearly automatically. LONG_DESC def rebase() error_count = 0 fuzzy_list = nil if options[:sha] pwd = File.expand_path( File.join(Dir.getwd, '..') ) sha = options[:sha] temp_file = "~#{sha}.h" project = Git.open(pwd) # We'll get the old version of the file from the specified commit, # and then write it to a temporary file. Then we can parse both # this temporary file as well as the current version of the file # and detect the differences. File.open( temp_file, 'w') { |f| f.write( project.show(sha, File.join('src', 'language_en.h')) ) } header_old = PoHeaderFile.new(temp_file) header_new = PoHeaderFile.new(@@default_en) File.delete( temp_file ) # Compare each item in the current version with the value, if any, # in the previous version in order to build a list of fuzzy stuff. fuzzy_list = [] header_new.items.each do |key, value| value.each do |plural_key, plural_value| new_value = plural_value[:string] old_value = header_old.items.include?(key) ? header_old.items[key][plural_key][:string] : nil unless old_value == new_value fuzzy_list << key end end end fuzzy_list.uniq! end # We're ready to generate the POT, which requires nothing special. converter = PoConverter.new unless converter.convert_to_po( nil, nil) error_count += 1 puts 'There was an issue generating the POT. Will continue anyway.' end # Build a list of header files. Keep this list instead of counting # on reading the working directory later. header_path = File.join(pwd, 'src', 'language_*.h') header_list = nil Dir.chdir(File.join(pwd, 'src')) do header_list = Dir.glob('language_*.h') end header_list.delete('language_en.h') # Building the POs is straight forward. header_list.each do |input_file| filename = File.join(pwd, 'src', input_file) converter = PoConverter.new error_count = converter.convert_to_po( filename, nil, fuzzy_list ) ? error_count : error_count + 1 end # Building the Headers is straight forward, too. header_list.each do |input_file| filename = "#{File.basename(input_file, '.*')}.po" converter = PoConverter.new error_count = converter.convert_to_h( filename, nil ) ? error_count : error_count + 1 end if error_count == 0 puts 'rebase exited without errors.' else puts "rebase exited with errors #{error_count} time(s). Consider using the --verbose or --debug options." exit 1 end end # msgfmt ######################################################### # set_options # Handles command line options. ######################################################### protected def set_options PoConvertModule::log_level = Logger::WARN if options[:verbose] PoConvertModule::log_level = Logger::DEBUG if options[:debug] end # set_options end # PoConvertCLI end # PoConvertModule ########################################################### # Main ########################################################### PoConvertModule::PoConvertCLI.start(ARGV) ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������tidy-html5-5.2.0/localize/translations/�������������������������������������������������������������0000775�0000000�0000000�00000000000�12726015173�0020045�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������tidy-html5-5.2.0/localize/translations/language_en_gb.po��������������������������������������������0000664�0000000�0000000�00000345751�12726015173�0023341�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������msgid "" msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Language: en_gb\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" "X-Generator: HTML Tidy poconvert.rb\n" "Project-Id-Version: \n" "PO-Revision-Date: 2016-03-24 10:59:55\n" "Last-Translator: jderry\n" "Language-Team: \n" "BAD" #. Only translate if a URL to the target language can be found. msgctxt "ACCESS_URL" msgid "http://www.w3.org/WAI/GL" msgstr "" #. Only translate if a URL to the target language can be found. msgctxt "ATRC_ACCESS_URL" msgid "http://www.html-tidy.org/accessibility/" msgstr "" #, c-format msgctxt "FILE_CANT_OPEN" msgid "Can't open \"%s\"\n" msgstr "" #, c-format msgctxt "LINE_COLUMN_STRING" msgid "line %d column %d - " msgstr "" #, c-format msgctxt "STRING_CONTENT_LOOKS" msgid "Document content looks like %s" msgstr "" #. For example, "discarding invalid UTF-16 surrogate pair" msgctxt "STRING_DISCARDING" msgid "discarding" msgstr "" #, c-format msgctxt "STRING_DOCTYPE_GIVEN" msgid "Doctype given is \"%s\"" msgstr "" #. The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. #, c-format msgctxt "STRING_ERROR_COUNT" msgid "Tidy found %u %s and %u %s!" msgstr "" msgctxt "STRING_ERROR_COUNT_ERROR" msgid "error" msgid_plural "errors" msgstr[0] "" msgstr[1] "" msgctxt "STRING_ERROR_COUNT_WARNING" msgid "warning" msgid_plural "warnings" msgstr[0] "" msgstr[1] "" msgctxt "STRING_HELLO_ACCESS" msgid "Accessibility Checks:" msgstr "" #. This is not a formal name and can be translated. msgctxt "STRING_HTML_PROPRIETARY" msgid "HTML Proprietary" msgstr "" #, c-format msgctxt "STRING_MISSING_MALFORMED" msgid "missing or malformed argument for option: %s" msgstr "" msgctxt "STRING_NO_ERRORS" msgid "No warnings or errors were found." msgstr "" msgctxt "STRING_NO_SYSID" msgid "No system identifier in emitted doctype" msgstr "" msgctxt "STRING_NOT_ALL_SHOWN" msgid "Not all warnings/errors were shown." msgstr "" msgctxt "STRING_PLAIN_TEXT" msgid "plain text" msgstr "" #. For example, "replacing invalid UTF-8 bytes" msgctxt "STRING_REPLACING" msgid "replacing" msgstr "" #. For example, "you should avoid using the specified encoding." msgctxt "STRING_SPECIFIED" msgid "specified" msgstr "" #, c-format msgctxt "STRING_UNKNOWN_FILE" msgid "%s: can't open file \"%s\"\n" msgstr "" #, c-format msgctxt "STRING_UNKNOWN_OPTION" msgid "unknown option: %s" msgstr "" msgctxt "STRING_UNRECZD_OPTION" msgid "unrecognized option -%c use -help to list options\n" msgstr "" msgctxt "STRING_XML_DECLARATION" msgid "XML declaration" msgstr "" #. This console output should be limited to 78 characters per line. msgctxt "TEXT_HTML_T_ALGORITHM" msgid "" "\n" " - First, search left from the cell's position to find row header cells.\n" " - Then search upwards to find column header cells.\n" " - The search in a given direction stops when the edge of the table is\n" " reached or when a data cell is found after a header cell.\n" " - Row headers are inserted into the list in the order they appear in\n" " the table. \n" " - For left-to-right tables, headers are inserted from left to right.\n" " - Column headers are inserted after row headers, in \n" " the order they appear in the table, from top to bottom. \n" " - If a header cell has the headers attribute set, then the headers \n" " referenced by this attribute are inserted into the list and the \n" " search stops for the current direction.\n" " TD cells that set the axis attribute are also treated as header cells.\n" "\n" msgstr "" #. This console output should be limited to 78 characters per line. msgctxt "TEXT_WINDOWS_CHARS" msgid "" "Characters codes for the Microsoft Windows fonts in the range\n" "128 - 159 may not be recognized on other platforms. You are\n" "instead recommended to use named entities, e.g. ™ rather\n" "than Windows character code 153 (0x2122 in Unicode). Note that\n" "as of February 1998 few browsers support the new entities.\n\n" msgstr "" #. This console output should be limited to 78 characters per line. #. - %s represents a string-encoding name which may be localized in your language. #, c-format msgctxt "TEXT_VENDOR_CHARS" msgid "" "It is unlikely that vendor-specific, system-dependent encodings\n" "work widely enough on the World Wide Web; you should avoid using the \n" "%s character encoding, instead you are recommended to\n" "use named entities, e.g. ™.\n" "\n" msgstr "" #. This console output should be limited to 78 characters per line. #. - %s represents a string-encoding name which may be localized in your language. #. - The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. #, c-format msgctxt "TEXT_SGML_CHARS" msgid "" "Character codes 128 to 159 (U+0080 to U+009F) are not allowed in HTML;\n" "even if they were, they would likely be unprintable control characters.\n" "Tidy assumed you wanted to refer to a character with the same byte value in the \n" "%s encoding and replaced that reference with the Unicode \n" "equivalent.\n" "\n" msgstr "" #. This console output should be limited to 78 characters per line. msgctxt "TEXT_INVALID_UTF8" msgid "" "Character codes for UTF-8 must be in the range: U+0000 to U+10FFFF.\n" "The definition of UTF-8 in Annex D of ISO/IEC 10646-1:2000 also\n" "allows for the use of five- and six-byte sequences to encode\n" "characters that are outside the range of the Unicode character set;\n" "those five- and six-byte sequences are illegal for the use of\n" "UTF-8 as a transformation of Unicode characters. ISO/IEC 10646\n" "does not allow mapping of unpaired surrogates, nor U+FFFE and U+FFFF\n" "(but it does allow other noncharacters). For more information please refer to\n" "http://www.unicode.org/ and http://www.cl.cam.ac.uk/~mgk25/unicode.html\n" "\n" msgstr "" #. This console output should be limited to 78 characters per line. msgctxt "TEXT_INVALID_UTF16" msgid "" "Character codes for UTF-16 must be in the range: U+0000 to U+10FFFF.\n" "The definition of UTF-16 in Annex C of ISO/IEC 10646-1:2000 does not allow the\n" "mapping of unpaired surrogates. For more information please refer to\n" "http://www.unicode.org/ and http://www.cl.cam.ac.uk/~mgk25/unicode.html\n" "\n" msgstr "" #. This console output should be limited to 78 characters per line. #. - The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. msgctxt "TEXT_INVALID_URI" msgid "" "URIs must be properly escaped, they must not contain unescaped\n" "characters below U+0021 including the space character and not\n" "above U+007E. Tidy escapes the URI for you as recommended by\n" "HTML 4.01 section B.2.1 and XML 1.0 section 4.2.2. Some user agents\n" "use another algorithm to escape such URIs and some server-sided\n" "scripts depend on that. If you want to depend on that, you must\n" "escape the URI on your own. For more information please refer to\n" "http://www.w3.org/International/O-URL-and-ident.html\n" "\n" msgstr "" #. This console output should be limited to 78 characters per line. msgctxt "TEXT_BAD_FORM" msgid "" "You may need to move one or both of the
and
\n" "tags. HTML elements should be properly nested and form elements\n" "are no exception. For instance you should not place the
\n" "in one table cell and the
in another. If the
is\n" "placed before a table, the
cannot be placed inside the\n" "table! Note that one form can't be nested inside another!\n" "\n" msgstr "" #. This console output should be limited to 78 characters per line. msgctxt "TEXT_BAD_MAIN" msgid "" "Only one
element is allowed in a document.\n" "Subsequent
elements have been discarded, which may\n" "render the document invalid.\n" msgstr "" #. This console output should be limited to 78 characters per line. msgctxt "TEXT_M_SUMMARY" msgid "" "The table summary attribute should be used to describe\n" "the table structure. It is very helpful for people using\n" "non-visual browsers. The scope and headers attributes for\n" "table cells are useful for specifying which headers apply\n" "to each table cell, enabling non-visual browsers to provide\n" "a meaningful context for each cell.\n" "\n" msgstr "" #. This console output should be limited to 78 characters per line. msgctxt "TEXT_M_IMAGE_ALT" msgid "" "The alt attribute should be used to give a short description\n" "of an image; longer descriptions should be given with the\n" "longdesc attribute which takes a URL linked to the description.\n" "These measures are needed for people using non-graphical browsers.\n" "\n" msgstr "" #. This console output should be limited to 78 characters per line. msgctxt "TEXT_M_IMAGE_MAP" msgid "" "Use client-side image maps in preference to server-side image\n" "maps as the latter are inaccessible to people using non-\n" "graphical browsers. In addition, client-side maps are easier\n" "to set up and provide immediate feedback to users.\n" "\n" msgstr "" #. This console output should be limited to 78 characters per line. msgctxt "TEXT_M_LINK_ALT" msgid "" "For hypertext links defined using a client-side image map, you\n" "need to use the alt attribute to provide a textual description\n" "of the link for people using non-graphical browsers.\n" "\n" msgstr "" #. This console output should be limited to 78 characters per line. msgctxt "TEXT_USING_FRAMES" msgid "" "Pages designed using frames present problems for\n" "people who are either blind or using a browser that\n" "doesn't support frames. A frames-based page should always\n" "include an alternative layout inside a NOFRAMES element.\n" "\n" msgstr "" #. This console output should be limited to 78 characters per line. msgctxt "TEXT_ACCESS_ADVICE1" msgid "" "For further advice on how to make your pages accessible\n" "see http://www.w3.org/WAI/GL" msgstr "" #. This console output should be limited to 78 characters per line. #. - The URL should not be translated unless you find a matching URL in your language. msgctxt "TEXT_ACCESS_ADVICE2" msgid " and http://www.html-tidy.org/accessibility/" msgstr "" #. This console output should be limited to 78 characters per line. msgctxt "TEXT_USING_LAYER" msgid "" "The Cascading Style Sheets (CSS) Positioning mechanism\n" "is recommended in preference to the proprietary \n" "element due to limited vendor support for LAYER.\n" "\n" msgstr "" #. This console output should be limited to 78 characters per line. msgctxt "TEXT_USING_SPACER" msgid "" "You are recommended to use CSS for controlling white\n" "space (e.g. for indentation, margins and line spacing).\n" "The proprietary element has limited vendor support.\n" "\n" msgstr "" #. This console output should be limited to 78 characters per line. msgctxt "TEXT_USING_FONT" msgid "" "You are recommended to use CSS to specify the font and\n" "properties such as its size and color. This will reduce\n" "the size of HTML files and make them easier to maintain\n" "compared with using elements.\n" "\n" msgstr "" "You are recommended to use CSS to specify the font and\n" "properties such as its size and colour. This will reduce\n" "the size of HTML files and make them easier to maintain\n" "compared with using elements.\n\n" #. This console output should be limited to 78 characters per line. msgctxt "TEXT_USING_NOBR" msgid "" "You are recommended to use CSS to control line wrapping.\n" "Use \"white-space: nowrap\" to inhibit wrapping in place\n" "of inserting
... into the markup.\n" "\n" msgstr "" #. This console output should be limited to 78 characters per line. msgctxt "TEXT_USING_BODY" msgid "You are recommended to use CSS to specify page and link colors\n" msgstr "You are recommended to use CSS to specify page and link colours\n" #. This console output should be limited to 78 characters per line. #. - The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. msgctxt "TEXT_NEEDS_INTERVENTION" msgid "" "This document has errors that must be fixed before\n" "using HTML Tidy to generate a tidied up version.\n" "\n" msgstr "" #. This console output should be limited to 78 characters per line. #. - The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. msgctxt "TEXT_GENERAL_INFO" msgid "" "About HTML Tidy: https://github.com/htacg/tidy-html5\n" "Bug reports and comments: https://github.com/htacg/tidy-html5/issues\n" "Official mailing list: https://lists.w3.org/Archives/Public/public-htacg/\n" "Latest HTML specification: http://dev.w3.org/html5/spec-author-view/\n" "Validate your HTML documents: http://validator.w3.org/nu/\n" "Lobby your company to join the W3C: http://www.w3.org/Consortium\n" msgstr "" #. This console output should be limited to 78 characters per line. #. - The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. msgctxt "TEXT_GENERAL_INFO_PLEA" msgid "" "\n" "Do you speak a language other than English, or a different variant of \n" "English? Consider helping us to localize HTML Tidy. For details please see \n" "https://github.com/htacg/tidy-html5/blob/master/README/LOCALIZE.md\n" msgstr "" "\n" "Would you like to see Tidy in proper, British English? Please consider \n" "helping us to localise HTML Tidy. For details please see \n" "https://github.com/htacg/tidy-html5/blob/master/README/LOCALIZE.md\n" msgctxt "TidyInfoString" msgid "Info: " msgstr "" msgctxt "TidyWarningString" msgid "Warning: " msgstr "" msgctxt "TidyConfigString" msgid "Config: " msgstr "" msgctxt "TidyAccessString" msgid "Access: " msgstr "" msgctxt "TidyErrorString" msgid "Error: " msgstr "" msgctxt "TidyBadDocumentString" msgid "Document: " msgstr "" msgctxt "TidyFatalString" msgid "Panic: " msgstr "" #, c-format msgctxt "ENCODING_MISMATCH" msgid "specified input encoding (%s) does not match actual input encoding (%s)" msgstr "" #, c-format msgctxt "VENDOR_SPECIFIC_CHARS" msgid "%s invalid character code %s" msgstr "" #, c-format msgctxt "INVALID_SGML_CHARS" msgid "%s invalid character code %s" msgstr "" #, c-format msgctxt "INVALID_UTF8" msgid "%s invalid UTF-8 bytes (char. code %s)" msgstr "" #, c-format msgctxt "INVALID_UTF16" msgid "%s invalid UTF-16 surrogate pair (char. code %s)" msgstr "" #, c-format msgctxt "INVALID_NCR" msgid "%s invalid numeric character reference %s" msgstr "" #, c-format msgctxt "MISSING_SEMICOLON" msgid "entity \"%s\" doesn't end in ';'" msgstr "" #, c-format msgctxt "MISSING_SEMICOLON_NCR" msgid "numeric character reference \"%s\" doesn't end in ';'" msgstr "" msgctxt "UNESCAPED_AMPERSAND" msgid "unescaped & which should be written as &" msgstr "" #, c-format msgctxt "UNKNOWN_ENTITY" msgid "unescaped & or unknown entity \"%s\"" msgstr "" msgctxt "APOS_UNDEFINED" msgid "named entity ' only defined in XML/XHTML" msgstr "" #, c-format msgctxt "INSERTING_ATTRIBUTE" msgid "%s inserting \"%s\" attribute" msgstr "" #, c-format msgctxt "INSERTING_AUTO_ATTRIBUTE" msgid "%s inserting \"%s\" attribute using value \"%s\"" msgstr "" #, c-format msgctxt "MISSING_ATTR_VALUE" msgid "%s attribute \"%s\" lacks value" msgstr "" #, c-format msgctxt "UNKNOWN_ATTRIBUTE" msgid "%s unknown attribute \"%s\"" msgstr "" #, c-format msgctxt "PROPRIETARY_ATTRIBUTE" msgid "%s proprietary attribute \"%s\"" msgstr "" #, c-format msgctxt "MISMATCHED_ATTRIBUTE_ERROR" msgid "%s attribute \"%s\" not allowed for %s" msgstr "" #, c-format msgctxt "MISMATCHED_ATTRIBUTE_WARN" msgid "%s attribute \"%s\" not allowed for %s" msgstr "" #, c-format msgctxt "JOINING_ATTRIBUTE" msgid "%s joining values of repeated attribute \"%s\"" msgstr "" #, c-format msgctxt "XML_ATTRIBUTE_VALUE" msgid "%s has XML attribute \"%s\"" msgstr "" #, c-format msgctxt "XML_ID_SYNTAX" msgid "%s ID \"%s\" uses XML ID syntax" msgstr "" #, c-format msgctxt "ATTR_VALUE_NOT_LCASE" msgid "%s attribute value \"%s\" must be lower case for XHTML" msgstr "" #, c-format msgctxt "PROPRIETARY_ATTR_VALUE" msgid "%s proprietary attribute value \"%s\"" msgstr "" #, c-format msgctxt "ANCHOR_NOT_UNIQUE" msgid "%s anchor \"%s\" already defined" msgstr "" #, c-format msgctxt "BAD_ATTRIBUTE_VALUE" msgid "%s attribute \"%s\" has invalid value \"%s\"" msgstr "" #, c-format msgctxt "BAD_ATTRIBUTE_VALUE_REPLACED" msgid "%s attribute \"%s\" had invalid value \"%s\" and has been replaced" msgstr "" #, c-format msgctxt "INVALID_ATTRIBUTE" msgid "%s attribute name \"%s\" (value=\"%s\") is invalid" msgstr "" #, c-format msgctxt "REPEATED_ATTRIBUTE" msgid "%s dropping value \"%s\" for repeated attribute \"%s\"" msgstr "" #, c-format msgctxt "INVALID_XML_ID" msgid "%s cannot copy name attribute to id" msgstr "" #, c-format msgctxt "UNEXPECTED_GT" msgid "%s missing '>' for end of tag" msgstr "" #, c-format msgctxt "UNEXPECTED_QUOTEMARK" msgid "%s unexpected or duplicate quote mark" msgstr "" #, c-format msgctxt "MISSING_QUOTEMARK" msgid "%s attribute with missing trailing quote mark" msgstr "" #, c-format msgctxt "UNEXPECTED_END_OF_FILE_ATTR" msgid "%s end of file while parsing attributes" msgstr "" #, c-format msgctxt "ID_NAME_MISMATCH" msgid "%s id and name attribute value mismatch" msgstr "" #, c-format msgctxt "BACKSLASH_IN_URI" msgid "%s URI reference contains backslash. Typo?" msgstr "" #, c-format msgctxt "FIXED_BACKSLASH" msgid "%s converting backslash in URI to slash" msgstr "" #, c-format msgctxt "ILLEGAL_URI_REFERENCE" msgid "%s improperly escaped URI reference" msgstr "" #, c-format msgctxt "ESCAPED_ILLEGAL_URI" msgid "%s escaping malformed URI reference" msgstr "" #, c-format msgctxt "NEWLINE_IN_URI" msgid "%s discarding newline in URI reference" msgstr "" #, c-format msgctxt "WHITE_IN_URI" msgid "%s discarding whitespace in URI reference" msgstr "" #, c-format msgctxt "UNEXPECTED_EQUALSIGN" msgid "%s unexpected '=', expected attribute name" msgstr "" #, c-format msgctxt "MISSING_IMAGEMAP" msgid "%s should use client-side image map" msgstr "" #, c-format msgctxt "MISSING_ATTRIBUTE" msgid "%s lacks \"%s\" attribute" msgstr "" #, c-format msgctxt "NESTED_EMPHASIS" msgid "nested emphasis %s" msgstr "" msgctxt "NESTED_QUOTATION" msgid "nested q elements, possible typo." msgstr "" #, c-format msgctxt "OBSOLETE_ELEMENT" msgid "replacing obsolete element %s with %s" msgstr "" #, c-format msgctxt "COERCE_TO_ENDTAG_WARN" msgid "<%s> is probably intended as " msgstr "" #, c-format msgctxt "REMOVED_HTML5" msgid "%s element removed from HTML5" msgstr "" #, c-format msgctxt "BAD_SUMMARY_HTML5" msgid "The summary attribute on the %s element is obsolete in HTML5" msgstr "" #, c-format msgctxt "TRIM_EMPTY_ELEMENT" msgid "trimming empty %s" msgstr "" #, c-format msgctxt "REPLACING_ELEMENT" msgid "replacing %s with %s" msgstr "" #, c-format msgctxt "COERCE_TO_ENDTAG" msgid "<%s> is probably intended as " msgstr "" #, c-format msgctxt "REPLACING_UNEX_ELEMENT" msgid "replacing unexpected %s with %s" msgstr "" #, c-format msgctxt "MISSING_ENDTAG_FOR" msgid "missing " msgstr "" #, c-format msgctxt "MISSING_ENDTAG_BEFORE" msgid "missing before %s" msgstr "" #, c-format msgctxt "DISCARDING_UNEXPECTED" msgid "discarding unexpected %s" msgstr "" #, c-format msgctxt "NON_MATCHING_ENDTAG" msgid "replacing unexpected %s with " msgstr "" #, c-format msgctxt "TAG_NOT_ALLOWED_IN" msgid "%s isn't allowed in <%s> elements" msgstr "" #, c-format msgctxt "MISSING_STARTTAG" msgid "missing <%s>" msgstr "" #, c-format msgctxt "UNEXPECTED_ENDTAG" msgid "unexpected " msgstr "" #, c-format msgctxt "TOO_MANY_ELEMENTS" msgid "too many %s elements" msgstr "" #, c-format msgctxt "USING_BR_INPLACE_OF" msgid "using
in place of %s" msgstr "" #, c-format msgctxt "INSERTING_TAG" msgid "inserting implicit <%s>" msgstr "" #, c-format msgctxt "CANT_BE_NESTED" msgid "%s can't be nested" msgstr "" #, c-format msgctxt "PROPRIETARY_ELEMENT" msgid "%s is not approved by W3C" msgstr "" #, c-format msgctxt "ELEMENT_VERS_MISMATCH_ERROR" msgid "%s element not available in %s" msgstr "" #, c-format msgctxt "ELEMENT_VERS_MISMATCH_WARN" msgid "%s element not available in %s" msgstr "" #, c-format msgctxt "ILLEGAL_NESTING" msgid "%s shouldn't be nested" msgstr "" #, c-format msgctxt "NOFRAMES_CONTENT" msgid "%s not inside 'noframes' element" msgstr "" #, c-format msgctxt "UNEXPECTED_END_OF_FILE" msgid "unexpected end of file %s" msgstr "" #, c-format msgctxt "ELEMENT_NOT_EMPTY" msgid "%s element not empty or not closed" msgstr "" #, c-format msgctxt "UNEXPECTED_ENDTAG_IN" msgid "unexpected in <%s>" msgstr "" #, c-format msgctxt "TOO_MANY_ELEMENTS_IN" msgid "too many %s elements in <%s>" msgstr "" #, c-format msgctxt "UNESCAPED_ELEMENT" msgid "unescaped %s in pre content" msgstr "" msgctxt "DOCTYPE_AFTER_TAGS" msgid " isn't allowed after elements" msgstr "" msgctxt "MISSING_TITLE_ELEMENT" msgid "inserting missing 'title' element" msgstr "" msgctxt "INCONSISTENT_VERSION" msgid "HTML DOCTYPE doesn't match content" msgstr "" msgctxt "MISSING_DOCTYPE" msgid "missing declaration" msgstr "" msgctxt "CONTENT_AFTER_BODY" msgid "content occurs after end of body" msgstr "" msgctxt "MALFORMED_COMMENT" msgid "adjacent hyphens within comment" msgstr "" msgctxt "BAD_COMMENT_CHARS" msgid "expecting -- or >" msgstr "" msgctxt "BAD_CDATA_CONTENT" msgid "'<' + '/' + letter not allowed here" msgstr "" msgctxt "INCONSISTENT_NAMESPACE" msgid "HTML namespace doesn't match content" msgstr "" msgctxt "SPACE_PRECEDING_XMLDECL" msgid "removing whitespace preceding XML Declaration" msgstr "" msgctxt "MALFORMED_DOCTYPE" msgid "discarding malformed " msgstr "" msgctxt "BAD_XML_COMMENT" msgid "XML comments can't contain --" msgstr "" msgctxt "DTYPE_NOT_UPPER_CASE" msgid "SYSTEM, PUBLIC, W3C, DTD, EN must be upper case" msgstr "" msgctxt "ENCODING_IO_CONFLICT" msgid "Output encoding does not work with standard output" msgstr "" msgctxt "SUSPECTED_MISSING_QUOTE" msgid "missing quote mark for attribute value" msgstr "" msgctxt "DUPLICATE_FRAMESET" msgid "repeated FRAMESET element" msgstr "" #, c-format msgctxt "UNKNOWN_ELEMENT" msgid "%s is not recognized!" msgstr "" #, c-format msgctxt "PREVIOUS_LOCATION" msgid "<%s> previously mentioned" msgstr "" msgctxt "IMG_MISSING_ALT" msgid "[1.1.1.1]: missing 'alt' text." msgstr "" msgctxt "IMG_ALT_SUSPICIOUS_FILENAME" msgid "[1.1.1.2]: suspicious 'alt' text (filename)." msgstr "" msgctxt "IMG_ALT_SUSPICIOUS_FILE_SIZE" msgid "[1.1.1.3]: suspicious 'alt' text (file size)." msgstr "" msgctxt "IMG_ALT_SUSPICIOUS_PLACEHOLDER" msgid "[1.1.1.4]: suspicious 'alt' text (placeholder)." msgstr "" msgctxt "IMG_ALT_SUSPICIOUS_TOO_LONG" msgid "[1.1.1.10]: suspicious 'alt' text (too long)." msgstr "" msgctxt "IMG_MISSING_LONGDESC_DLINK" msgid "[1.1.2.1]: missing 'longdesc' and d-link." msgstr "" msgctxt "IMG_MISSING_DLINK" msgid "[1.1.2.2]: missing d-link." msgstr "" msgctxt "IMG_MISSING_LONGDESC" msgid "[1.1.2.3]: missing 'longdesc'." msgstr "" msgctxt "IMG_BUTTON_MISSING_ALT" msgid "[1.1.3.1]: (button) missing 'alt' text." msgstr "" msgctxt "APPLET_MISSING_ALT" msgid "[1.1.4.1]: missing alternate content." msgstr "" msgctxt "OBJECT_MISSING_ALT" msgid "[1.1.5.1]: missing alternate content." msgstr "" msgctxt "AUDIO_MISSING_TEXT_WAV" msgid "[1.1.6.1]: audio missing text transcript (wav)." msgstr "" msgctxt "AUDIO_MISSING_TEXT_AU" msgid "[1.1.6.2]: audio missing text transcript (au)." msgstr "" msgctxt "AUDIO_MISSING_TEXT_AIFF" msgid "[1.1.6.3]: audio missing text transcript (aiff)." msgstr "" msgctxt "AUDIO_MISSING_TEXT_SND" msgid "[1.1.6.4]: audio missing text transcript (snd)." msgstr "" msgctxt "AUDIO_MISSING_TEXT_RA" msgid "[1.1.6.5]: audio missing text transcript (ra)." msgstr "" msgctxt "AUDIO_MISSING_TEXT_RM" msgid "[1.1.6.6]: audio missing text transcript (rm)." msgstr "" msgctxt "FRAME_MISSING_LONGDESC" msgid "[1.1.8.1]: may require 'longdesc'." msgstr "" msgctxt "AREA_MISSING_ALT" msgid "[1.1.9.1]: missing 'alt' text." msgstr "" msgctxt "SCRIPT_MISSING_NOSCRIPT" msgid "[1.1.10.1]: