Merge branch 'unix_features' into next
This commit is contained in:
commit
77632e2fb8
319
CMakeLists.txt
319
CMakeLists.txt
|
@ -1,5 +1,22 @@
|
||||||
# CMakeLists.txt - 20150402 - 20150130 - 20140801 - for github htacg/tidy-html5
|
##############################################################################
|
||||||
# Prepare for changing the name to 'tidy'
|
# @file CMakeLists.txt
|
||||||
|
# Build executables, static and dylibs, packages, build systems, etc., for
|
||||||
|
# HTML Tidy.
|
||||||
|
#
|
||||||
|
# Read this file or use cmake-gui (Windows) or ccmake (everything else) for
|
||||||
|
# guided build.
|
||||||
|
#
|
||||||
|
# @author Geoff McLane [ubuntu@geoffair.info]
|
||||||
|
# @author HTACG, et al (consult git log)
|
||||||
|
#
|
||||||
|
# @copyright
|
||||||
|
# Copyright (c) 1998-2017 HTACG
|
||||||
|
# @copyright
|
||||||
|
# See tidy.h for license.
|
||||||
|
#
|
||||||
|
# @date Consult git log.
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
cmake_minimum_required (VERSION 2.8.7)
|
cmake_minimum_required (VERSION 2.8.7)
|
||||||
|
|
||||||
set(LIB_NAME tidy)
|
set(LIB_NAME tidy)
|
||||||
|
@ -8,18 +25,30 @@ set(LIBTIDY_URL "http://www.html-tidy.org")
|
||||||
|
|
||||||
project (${LIB_NAME})
|
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
|
# Setup
|
||||||
# NOTE: Both version and date MUST be DOT separated, in two lines.
|
#################################################
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
# Release Information
|
||||||
|
# Release version and date are found in `version.txt`; update *that*
|
||||||
|
# file when required. It will be read into variable `versionFile`
|
||||||
|
# (stripping any newlines or spaces). This file must be formatted into
|
||||||
|
# two lines: the dot-separated MAJOR.MINOR.POINT version, followed by
|
||||||
|
# the date separated YEAR.MONTH.DAY release date.
|
||||||
|
#------------------------------------------------------------------------
|
||||||
file(READ version.txt versionFile)
|
file(READ version.txt versionFile)
|
||||||
|
|
||||||
if (NOT versionFile)
|
if (NOT versionFile)
|
||||||
message(FATAL_ERROR "Unable to determine libtidy version. version.txt file is missing.")
|
message(FATAL_ERROR "Unable to determine libtidy version. version.txt file is missing.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
string(STRIP "${versionFile}" VERSION_TEXT)
|
string(STRIP "${versionFile}" VERSION_TEXT)
|
||||||
string(REGEX REPLACE "(.*)[\r\n|\n](.*)" "\\1" LIBTIDY_VERSION ${VERSION_TEXT})
|
string(REGEX REPLACE "(.*)[\r\n|\n](.*)" "\\1" LIBTIDY_VERSION ${VERSION_TEXT})
|
||||||
string(REGEX REPLACE "(.*)[\r\n|\n](.*)" "\\2" LIBTIDY_DATE ${VERSION_TEXT})
|
string(REGEX REPLACE "(.*)[\r\n|\n](.*)" "\\2" LIBTIDY_DATE ${VERSION_TEXT})
|
||||||
# establish version number
|
|
||||||
|
# Establish version number
|
||||||
if (LIBTIDY_VERSION)
|
if (LIBTIDY_VERSION)
|
||||||
string(REPLACE "." ";" VERSION_LIST ${LIBTIDY_VERSION})
|
string(REPLACE "." ";" VERSION_LIST ${LIBTIDY_VERSION})
|
||||||
list(GET VERSION_LIST 0 TIDY_MAJOR_VERSION)
|
list(GET VERSION_LIST 0 TIDY_MAJOR_VERSION)
|
||||||
|
@ -28,7 +57,8 @@ if (LIBTIDY_VERSION)
|
||||||
else ()
|
else ()
|
||||||
message(FATAL_ERROR "*** FAILED to get a VERSION from version.txt!")
|
message(FATAL_ERROR "*** FAILED to get a VERSION from version.txt!")
|
||||||
endif ()
|
endif ()
|
||||||
# establish version date
|
|
||||||
|
# Establish version date
|
||||||
if (LIBTIDY_DATE)
|
if (LIBTIDY_DATE)
|
||||||
string(REPLACE "." ";" DATE_LIST ${LIBTIDY_DATE})
|
string(REPLACE "." ";" DATE_LIST ${LIBTIDY_DATE})
|
||||||
list(GET DATE_LIST 0 tidy_YEAR)
|
list(GET DATE_LIST 0 tidy_YEAR)
|
||||||
|
@ -38,61 +68,106 @@ else ()
|
||||||
message(FATAL_ERROR "*** FAILED to get a DATE from version.txt!")
|
message(FATAL_ERROR "*** FAILED to get a DATE from version.txt!")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# By default, BOTH library types built, Allow turning OFF shared if not needed
|
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
# Library Types and Linking
|
||||||
|
# By default, *both* static and dynamic library types are built. The
|
||||||
|
# shared library can be turned off if not needed. The console program
|
||||||
|
# can be configured for static linking or dynamic linking.
|
||||||
|
#------------------------------------------------------------------------
|
||||||
set( LIB_TYPE STATIC ) # set default message
|
set( LIB_TYPE STATIC ) # set default message
|
||||||
|
|
||||||
option( BUILD_SHARED_LIB "Set OFF to NOT build shared library" ON )
|
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
|
# Issue #326 - Allow linkage choice of console app tidy
|
||||||
option( TIDY_CONSOLE_SHARED "Set ON to link with shared(DLL) lib." OFF )
|
option( TIDY_CONSOLE_SHARED "Set ON to link with shared(DLL) lib." OFF )
|
||||||
|
|
||||||
if (TIDY_CONSOLE_SHARED)
|
if (TIDY_CONSOLE_SHARED)
|
||||||
if (NOT BUILD_SHARED_LIB)
|
if (NOT BUILD_SHARED_LIB)
|
||||||
message(FATAL_ERROR "Enable shared build for this tidy linkage!")
|
message(FATAL_ERROR "Enable shared build for this tidy linkage!")
|
||||||
endif ()
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# Allow building without extra language support
|
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
# Miscellaneous Options
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
option( BUILD_TAB2SPACE "Set ON to build utility app, tab2space" OFF )
|
||||||
|
option( BUILD_SAMPLE_CODE "Set ON to build the sample code" OFF )
|
||||||
|
option( TIDY_COMPAT_HEADERS "Set ON to include compatibility headers" OFF )
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
# Man Page
|
||||||
|
# Allow building with non-default man page directory.
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
if (NOT MAN_INSTALL_DIR)
|
||||||
|
set(MAN_INSTALL_DIR share/man/man1)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
# Localization
|
||||||
|
# Allow building without extra language support.
|
||||||
|
#------------------------------------------------------------------------
|
||||||
option( SUPPORT_LOCALIZATIONS "Set OFF to build without additional languages." ON )
|
option( SUPPORT_LOCALIZATIONS "Set OFF to build without additional languages." ON )
|
||||||
|
|
||||||
if (SUPPORT_LOCALIZATIONS)
|
if (SUPPORT_LOCALIZATIONS)
|
||||||
add_definitions ( -DSUPPORT_LOCALIZATIONS=1 )
|
add_definitions ( -DSUPPORT_LOCALIZATIONS=1 )
|
||||||
else ()
|
else ()
|
||||||
add_definitions ( -DSUPPORT_LOCALIZATIONS=0 )
|
add_definitions ( -DSUPPORT_LOCALIZATIONS=0 )
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# Allow building without console support, which mostly prevents console strings
|
|
||||||
# from existing in the library. Note that this will prevent the console
|
#------------------------------------------------------------------------
|
||||||
# application from being built, since it can't be linked.
|
# Console Application
|
||||||
option( SUPPORT_CONSOLE_APP "Set OFF to libraries only without console application support." ON )
|
# Allow building without console support, which mostly prevents
|
||||||
|
# console strings from existing in the library. Note that this will
|
||||||
|
# prevent the console application from being built, since it can't be
|
||||||
|
# linked.
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
option( SUPPORT_CONSOLE_APP "Set OFF to build libraries only without console application support." ON )
|
||||||
|
|
||||||
if (SUPPORT_CONSOLE_APP)
|
if (SUPPORT_CONSOLE_APP)
|
||||||
add_definitions ( -DSUPPORT_CONSOLE_APP=1 )
|
add_definitions ( -DSUPPORT_CONSOLE_APP=1 )
|
||||||
else ()
|
else ()
|
||||||
add_definitions ( -DSUPPORT_CONSOLE_APP=0 )
|
add_definitions ( -DSUPPORT_CONSOLE_APP=0 )
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# Enable building with some memory diagnostics
|
|
||||||
# NOTE: Only available in the Debug configuration build in Windows
|
#------------------------------------------------------------------------
|
||||||
# but could be maybe extended to unix, mac...
|
# Memory Diagnostics
|
||||||
|
# Enable building with some memory diagnostics.
|
||||||
|
#
|
||||||
|
# NOTE: Currently only available in the Debug configuration build in
|
||||||
|
# Windows, but could be maybe extended to Unix, others...
|
||||||
|
#------------------------------------------------------------------------
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
option( ENABLE_MEMORY_DEBUG "Set ON to output some memory diagnostics." OFF )
|
option( ENABLE_MEMORY_DEBUG "Set ON to output some memory diagnostics." OFF )
|
||||||
option( ENABLE_ALLOC_DEBUG "Set ON to output node allocation diagnostics." OFF )
|
option( ENABLE_ALLOC_DEBUG "Set ON to output node allocation diagnostics." OFF )
|
||||||
option( ENABLE_CRTDBG_MEMORY "Set ON to enable the Windows CRT debug library." OFF )
|
option( ENABLE_CRTDBG_MEMORY "Set ON to enable the Windows CRT debug library." OFF )
|
||||||
|
|
||||||
if (ENABLE_MEMORY_DEBUG)
|
if (ENABLE_MEMORY_DEBUG)
|
||||||
add_definitions ( -DDEBUG_MEMORY ) # see alloc.c for details
|
add_definitions ( -DDEBUG_MEMORY ) # see alloc.c for details
|
||||||
message(STATUS "*** Note, alloc.c memory diagnostics are ON")
|
message(STATUS "*** Note, alloc.c memory diagnostics are ON")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (ENABLE_ALLOC_DEBUG)
|
if (ENABLE_ALLOC_DEBUG)
|
||||||
add_definitions ( -DDEBUG_ALLOCATION ) # see lexer.c for details
|
add_definitions ( -DDEBUG_ALLOCATION ) # see lexer.c for details
|
||||||
message(STATUS "*** Note, lexer.c node allocation diagnostics are ON")
|
message(STATUS "*** Note, lexer.c node allocation diagnostics are ON")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (ENABLE_CRTDBG_MEMORY)
|
if (ENABLE_CRTDBG_MEMORY)
|
||||||
add_definitions ( -D_CRTDBG_MAP_ALLOC ) # see tidy.c for details
|
add_definitions ( -D_CRTDBG_MAP_ALLOC ) # see tidy.c for details
|
||||||
message(STATUS "*** Note, tidy.c Windows CRT memory debug is ON")
|
message(STATUS "*** Note, tidy.c Windows CRT memory debug is ON")
|
||||||
endif ()
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
# Complier Flags
|
||||||
|
# Setup other compiler-specific and platform-specific compiler flags.
|
||||||
|
#------------------------------------------------------------------------
|
||||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
set( WARNING_FLAGS -Wall )
|
set( WARNING_FLAGS -Wall )
|
||||||
endif(CMAKE_COMPILER_IS_GNUCXX)
|
endif(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
|
@ -102,20 +177,16 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WIN32 AND MSVC)
|
if(WIN32 AND MSVC)
|
||||||
# turn off various warnings
|
# C4996: The compiler encountered a deprecated declaration.
|
||||||
set(WARNING_FLAGS "${WARNING_FLAGS} /wd4996")
|
|
||||||
# C4090: 'function' : different 'const' qualifiers
|
# C4090: 'function' : different 'const' qualifiers
|
||||||
# C4244: '=' : conversion from '__int64' to 'uint', possible loss of data
|
# C4244: '=' : conversion from '__int64' to 'uint', possible loss of data
|
||||||
# C4267: 'function' : conversion from 'size_t' 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 4996 4090 4244 4267)
|
||||||
foreach(warning 4090 4244 4267)
|
|
||||||
set(WARNING_FLAGS "${WARNING_FLAGS} /wd${warning}")
|
set(WARNING_FLAGS "${WARNING_FLAGS} /wd${warning}")
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
set( MSVC_FLAGS "-DNOMINMAX -D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS -D__CRT_NONSTDC_NO_WARNINGS" )
|
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
|
# to distinguish between debug and release lib in windows
|
||||||
set( CMAKE_DEBUG_POSTFIX "d" ) # little effect in unix
|
set( CMAKE_DEBUG_POSTFIX "d" ) # little effect in unix
|
||||||
else()
|
else()
|
||||||
|
@ -126,7 +197,12 @@ 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_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS} ${MSVC_FLAGS} -D_REENTRANT" )
|
||||||
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${MSVC_LD_FLAGS}" )
|
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${MSVC_LD_FLAGS}" )
|
||||||
|
|
||||||
# option to use static windows runtime - maybe only applies to WIN32/MSVC
|
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
# Static Windows Runtime
|
||||||
|
# Option to statically link to the Windows runtime. Maybe only
|
||||||
|
# applies to WIN32/MSVC.
|
||||||
|
#------------------------------------------------------------------------
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
option( USE_STATIC_RUNTIME "Set ON to change /MD(DLL) to /MT(static)" OFF )
|
option( USE_STATIC_RUNTIME "Set ON to change /MD(DLL) to /MT(static)" OFF )
|
||||||
if (USE_STATIC_RUNTIME)
|
if (USE_STATIC_RUNTIME)
|
||||||
|
@ -147,53 +223,78 @@ if (MSVC)
|
||||||
endif ()
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
add_definitions ( -DHAVE_CONFIG_H )
|
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
# Macro Values
|
||||||
|
# These additional macros are set in Tidy's source code.
|
||||||
|
#------------------------------------------------------------------------
|
||||||
add_definitions ( -DSUPPORT_UTF16_ENCODINGS=1 )
|
add_definitions ( -DSUPPORT_UTF16_ENCODINGS=1 )
|
||||||
add_definitions ( -DSUPPORT_ASIAN_ENCODINGS=1 )
|
add_definitions ( -DSUPPORT_ASIAN_ENCODINGS=1 )
|
||||||
add_definitions ( -DSUPPORT_ACCESSIBILITY_CHECKS=1 )
|
add_definitions ( -DSUPPORT_ACCESSIBILITY_CHECKS=1 )
|
||||||
add_definitions ( -DLIBTIDY_VERSION="${LIBTIDY_VERSION}" )
|
add_definitions ( -DLIBTIDY_VERSION="${LIBTIDY_VERSION}" )
|
||||||
add_definitions ( -DRELEASE_DATE="${tidy_YEAR}/${tidy_MONTH}/${tidy_DAY}" )
|
add_definitions ( -DRELEASE_DATE="${tidy_YEAR}/${tidy_MONTH}/${tidy_DAY}" )
|
||||||
|
|
||||||
|
# Optionally specify an extra version point for pre-release/debug versions.
|
||||||
if (TIDY_RC_NUMBER)
|
if (TIDY_RC_NUMBER)
|
||||||
add_definitions ( -DRC_NUMBER="${TIDY_RC_NUMBER}" )
|
add_definitions ( -DRC_NUMBER="${TIDY_RC_NUMBER}" )
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
# Delete me? Not used in Tidy source!
|
||||||
|
add_definitions ( -DHAVE_CONFIG_H )
|
||||||
|
|
||||||
#=============================================================================
|
|
||||||
# Unix console application features
|
#------------------------------------------------------------------------
|
||||||
|
# Runtime Configuration File Support
|
||||||
# By default on Unix-like systems when building for the console program,
|
# By default on Unix-like systems when building for the console program,
|
||||||
# support runtime configuration files in /etc/ and in ~/. To prevent this,
|
# support runtime configuration files in /etc/ and in ~/. To prevent this,
|
||||||
# set ENABLE_CONFIG_FILES to NO. Specify -DTIDY_CONFIG_FILE and/or
|
# set ENABLE_CONFIG_FILES to NO. Specify -DTIDY_CONFIG_FILE and/or
|
||||||
# -DTIDY_USER_CONFIG_FILE to override the default paths in tidyplatform.h.
|
# -DTIDY_USER_CONFIG_FILE to override the default paths in tidyplatform.h.
|
||||||
# @note: this section refactored to support #584.
|
# @note: this section refactored to support #584.
|
||||||
#=============================================================================
|
#------------------------------------------------------------------------
|
||||||
if (UNIX AND SUPPORT_CONSOLE_APP)
|
if ( UNIX AND SUPPORT_CONSOLE_APP )
|
||||||
|
|
||||||
option ( ENABLE_CONFIG_FILES "Set to OFF to disable Tidy runtime configuration file support" ON )
|
option ( ENABLE_CONFIG_FILES "Set to OFF to disable Tidy runtime configuration file support" ON )
|
||||||
|
|
||||||
if ( ENABLE_CONFIG_FILES )
|
# All Unixes support getpwnam(); undef'd in tidyplatform.h if necessary.
|
||||||
|
add_definitions( -DSUPPORT_GETPWNAM=1 )
|
||||||
|
|
||||||
|
else ()
|
||||||
|
|
||||||
|
option ( ENABLE_CONFIG_FILES "Set to ON to enable Tidy runtime configuration file support" OFF )
|
||||||
|
|
||||||
|
if ( SUPPORT_GETPWNAM )
|
||||||
|
add_definitions( -DSUPPORT_GETPWNAM=1 )
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if ( ENABLE_CONFIG_FILES )
|
||||||
|
|
||||||
message(STATUS "*** Building support for runtime configuration files.")
|
message(STATUS "*** Building support for runtime configuration files.")
|
||||||
|
|
||||||
add_definitions( -DTIDY_ENABLE_CONFIG_FILES )
|
add_definitions( -DTIDY_ENABLE_CONFIG_FILES )
|
||||||
|
|
||||||
# For example, /etc/tidy.conf
|
# define a default here so we can pass to XSL.
|
||||||
if (TIDY_CONFIG_FILE)
|
if ( NOT TIDY_CONFIG_FILE )
|
||||||
|
set( TIDY_CONFIG_FILE "/etc/tidy.conf" )
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# define a default here so we can pass to XSL.
|
||||||
|
if ( NOT TIDY_USER_CONFIG_FILE )
|
||||||
|
set( TIDY_USER_CONFIG_FILE "~/.tidyrc" )
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# do *not* add these unless ENABLE_CONFIG_FILES!
|
||||||
add_definitions( -DTIDY_CONFIG_FILE="${TIDY_CONFIG_FILE}" )
|
add_definitions( -DTIDY_CONFIG_FILE="${TIDY_CONFIG_FILE}" )
|
||||||
endif ()
|
|
||||||
|
|
||||||
# For example, ~/.tidy.rc
|
|
||||||
if (TIDY_USER_CONFIG_FILE)
|
|
||||||
add_definitions( -DTIDY_USER_CONFIG_FILE="${TIDY_USER_CONFIG_FILE}" )
|
add_definitions( -DTIDY_USER_CONFIG_FILE="${TIDY_USER_CONFIG_FILE}" )
|
||||||
endif ()
|
|
||||||
|
|
||||||
# All Unixes support getpwnam(); undef'd in tidyplatform.h if necessary.
|
|
||||||
add_definitions( -DSUPPORT_GETPWNAM=1 )
|
|
||||||
|
|
||||||
endif ()
|
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
# Shared Library
|
||||||
|
# Setup whether or not we will build the shared library.
|
||||||
|
#------------------------------------------------------------------------
|
||||||
if(BUILD_SHARED_LIB)
|
if(BUILD_SHARED_LIB)
|
||||||
set(LIB_TYPE SHARED)
|
set(LIB_TYPE SHARED)
|
||||||
message(STATUS "*** Also building DLL library ${LIB_TYPE}, version ${LIBTIDY_VERSION}, date ${LIBTIDY_DATE}")
|
message(STATUS "*** Also building DLL library ${LIB_TYPE}, version ${LIBTIDY_VERSION}, date ${LIBTIDY_DATE}")
|
||||||
|
@ -201,14 +302,20 @@ else()
|
||||||
message(STATUS "*** Only building static library ${LIB_TYPE}, version ${LIBTIDY_VERSION}, date ${LIBTIDY_DATE}")
|
message(STATUS "*** Only building static library ${LIB_TYPE}, version ${LIBTIDY_VERSION}, date ${LIBTIDY_DATE}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
#################################################
|
||||||
|
# Build
|
||||||
|
#################################################
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
# File Locations and File Lists
|
||||||
|
# Setup whether or not we will build the shared library.
|
||||||
|
#------------------------------------------------------------------------
|
||||||
include_directories ( "${PROJECT_SOURCE_DIR}/include" "${PROJECT_SOURCE_DIR}/src" )
|
include_directories ( "${PROJECT_SOURCE_DIR}/include" "${PROJECT_SOURCE_DIR}/src" )
|
||||||
|
|
||||||
##############################################################################
|
|
||||||
### tidy library
|
|
||||||
# file locations
|
|
||||||
set ( SRCDIR src )
|
set ( SRCDIR src )
|
||||||
set ( INCDIR include )
|
set ( INCDIR include )
|
||||||
# file lists
|
|
||||||
set ( CFILES
|
set ( CFILES
|
||||||
${SRCDIR}/access.c ${SRCDIR}/attrs.c ${SRCDIR}/istack.c
|
${SRCDIR}/access.c ${SRCDIR}/attrs.c ${SRCDIR}/istack.c
|
||||||
${SRCDIR}/parser.c ${SRCDIR}/tags.c ${SRCDIR}/entities.c
|
${SRCDIR}/parser.c ${SRCDIR}/tags.c ${SRCDIR}/entities.c
|
||||||
|
@ -219,11 +326,11 @@ set ( CFILES
|
||||||
${SRCDIR}/tagask.c ${SRCDIR}/tmbstr.c ${SRCDIR}/utf8.c
|
${SRCDIR}/tagask.c ${SRCDIR}/tmbstr.c ${SRCDIR}/utf8.c
|
||||||
${SRCDIR}/tidylib.c ${SRCDIR}/mappedio.c ${SRCDIR}/gdoc.c
|
${SRCDIR}/tidylib.c ${SRCDIR}/mappedio.c ${SRCDIR}/gdoc.c
|
||||||
${SRCDIR}/language.c ${SRCDIR}/messageobj.c )
|
${SRCDIR}/language.c ${SRCDIR}/messageobj.c )
|
||||||
|
|
||||||
set ( HFILES
|
set ( HFILES
|
||||||
${INCDIR}/tidyplatform.h ${INCDIR}/tidy.h ${INCDIR}/tidyenum.h
|
${INCDIR}/tidyplatform.h ${INCDIR}/tidy.h ${INCDIR}/tidyenum.h
|
||||||
${INCDIR}/tidybuffio.h )
|
${INCDIR}/tidybuffio.h )
|
||||||
|
|
||||||
option (TIDY_COMPAT_HEADERS "If set to ON, compatability headers are included" OFF)
|
|
||||||
if (TIDY_COMPAT_HEADERS)
|
if (TIDY_COMPAT_HEADERS)
|
||||||
set ( HFILES ${HFILES} ${INCDIR}/buffio.h ${INCDIR}/platform.h )
|
set ( HFILES ${HFILES} ${INCDIR}/buffio.h ${INCDIR}/platform.h )
|
||||||
endif ()
|
endif ()
|
||||||
|
@ -237,12 +344,16 @@ set ( LIBHFILES
|
||||||
${SRCDIR}/tmbstr.h ${SRCDIR}/utf8.h ${SRCDIR}/tidy-int.h
|
${SRCDIR}/tmbstr.h ${SRCDIR}/utf8.h ${SRCDIR}/tidy-int.h
|
||||||
${SRCDIR}/version.h ${SRCDIR}/gdoc.h ${SRCDIR}/language.h
|
${SRCDIR}/version.h ${SRCDIR}/gdoc.h ${SRCDIR}/language.h
|
||||||
${SRCDIR}/language_en.h ${SRCDIR}/win32tc.h )
|
${SRCDIR}/language_en.h ${SRCDIR}/win32tc.h )
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
list(APPEND CFILES ${SRCDIR}/sprtf.c)
|
list(APPEND CFILES ${SRCDIR}/sprtf.c)
|
||||||
list(APPEND LIBHFILES ${SRCDIR}/sprtf.h)
|
list(APPEND LIBHFILES ${SRCDIR}/sprtf.h)
|
||||||
endif ()
|
endif ()
|
||||||
#######################################
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
# Target Locations
|
||||||
|
#------------------------------------------------------------------------
|
||||||
if (NOT LIB_INSTALL_DIR)
|
if (NOT LIB_INSTALL_DIR)
|
||||||
set(LIB_INSTALL_DIR lib${LIB_SUFFIX})
|
set(LIB_INSTALL_DIR lib${LIB_SUFFIX})
|
||||||
endif ()
|
endif ()
|
||||||
|
@ -255,12 +366,15 @@ if (NOT INCLUDE_INSTALL_DIR)
|
||||||
set(INCLUDE_INSTALL_DIR include/${LIB_NAME})
|
set(INCLUDE_INSTALL_DIR include/${LIB_NAME})
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# Always build the STATIC library
|
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
# Static Library
|
||||||
|
# The static library always builds.
|
||||||
|
#------------------------------------------------------------------------
|
||||||
set(name tidy-static)
|
set(name tidy-static)
|
||||||
add_library ( ${name} STATIC ${CFILES} ${HFILES} ${LIBHFILES} )
|
add_library ( ${name} STATIC ${CFILES} ${HFILES} ${LIBHFILES} )
|
||||||
set_target_properties( ${name} PROPERTIES
|
set_target_properties( ${name} PROPERTIES
|
||||||
OUTPUT_NAME ${LIB_NAME}s
|
OUTPUT_NAME ${LIB_NAME}s )
|
||||||
)
|
|
||||||
if (NOT TIDY_CONSOLE_SHARED) # user wants default static linkage
|
if (NOT TIDY_CONSOLE_SHARED) # user wants default static linkage
|
||||||
list ( APPEND add_LIBS ${name} )
|
list ( APPEND add_LIBS ${name} )
|
||||||
endif ()
|
endif ()
|
||||||
|
@ -270,8 +384,12 @@ install(TARGETS ${name}
|
||||||
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
|
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
|
||||||
)
|
)
|
||||||
install( FILES ${HFILES} DESTINATION ${INCLUDE_INSTALL_DIR} )
|
install( FILES ${HFILES} DESTINATION ${INCLUDE_INSTALL_DIR} )
|
||||||
########################################
|
|
||||||
# if user option still on
|
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
# Dynamic Library
|
||||||
|
# If the user option is still on.
|
||||||
|
#------------------------------------------------------------------------
|
||||||
if (BUILD_SHARED_LIB)
|
if (BUILD_SHARED_LIB)
|
||||||
set(name tidy-share)
|
set(name tidy-share)
|
||||||
add_library ( ${name} SHARED ${CFILES} ${HFILES} ${LIBHFILES} )
|
add_library ( ${name} SHARED ${CFILES} ${HFILES} ${LIBHFILES} )
|
||||||
|
@ -294,8 +412,12 @@ if (BUILD_SHARED_LIB)
|
||||||
endif ()
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
##########################################################
|
|
||||||
### main executable - linked with STATIC/SHARED library
|
#------------------------------------------------------------------------
|
||||||
|
# Main Executable
|
||||||
|
# The main executable will be linked with either the static or the
|
||||||
|
# shared library.
|
||||||
|
#------------------------------------------------------------------------
|
||||||
if (SUPPORT_CONSOLE_APP)
|
if (SUPPORT_CONSOLE_APP)
|
||||||
set(name ${LIB_NAME})
|
set(name ${LIB_NAME})
|
||||||
set ( BINDIR console )
|
set ( BINDIR console )
|
||||||
|
@ -311,6 +433,10 @@ if (SUPPORT_CONSOLE_APP)
|
||||||
install (TARGETS ${name} DESTINATION bin)
|
install (TARGETS ${name} DESTINATION bin)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
# Miscellaneous Targets
|
||||||
|
#------------------------------------------------------------------------
|
||||||
if (BUILD_TAB2SPACE)
|
if (BUILD_TAB2SPACE)
|
||||||
set(name tab2space)
|
set(name tab2space)
|
||||||
add_executable( ${name} ${BINDIR}/tab2space.c )
|
add_executable( ${name} ${BINDIR}/tab2space.c )
|
||||||
|
@ -331,9 +457,11 @@ if (BUILD_SAMPLE_CODE)
|
||||||
# no INSTALL of this 'local' sample
|
# no INSTALL of this 'local' sample
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
#==========================================================
|
|
||||||
|
#################################################
|
||||||
# Create man pages
|
# Create man pages
|
||||||
#==========================================================
|
#################################################
|
||||||
|
|
||||||
if (UNIX AND SUPPORT_CONSOLE_APP)
|
if (UNIX AND SUPPORT_CONSOLE_APP)
|
||||||
find_program( XSLTPROC_FOUND xsltproc )
|
find_program( XSLTPROC_FOUND xsltproc )
|
||||||
if (XSLTPROC_FOUND)
|
if (XSLTPROC_FOUND)
|
||||||
|
@ -345,12 +473,14 @@ if (UNIX AND SUPPORT_CONSOLE_APP)
|
||||||
set(TIDYHELP ${CMAKE_CURRENT_BINARY_DIR}/tidy-help.xml)
|
set(TIDYHELP ${CMAKE_CURRENT_BINARY_DIR}/tidy-help.xml)
|
||||||
set(TIDYCONFIG ${CMAKE_CURRENT_BINARY_DIR}/tidy-config.xml)
|
set(TIDYCONFIG ${CMAKE_CURRENT_BINARY_DIR}/tidy-config.xml)
|
||||||
add_custom_target(man ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${LIB_NAME}")
|
add_custom_target(man ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${LIB_NAME}")
|
||||||
|
|
||||||
|
## Populate the @VARIABLES@ in the input file.
|
||||||
configure_file(
|
configure_file(
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/man/tidy1.xsl.in
|
${CMAKE_CURRENT_SOURCE_DIR}/man/tidy1.xsl.in
|
||||||
${TIDY1XSL}
|
${TIDY1XSL}
|
||||||
)
|
)
|
||||||
|
|
||||||
# run built EXE to generate xml output
|
# Run the built EXE to generate xml output .
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
TARGET man
|
TARGET man
|
||||||
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${LIB_NAME} -xml-help > ${TIDYHELP}
|
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${LIB_NAME} -xml-help > ${TIDYHELP}
|
||||||
|
@ -358,7 +488,7 @@ if (UNIX AND SUPPORT_CONSOLE_APP)
|
||||||
VERBATIM
|
VERBATIM
|
||||||
)
|
)
|
||||||
|
|
||||||
# run built EXE to generate more xml output
|
# Run the built EXE to generate more xml output.
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
TARGET man
|
TARGET man
|
||||||
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${LIB_NAME} -xml-config > ${TIDYCONFIG}
|
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${LIB_NAME} -xml-config > ${TIDYCONFIG}
|
||||||
|
@ -366,7 +496,7 @@ if (UNIX AND SUPPORT_CONSOLE_APP)
|
||||||
VERBATIM
|
VERBATIM
|
||||||
)
|
)
|
||||||
|
|
||||||
# run xsltproc to generate the install files..
|
# Run xsltproc to generate the install files.
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
TARGET man
|
TARGET man
|
||||||
DEPENDS ${TIDYHELP}
|
DEPENDS ${TIDYHELP}
|
||||||
|
@ -383,17 +513,24 @@ if (UNIX AND SUPPORT_CONSOLE_APP)
|
||||||
endif ()
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
|
||||||
|
#################################################
|
||||||
|
# Create MSI,EXE, DMG, DEB/RPM
|
||||||
|
# TODO: Check each of these builds
|
||||||
|
#################################################
|
||||||
|
|
||||||
set(BITNESS 32)
|
set(BITNESS 32)
|
||||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
set(BITNESS 64)
|
set(BITNESS 64)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
##########################################################
|
|
||||||
### Create MSI,EXE, DMG, DEB/RPM
|
#------------------------------------------------------------------------
|
||||||
### TODO: Check each of these builds
|
# System Runtime Libraries
|
||||||
##########################################################
|
# Need to ensure that system DLLs get included in a binary
|
||||||
# Need to ensure that system dlls get included in a binary distribution
|
# distribution, but since it can miss some - seems incomplete - make
|
||||||
# But since it can miss some... seems incomplete, make optionional
|
# optional.
|
||||||
|
#------------------------------------------------------------------------
|
||||||
option( ADD_SYSTEM_RUNTIMES "Set ON to include system runtime DLLS in distribution" OFF )
|
option( ADD_SYSTEM_RUNTIMES "Set ON to include system runtime DLLS in distribution" OFF )
|
||||||
if (MSVC AND ADD_SYSTEM_RUNTIMES)
|
if (MSVC AND ADD_SYSTEM_RUNTIMES)
|
||||||
if (NOT DEFINED CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
|
if (NOT DEFINED CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
|
||||||
|
@ -404,10 +541,14 @@ if (MSVC AND ADD_SYSTEM_RUNTIMES)
|
||||||
set (CMAKE_INSTALL_DEBUG_LIBRARIES OFF)
|
set (CMAKE_INSTALL_DEBUG_LIBRARIES OFF)
|
||||||
include (InstallRequiredSystemLibraries)
|
include (InstallRequiredSystemLibraries)
|
||||||
endif ()
|
endif ()
|
||||||
##########################################################
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
# Windows
|
||||||
|
# MSI - this needs WiX Tooset installed and a path to candle.exe
|
||||||
|
# EXE - this needs NSIS tools to be in path
|
||||||
|
#------------------------------------------------------------------------
|
||||||
if (WIN32)
|
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_GENERATOR "NSIS;WIX;ZIP")
|
||||||
set(CPACK_SOURCE_GENERATOR "ZIP")
|
set(CPACK_SOURCE_GENERATOR "ZIP")
|
||||||
set(CPACK_WIX_UPGRADE_GUID "D809598A-B513-4752-B268-0BAC403B00E4")
|
set(CPACK_WIX_UPGRADE_GUID "D809598A-B513-4752-B268-0BAC403B00E4")
|
||||||
|
@ -419,6 +560,10 @@ else ()
|
||||||
set(CPACK_SOURCE_GENERATOR "TGZ")
|
set(CPACK_SOURCE_GENERATOR "TGZ")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
# General
|
||||||
|
#------------------------------------------------------------------------
|
||||||
set(CPACK_PACKAGE_NAME "${LIB_NAME}")
|
set(CPACK_PACKAGE_NAME "${LIB_NAME}")
|
||||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${LIBTIDY_DESCRIPTION}")
|
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${LIBTIDY_DESCRIPTION}")
|
||||||
set(CPACK_PACKAGE_VENDOR "HTML Tidy Advocacy Community Group")
|
set(CPACK_PACKAGE_VENDOR "HTML Tidy Advocacy Community Group")
|
||||||
|
@ -429,12 +574,16 @@ set(CPACK_PACKAGE_VERSION_MAJOR "${TIDY_MAJOR_VERSION}")
|
||||||
set(CPACK_PACKAGE_VERSION_MINOR "${TIDY_MINOR_VERSION}")
|
set(CPACK_PACKAGE_VERSION_MINOR "${TIDY_MINOR_VERSION}")
|
||||||
set(CPACK_PACKAGE_VERSION_PATCH "${TIDY_POINT_VERSION}")
|
set(CPACK_PACKAGE_VERSION_PATCH "${TIDY_POINT_VERSION}")
|
||||||
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README/README.html")
|
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README/README.html")
|
||||||
|
|
||||||
# use one compatible license file for all
|
# use one compatible license file for all
|
||||||
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/README/LICENSE.txt")
|
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_README "${CMAKE_CURRENT_SOURCE_DIR}/README/README.html")
|
||||||
set(CPACK_RESOURCE_FILE_WELCOME "${CMAKE_CURRENT_SOURCE_DIR}/README/README.html")
|
set(CPACK_RESOURCE_FILE_WELCOME "${CMAKE_CURRENT_SOURCE_DIR}/README/README.html")
|
||||||
|
|
||||||
## debian config
|
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
# Debian
|
||||||
|
#------------------------------------------------------------------------
|
||||||
set(CPACK_DEBIAN_PACKAGE_MAINTAINER ${CPACK_PACKAGE_CONTACT})
|
set(CPACK_DEBIAN_PACKAGE_MAINTAINER ${CPACK_PACKAGE_CONTACT})
|
||||||
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE ${LIBTIDY_URL})
|
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE ${LIBTIDY_URL})
|
||||||
#set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc")
|
#set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc")
|
||||||
|
@ -443,7 +592,10 @@ set(CPACK_SOURCE_IGNORE_FILES
|
||||||
"${PROJECT_SOURCE_DIR}/build"
|
"${PROJECT_SOURCE_DIR}/build"
|
||||||
)
|
)
|
||||||
|
|
||||||
## RPM config
|
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
# RPM config
|
||||||
|
#------------------------------------------------------------------------
|
||||||
set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/share/man" "/usr/share/man/man1")
|
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/")
|
set(CPACK_SOURCE_IGNORE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/test/;${CMAKE_CURRENT_SOURCE_DIR}/build/;${CMAKE_CURRENT_SOURCE_DIR}/.git/")
|
||||||
|
@ -454,12 +606,15 @@ endif ()
|
||||||
|
|
||||||
include(CPack)
|
include(CPack)
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------
|
||||||
# pkg-config
|
# pkg-config
|
||||||
|
#------------------------------------------------------------------------
|
||||||
configure_file(
|
configure_file(
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/${LIB_NAME}.pc.cmake.in"
|
"${CMAKE_CURRENT_SOURCE_DIR}/${LIB_NAME}.pc.cmake.in"
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/${LIB_NAME}.pc"
|
"${CMAKE_CURRENT_BINARY_DIR}/${LIB_NAME}.pc"
|
||||||
@ONLY
|
@ONLY
|
||||||
)
|
)
|
||||||
|
|
||||||
install(FILES
|
install(FILES
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/${LIB_NAME}.pc"
|
"${CMAKE_CURRENT_BINARY_DIR}/${LIB_NAME}.pc"
|
||||||
DESTINATION "${LIB_INSTALL_DIR}/pkgconfig"
|
DESTINATION "${LIB_INSTALL_DIR}/pkgconfig"
|
||||||
|
|
152
console/tidy.c
152
console/tidy.c
|
@ -388,7 +388,10 @@ static const CmdOptDesc cmdopt_defs[] = {
|
||||||
{ CmdOptMisc, "-version", TC_OPT_VERSION, 0, NULL, "-v" },
|
{ CmdOptMisc, "-version", TC_OPT_VERSION, 0, NULL, "-v" },
|
||||||
{ CmdOptMisc, "-help", TC_OPT_HELP, 0, NULL, "-h", "-?" },
|
{ CmdOptMisc, "-help", TC_OPT_HELP, 0, NULL, "-h", "-?" },
|
||||||
{ CmdOptMisc, "-help-config", TC_OPT_HELPCFG, 0, NULL },
|
{ CmdOptMisc, "-help-config", TC_OPT_HELPCFG, 0, NULL },
|
||||||
|
{ CmdOptMisc, "-help-env", TC_OPT_HELPENV, 0, NULL },
|
||||||
{ CmdOptMisc, "-show-config", TC_OPT_SHOWCFG, 0, NULL },
|
{ CmdOptMisc, "-show-config", TC_OPT_SHOWCFG, 0, NULL },
|
||||||
|
{ CmdOptMisc, "-export-config", TC_OPT_EXP_CFG, 0, NULL },
|
||||||
|
{ CmdOptMisc, "-export-default-config", TC_OPT_EXP_DEF, 0, NULL },
|
||||||
{ CmdOptMisc, "-help-option <%s>", TC_OPT_HELPOPT, TC_LABEL_OPT, NULL },
|
{ CmdOptMisc, "-help-option <%s>", TC_OPT_HELPOPT, TC_LABEL_OPT, NULL },
|
||||||
{ CmdOptMisc, "-language <%s>", TC_OPT_LANGUAGE, TC_LABEL_LANG, "language: <%s>" },
|
{ CmdOptMisc, "-language <%s>", TC_OPT_LANGUAGE, TC_LABEL_LANG, "language: <%s>" },
|
||||||
{ CmdOptXML, "-xml-help", TC_OPT_XMLHELP, 0, NULL },
|
{ CmdOptXML, "-xml-help", TC_OPT_XMLHELP, 0, NULL },
|
||||||
|
@ -862,7 +865,7 @@ static void help(TidyDoc tdoc, /**< The tidy document for which help is showing.
|
||||||
ctmbstr prog /**< The path of the current executable. */
|
ctmbstr prog /**< The path of the current executable. */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
tmbstr title_line = NULL;
|
tmbstr temp_string = NULL;
|
||||||
uint width = 78;
|
uint width = 78;
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
@ -870,19 +873,26 @@ static void help(TidyDoc tdoc, /**< The tidy document for which help is showing.
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
#ifdef PLATFORM_NAME
|
#ifdef PLATFORM_NAME
|
||||||
title_line = stringWithFormat( tidyLocalizedString(TC_TXT_HELP_2A), PLATFORM_NAME);
|
temp_string = stringWithFormat( tidyLocalizedString(TC_TXT_HELP_2A), PLATFORM_NAME);
|
||||||
#else
|
#else
|
||||||
title_line = stringWithFormat( tidyLocalizedString(TC_TXT_HELP_2B) );
|
title_line = stringWithFormat( tidyLocalizedString(TC_TXT_HELP_2B) );
|
||||||
#endif
|
#endif
|
||||||
width = width < strlen(title_line) ? width : strlen(title_line);
|
width = width < strlen(temp_string) ? width : strlen(temp_string);
|
||||||
printf( "%s\n", title_line );
|
printf( "%s\n", temp_string );
|
||||||
printf( "%*.*s\n\n", width, width, ul);
|
printf( "%*.*s\n\n", width, width, ul);
|
||||||
free( title_line );
|
free( temp_string );
|
||||||
|
|
||||||
print_help_options( tdoc );
|
print_help_options( tdoc );
|
||||||
|
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf( "%s", tidyLocalizedString(TC_TXT_HELP_3) );
|
#if defined(TIDY_CONFIG_FILE) && defined(TIDY_USER_CONFIG_FILE)
|
||||||
|
temp_string = stringWithFormat( tidyLocalizedString(TC_TXT_HELP_3A), TIDY_CONFIG_FILE, TIDY_USER_CONFIG_FILE );
|
||||||
|
printf( tidyLocalizedString(TC_TXT_HELP_3), temp_string );
|
||||||
|
free( temp_string );
|
||||||
|
#else
|
||||||
|
printf( tidyLocalizedString(TC_TXT_HELP_3), "\n" );
|
||||||
|
#endif
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1004,7 +1014,45 @@ static void optionhelp( TidyDoc tdoc )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** @} end service_lang_help group */
|
/** @} end service_help_config group */
|
||||||
|
/* MARK: - Provide the -help-env Service */
|
||||||
|
/***************************************************************************//**
|
||||||
|
** @defgroup service_help_env Provide the -help-env Service
|
||||||
|
*******************************************************************************
|
||||||
|
** @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/** Handles the -help-env service.
|
||||||
|
** @param tdoc The Tidy document.
|
||||||
|
*/
|
||||||
|
static void helpEnv( TidyDoc tdoc )
|
||||||
|
{
|
||||||
|
tmbstr subst = "";
|
||||||
|
Bool uses_env = getenv("HTML_TIDY") != NULL;
|
||||||
|
ctmbstr env_var = uses_env ? getenv("HTML_TIDY"): tidyLocalizedString( TC_TXT_HELP_ENV_1B );
|
||||||
|
|
||||||
|
#if defined( TIDY_CONFIG_FILE ) && defined( TIDY_USER_CONFIG_FILE )
|
||||||
|
subst = stringWithFormat( tidyLocalizedString(TC_TXT_HELP_ENV_1A), TIDY_CONFIG_FILE, TIDY_USER_CONFIG_FILE );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
env_var = env_var != NULL ? env_var : tidyLocalizedString( TC_TXT_HELP_ENV_1B );
|
||||||
|
|
||||||
|
printf( "\n" );
|
||||||
|
printf( tidyLocalizedString( TC_TXT_HELP_ENV_1), subst, env_var );
|
||||||
|
|
||||||
|
#if defined( TIDY_CONFIG_FILE ) && defined( TIDY_USER_CONFIG_FILE )
|
||||||
|
if ( uses_env )
|
||||||
|
printf( tidyLocalizedString( TC_TXT_HELP_ENV_1C ), TIDY_USER_CONFIG_FILE );
|
||||||
|
free( subst );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
printf( "\n" );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** @} end service_help_env group */
|
||||||
/* MARK: - Provide the -help-option Service */
|
/* MARK: - Provide the -help-option Service */
|
||||||
/***************************************************************************//**
|
/***************************************************************************//**
|
||||||
** @defgroup service_help_option Provide the -help-option Service
|
** @defgroup service_help_option Provide the -help-option Service
|
||||||
|
@ -1452,6 +1500,78 @@ static void optionvalues( TidyDoc tdoc )
|
||||||
|
|
||||||
|
|
||||||
/** @} end service_show_config group */
|
/** @} end service_show_config group */
|
||||||
|
/* MARK: - Provide the -export-config Services */
|
||||||
|
/***************************************************************************//**
|
||||||
|
** @defgroup service_export_config Provide the -export-config Services
|
||||||
|
*******************************************************************************
|
||||||
|
** @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/** Prints the option value for a given option.
|
||||||
|
*/
|
||||||
|
static void printOptionExportValues(TidyDoc ARG_UNUSED(tdoc), /**< The Tidy document. */
|
||||||
|
TidyOption topt, /**< The option for which to show values. */
|
||||||
|
OptionDesc *d /**< The OptionDesc array. */
|
||||||
|
)
|
||||||
|
{
|
||||||
|
TidyOptionId optId = tidyOptGetId( topt );
|
||||||
|
|
||||||
|
if ( tidyOptGetCategory(topt) == TidyInternalCategory )
|
||||||
|
return;
|
||||||
|
|
||||||
|
switch ( optId )
|
||||||
|
{
|
||||||
|
case TidyInlineTags:
|
||||||
|
case TidyBlockTags:
|
||||||
|
case TidyEmptyTags:
|
||||||
|
case TidyPreTags:
|
||||||
|
{
|
||||||
|
TidyIterator pos = tidyOptGetDeclTagList( tdoc );
|
||||||
|
while ( pos )
|
||||||
|
{
|
||||||
|
d->def = tidyOptGetNextDeclTag(tdoc, optId, &pos);
|
||||||
|
if ( pos )
|
||||||
|
{
|
||||||
|
printf( "%s: %s\n", d->name, d->def );
|
||||||
|
d->name = "";
|
||||||
|
d->type = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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 = "";
|
||||||
|
printf( "%s: %s\n", d->name, d->def );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Handles the -export-config service.
|
||||||
|
** @param tdoc The Tidy Document.
|
||||||
|
*/
|
||||||
|
static void exportOptionValues( TidyDoc tdoc )
|
||||||
|
{
|
||||||
|
ForEachSortedOption( tdoc, printOptionExportValues );
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Handles the -export-default-config service.
|
||||||
|
** @param tdoc The Tidy Document.
|
||||||
|
*/
|
||||||
|
static void exportDefaultOptionValues( TidyDoc tdoc )
|
||||||
|
{
|
||||||
|
tidyOptResetAllToDefault( tdoc );
|
||||||
|
ForEachSortedOption( tdoc, printOptionExportValues );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** @} end service_export_config group */
|
||||||
/* MARK: - Provide the -version Service */
|
/* MARK: - Provide the -version Service */
|
||||||
/***************************************************************************//**
|
/***************************************************************************//**
|
||||||
** @defgroup service_version Provide the -version Service
|
** @defgroup service_version Provide the -version Service
|
||||||
|
@ -2117,6 +2237,12 @@ int main( int argc, char** argv )
|
||||||
tidyRelease( tdoc );
|
tidyRelease( tdoc );
|
||||||
return 0; /* success */
|
return 0; /* success */
|
||||||
}
|
}
|
||||||
|
else if ( strcasecmp(arg, "help-env") == 0 )
|
||||||
|
{
|
||||||
|
helpEnv( tdoc );
|
||||||
|
tidyRelease( tdoc );
|
||||||
|
return 0; /* success */
|
||||||
|
}
|
||||||
else if ( strcasecmp(arg, "help-option") == 0 )
|
else if ( strcasecmp(arg, "help-option") == 0 )
|
||||||
{
|
{
|
||||||
if ( argc >= 3)
|
if ( argc >= 3)
|
||||||
|
@ -2142,6 +2268,18 @@ int main( int argc, char** argv )
|
||||||
tidyRelease( tdoc );
|
tidyRelease( tdoc );
|
||||||
return 0; /* success */
|
return 0; /* success */
|
||||||
}
|
}
|
||||||
|
else if ( strcasecmp(arg, "export-config") == 0 )
|
||||||
|
{
|
||||||
|
exportOptionValues( tdoc );
|
||||||
|
tidyRelease( tdoc );
|
||||||
|
return 0; /* success */
|
||||||
|
}
|
||||||
|
else if ( strcasecmp(arg, "export-default-config") == 0 )
|
||||||
|
{
|
||||||
|
exportDefaultOptionValues( tdoc );
|
||||||
|
tidyRelease( tdoc );
|
||||||
|
return 0; /* success */
|
||||||
|
}
|
||||||
else if ( strcasecmp(arg, "config") == 0 )
|
else if ( strcasecmp(arg, "config") == 0 )
|
||||||
{
|
{
|
||||||
if ( argc >= 3 )
|
if ( argc >= 3 )
|
||||||
|
|
|
@ -434,6 +434,7 @@ extern "C" {
|
||||||
FN(TC_OPT_GDOC) \
|
FN(TC_OPT_GDOC) \
|
||||||
FN(TC_OPT_HELP) \
|
FN(TC_OPT_HELP) \
|
||||||
FN(TC_OPT_HELPCFG) \
|
FN(TC_OPT_HELPCFG) \
|
||||||
|
FN(TC_OPT_HELPENV) \
|
||||||
FN(TC_OPT_HELPOPT) \
|
FN(TC_OPT_HELPOPT) \
|
||||||
FN(TC_OPT_IBM858) \
|
FN(TC_OPT_IBM858) \
|
||||||
FN(TC_OPT_INDENT) \
|
FN(TC_OPT_INDENT) \
|
||||||
|
@ -450,6 +451,8 @@ extern "C" {
|
||||||
FN(TC_OPT_RAW) \
|
FN(TC_OPT_RAW) \
|
||||||
FN(TC_OPT_SHIFTJIS) \
|
FN(TC_OPT_SHIFTJIS) \
|
||||||
FN(TC_OPT_SHOWCFG) \
|
FN(TC_OPT_SHOWCFG) \
|
||||||
|
FN(TC_OPT_EXP_CFG) \
|
||||||
|
FN(TC_OPT_EXP_DEF) \
|
||||||
FN(TC_OPT_UPPER) \
|
FN(TC_OPT_UPPER) \
|
||||||
FN(TC_OPT_UTF16) \
|
FN(TC_OPT_UTF16) \
|
||||||
FN(TC_OPT_UTF16BE) \
|
FN(TC_OPT_UTF16BE) \
|
||||||
|
@ -488,10 +491,15 @@ extern "C" {
|
||||||
FN(TC_TXT_HELP_2A) \
|
FN(TC_TXT_HELP_2A) \
|
||||||
FN(TC_TXT_HELP_2B) \
|
FN(TC_TXT_HELP_2B) \
|
||||||
FN(TC_TXT_HELP_3) \
|
FN(TC_TXT_HELP_3) \
|
||||||
|
FN(TC_TXT_HELP_3A) \
|
||||||
FN(TC_TXT_HELP_CONFIG) \
|
FN(TC_TXT_HELP_CONFIG) \
|
||||||
FN(TC_TXT_HELP_CONFIG_NAME) \
|
FN(TC_TXT_HELP_CONFIG_NAME) \
|
||||||
FN(TC_TXT_HELP_CONFIG_TYPE) \
|
FN(TC_TXT_HELP_CONFIG_TYPE) \
|
||||||
FN(TC_TXT_HELP_CONFIG_ALLW) \
|
FN(TC_TXT_HELP_CONFIG_ALLW) \
|
||||||
|
FN(TC_TXT_HELP_ENV_1) \
|
||||||
|
FN(TC_TXT_HELP_ENV_1A) \
|
||||||
|
FN(TC_TXT_HELP_ENV_1B) \
|
||||||
|
FN(TC_TXT_HELP_ENV_1C) \
|
||||||
FN(TC_TXT_HELP_LANG_1) \
|
FN(TC_TXT_HELP_LANG_1) \
|
||||||
FN(TC_TXT_HELP_LANG_2) \
|
FN(TC_TXT_HELP_LANG_2) \
|
||||||
FN(TC_TXT_HELP_LANG_3)
|
FN(TC_TXT_HELP_LANG_3)
|
||||||
|
|
|
@ -5,7 +5,7 @@ msgstr ""
|
||||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||||
"X-Generator: HTML Tidy poconvert.rb\n"
|
"X-Generator: HTML Tidy poconvert.rb\n"
|
||||||
"Project-Id-Version: \n"
|
"Project-Id-Version: \n"
|
||||||
"POT-Creation-Date: 2017-10-02 13:26:57\n"
|
"POT-Creation-Date: 2017-10-02 13:38:21\n"
|
||||||
"Last-Translator: jderry\n"
|
"Last-Translator: jderry\n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
|
|
||||||
|
@ -3155,6 +3155,10 @@ msgctxt "TC_OPT_HELPCFG"
|
||||||
msgid "list all configuration options"
|
msgid "list all configuration options"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgctxt "TC_OPT_HELPENV"
|
||||||
|
msgid "show information about the environment and runtime configuration"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgctxt "TC_OPT_HELPOPT"
|
msgctxt "TC_OPT_HELPOPT"
|
||||||
msgid "show a description of the <option>"
|
msgid "show a description of the <option>"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -3223,6 +3227,14 @@ msgctxt "TC_OPT_SHOWCFG"
|
||||||
msgid "list the current configuration settings"
|
msgid "list the current configuration settings"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgctxt "TC_OPT_EXP_CFG"
|
||||||
|
msgid "list the current configuration settings, suitable for a config file"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgctxt "TC_OPT_EXP_DEF"
|
||||||
|
msgid "list the default configuration settings, suitable for a config file"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgctxt "TC_OPT_UPPER"
|
msgctxt "TC_OPT_UPPER"
|
||||||
msgid "force tags to upper case"
|
msgid "force tags to upper case"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -3402,36 +3414,44 @@ msgstr ""
|
||||||
|
|
||||||
#. This console output should be limited to 78 characters per line.
|
#. 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.
|
#. - The strings "Tidy" and "HTML Tidy" are the program name and must not be translated.
|
||||||
|
#. - %s represents either a blank line, or TC_TXT_HELP_3A explaining environment options.
|
||||||
|
#, c-format
|
||||||
msgctxt "TC_TXT_HELP_3"
|
msgctxt "TC_TXT_HELP_3"
|
||||||
msgid ""
|
msgid ""
|
||||||
"\n"
|
"\n"
|
||||||
"Tidy Configuration Options\n"
|
"Tidy Configuration Options\n"
|
||||||
"==========================\n"
|
"==========================\n"
|
||||||
"Use Tidy's configuration options as command line arguments in the form\n"
|
" Use Tidy's configuration options as command line arguments in the form\n"
|
||||||
"of \"--some-option <value>\", for example, \"--indent-with-tabs yes\".\n"
|
" of \"--some-option <value>\", for example, \"--indent-with-tabs yes\".\n"
|
||||||
"\n"
|
"\n"
|
||||||
"For a list of all configuration options, use \"-help-config\" or refer\n"
|
" You can also specify a file containing configuration options with the \n"
|
||||||
"to the man page (if your OS has one).\n"
|
" -options <file> directive, or in one or more files specific to your \n"
|
||||||
|
" environment (see next section). \n"
|
||||||
"\n"
|
"\n"
|
||||||
"If your environment has an $HTML_TIDY variable set point to a Tidy \n"
|
" For a list of all configuration options, use \"-help-config\" or refer\n"
|
||||||
"configuration file then Tidy will attempt to use it.\n"
|
" to the man page (if your OS has one).\n"
|
||||||
"\n"
|
"\n"
|
||||||
"On some platforms Tidy will also attempt to use a configuration specified \n"
|
"Configuration Files\n"
|
||||||
"in /etc/tidy.conf or ~/.tidy.conf.\n"
|
"===================\n"
|
||||||
|
" If your environment has an $HTML_TIDY variable set to point to a Tidy \n"
|
||||||
|
" configuration file, then Tidy will attempt to use it. \n"
|
||||||
|
"%s"
|
||||||
|
" Use \"-help-env\" for more information about how you can use the environment. \n"
|
||||||
|
" to specify Tidy options. \n"
|
||||||
"\n"
|
"\n"
|
||||||
"Other\n"
|
"Other\n"
|
||||||
"=====\n"
|
"=====\n"
|
||||||
"Input/Output default to stdin/stdout respectively.\n"
|
" Input/Output default to stdin/stdout respectively.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Single letter options apart from -f may be combined\n"
|
" Single letter options apart from -f may be combined\n"
|
||||||
"as in: tidy -f errs.txt -imu foo.html\n"
|
" as in: tidy -f errs.txt -imu foo.html\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Information\n"
|
"Information\n"
|
||||||
"===========\n"
|
"===========\n"
|
||||||
"For more information about HTML Tidy, see\n"
|
" For more information about HTML Tidy, see\n"
|
||||||
" http://www.html-tidy.org/\n"
|
" http://www.html-tidy.org/\n"
|
||||||
"\n"
|
"\n"
|
||||||
"For more information on HTML, see the following:\n"
|
" For more information on HTML, see the following:\n"
|
||||||
"\n"
|
"\n"
|
||||||
" HTML: Edition for Web Authors (the latest HTML specification)\n"
|
" HTML: Edition for Web Authors (the latest HTML specification)\n"
|
||||||
" http://dev.w3.org/html5/spec-author-view\n"
|
" http://dev.w3.org/html5/spec-author-view\n"
|
||||||
|
@ -3439,14 +3459,29 @@ msgid ""
|
||||||
" HTML: The Markup Language (an HTML language reference)\n"
|
" HTML: The Markup Language (an HTML language reference)\n"
|
||||||
" http://dev.w3.org/html5/markup/\n"
|
" http://dev.w3.org/html5/markup/\n"
|
||||||
"\n"
|
"\n"
|
||||||
"File bug reports at https://github.com/htacg/tidy-html5/issues/\n"
|
" File bug reports at https://github.com/htacg/tidy-html5/issues/\n"
|
||||||
"or send questions and comments to public-htacg@w3.org.\n"
|
" or send questions and comments to public-htacg@w3.org.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Validate your HTML documents using the W3C Nu Markup Validator:\n"
|
" Validate your HTML documents using the W3C Nu Markup Validator:\n"
|
||||||
" http://validator.w3.org/nu/\n"
|
" http://validator.w3.org/nu/\n"
|
||||||
"\n"
|
"\n"
|
||||||
msgstr ""
|
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.
|
||||||
|
#. - Both parameters %s reflect file paths and names.
|
||||||
|
#, c-format
|
||||||
|
msgctxt "TC_TXT_HELP_3A"
|
||||||
|
msgid ""
|
||||||
|
"\n"
|
||||||
|
" Additionally, Tidy will automatically attempt to use configuration specified \n"
|
||||||
|
" in these files, if present: \n"
|
||||||
|
"\n"
|
||||||
|
" %s \n"
|
||||||
|
" %s \n"
|
||||||
|
"\n"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#. This console output should be limited to 78 characters per line.
|
#. 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.
|
#. - The strings "Tidy" and "HTML Tidy" are the program name and must not be translated.
|
||||||
msgctxt "TC_TXT_HELP_CONFIG"
|
msgctxt "TC_TXT_HELP_CONFIG"
|
||||||
|
@ -3477,6 +3512,54 @@ msgctxt "TC_TXT_HELP_CONFIG_ALLW"
|
||||||
msgid "Allowable values"
|
msgid "Allowable values"
|
||||||
msgstr ""
|
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.
|
||||||
|
#. - The first %s indicates two more list items, or an empty string.
|
||||||
|
#. - The second %s indicates a file name, or a message indicating no file name.
|
||||||
|
#, c-format
|
||||||
|
msgctxt "TC_TXT_HELP_ENV_1"
|
||||||
|
msgid ""
|
||||||
|
"\n"
|
||||||
|
"Tidy can configure its option values from multiple sources, in the \n"
|
||||||
|
"order below. Subsequent use of the same option overrides previous \n"
|
||||||
|
"option settings. \n"
|
||||||
|
"\n"
|
||||||
|
" - Tidy's built-in default values. \n"
|
||||||
|
"%s" /* rc files */
|
||||||
|
" - The file specified in the $HTML_TIDY environment variable: \n"
|
||||||
|
" %s \n"
|
||||||
|
" - Options in a file specified on the command line. \n"
|
||||||
|
" - Options set directly on the command line. \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.
|
||||||
|
#, c-format
|
||||||
|
msgctxt "TC_TXT_HELP_ENV_1A"
|
||||||
|
msgid ""
|
||||||
|
" - The system runtime configuration file: \n"
|
||||||
|
" %s \n"
|
||||||
|
" - The user runtime configuration file: \n"
|
||||||
|
" %s \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.
|
||||||
|
#. - This message indicates that a file name is not currently set.
|
||||||
|
msgctxt "TC_TXT_HELP_ENV_1B"
|
||||||
|
msgid "(not currently set)"
|
||||||
|
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.
|
||||||
|
#, c-format
|
||||||
|
msgctxt "TC_TXT_HELP_ENV_1C"
|
||||||
|
msgid ""
|
||||||
|
"\n"
|
||||||
|
"Note that because $HTML_TIDY is set, the user runtime configuration file \n"
|
||||||
|
"%s will not be used. \n"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#. This console output should be limited to 78 characters per line.
|
#. 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.
|
#. - The strings "Tidy" and "HTML Tidy" are the program name and must not be translated.
|
||||||
msgctxt "TC_TXT_HELP_LANG_1"
|
msgctxt "TC_TXT_HELP_LANG_1"
|
||||||
|
|
|
@ -26,6 +26,9 @@
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<xsl:variable name="CONFIG" select="document('@TIDYCONFIG@')"/>
|
<xsl:variable name="CONFIG" select="document('@TIDYCONFIG@')"/>
|
||||||
|
<xsl:variable name="ENABLE_CONFIG_FILES" select="'@ENABLE_CONFIG_FILES@'"/>
|
||||||
|
<xsl:variable name="TIDY_CONFIG_FILE" select="'@TIDY_CONFIG_FILE@'"/>
|
||||||
|
<xsl:variable name="TIDY_USER_CONFIG_FILE" select="'@TIDY_USER_CONFIG_FILE@'"/>
|
||||||
|
|
||||||
<!-- Main Template: -->
|
<!-- Main Template: -->
|
||||||
<xsl:template match="/">
|
<xsl:template match="/">
|
||||||
|
@ -160,6 +163,20 @@ since you will probably invoke \fBtidy\fR from different directories.
|
||||||
The value of HTML_TIDY will be parsed after the compiled-in default
|
The value of HTML_TIDY will be parsed after the compiled-in default
|
||||||
(defined with -DTIDY_CONFIG_FILE), but before any of the files specified
|
(defined with -DTIDY_CONFIG_FILE), but before any of the files specified
|
||||||
using \fB-config\fR.
|
using \fB-config\fR.
|
||||||
|
<xsl:if test="$ENABLE_CONFIG_FILES = 'ON'">
|
||||||
|
.TP
|
||||||
|
.B RUNTIME CONFIGURATION FILES
|
||||||
|
You can also specify runtime configuration files from which \fBtidy\fR will
|
||||||
|
attempt to load a configuration automatically.
|
||||||
|
.IP
|
||||||
|
The system runtime configuration file (<xsl:value-of select="$TIDY_CONFIG_FILE" />),
|
||||||
|
if it exists will be loaded and applied first, followed by the user runtime
|
||||||
|
configuration file (<xsl:value-of select="$TIDY_USER_CONFIG_FILE" />).
|
||||||
|
Subsequent usage of a specific option will override any previous usage.
|
||||||
|
.IP
|
||||||
|
Note that if you use the \fBHTML_TIDY\fR environment variable, then the user
|
||||||
|
runtime configuration file will not be used. This is a feature, not a bug.
|
||||||
|
</xsl:if>
|
||||||
.SH "EXIT STATUS"
|
.SH "EXIT STATUS"
|
||||||
.IP 0
|
.IP 0
|
||||||
All input files were processed successfully.
|
All input files were processed successfully.
|
||||||
|
|
|
@ -722,7 +722,7 @@ static ctmbstr ExpandTilde( TidyDocImpl* doc, ctmbstr filename )
|
||||||
while ( *s && *s != '/' )
|
while ( *s && *s != '/' )
|
||||||
s++;
|
s++;
|
||||||
|
|
||||||
if ( t = TidyDocAlloc(doc, s - filename) )
|
if ( (t = TidyDocAlloc(doc, s - filename)) )
|
||||||
{
|
{
|
||||||
memcpy(t, filename+1, s-filename-1);
|
memcpy(t, filename+1, s-filename-1);
|
||||||
t[s-filename-1] = 0;
|
t[s-filename-1] = 0;
|
||||||
|
|
|
@ -2116,6 +2116,7 @@ static languageDefinition language_en = { whichPluralForm_en, {
|
||||||
{ TC_OPT_GDOC, 0, "produce clean version of html exported by Google Docs" },
|
{ TC_OPT_GDOC, 0, "produce clean version of html exported by Google Docs" },
|
||||||
{ TC_OPT_HELP, 0, "list the command line options" },
|
{ TC_OPT_HELP, 0, "list the command line options" },
|
||||||
{ TC_OPT_HELPCFG, 0, "list all configuration options" },
|
{ TC_OPT_HELPCFG, 0, "list all configuration options" },
|
||||||
|
{ TC_OPT_HELPENV, 0, "show information about the environment and runtime configuration" },
|
||||||
{ TC_OPT_HELPOPT, 0, "show a description of the <option>" },
|
{ TC_OPT_HELPOPT, 0, "show a description of the <option>" },
|
||||||
{ TC_OPT_IBM858, 0, "use IBM-858 (CP850+Euro) for input, US-ASCII for output" },
|
{ TC_OPT_IBM858, 0, "use IBM-858 (CP850+Euro) for input, US-ASCII for output" },
|
||||||
{ TC_OPT_INDENT, 0, "indent element content" },
|
{ TC_OPT_INDENT, 0, "indent element content" },
|
||||||
|
@ -2139,6 +2140,8 @@ static languageDefinition language_en = { whichPluralForm_en, {
|
||||||
{ TC_OPT_RAW, 0, "output values above 127 without conversion to entities" },
|
{ TC_OPT_RAW, 0, "output values above 127 without conversion to entities" },
|
||||||
{ TC_OPT_SHIFTJIS, 0, "use Shift_JIS for both input and output" },
|
{ TC_OPT_SHIFTJIS, 0, "use Shift_JIS for both input and output" },
|
||||||
{ TC_OPT_SHOWCFG, 0, "list the current configuration settings" },
|
{ TC_OPT_SHOWCFG, 0, "list the current configuration settings" },
|
||||||
|
{ TC_OPT_EXP_CFG, 0, "list the current configuration settings, suitable for a config file" },
|
||||||
|
{ TC_OPT_EXP_DEF, 0, "list the default configuration settings, suitable for a config file" },
|
||||||
{ TC_OPT_UPPER, 0, "force tags to upper case" },
|
{ TC_OPT_UPPER, 0, "force tags to upper case" },
|
||||||
{ TC_OPT_UTF16, 0, "use UTF-16 for both input and output" },
|
{ TC_OPT_UTF16, 0, "use UTF-16 for both input and output" },
|
||||||
{ TC_OPT_UTF16BE, 0, "use UTF-16BE for both input and output" },
|
{ TC_OPT_UTF16BE, 0, "use UTF-16BE for both input and output" },
|
||||||
|
@ -2230,36 +2233,43 @@ static languageDefinition language_en = { whichPluralForm_en, {
|
||||||
"Command Line Arguments for HTML Tidy:"
|
"Command Line Arguments for HTML Tidy:"
|
||||||
},
|
},
|
||||||
{/* This console output should be limited to 78 characters per line.
|
{/* 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. */
|
- The strings "Tidy" and "HTML Tidy" are the program name and must not be translated.
|
||||||
|
- %s represents either a blank line, or TC_TXT_HELP_3A explaining environment options. */
|
||||||
TC_TXT_HELP_3, 0,
|
TC_TXT_HELP_3, 0,
|
||||||
"\n"
|
"\n"
|
||||||
"Tidy Configuration Options\n"
|
"Tidy Configuration Options\n"
|
||||||
"==========================\n"
|
"==========================\n"
|
||||||
"Use Tidy's configuration options as command line arguments in the form\n"
|
" Use Tidy's configuration options as command line arguments in the form\n"
|
||||||
"of \"--some-option <value>\", for example, \"--indent-with-tabs yes\".\n"
|
" of \"--some-option <value>\", for example, \"--indent-with-tabs yes\".\n"
|
||||||
"\n"
|
"\n"
|
||||||
"For a list of all configuration options, use \"-help-config\" or refer\n"
|
" You can also specify a file containing configuration options with the \n"
|
||||||
"to the man page (if your OS has one).\n"
|
" -options <file> directive, or in one or more files specific to your \n"
|
||||||
|
" environment (see next section). \n"
|
||||||
"\n"
|
"\n"
|
||||||
"If your environment has an $HTML_TIDY variable set point to a Tidy \n"
|
" For a list of all configuration options, use \"-help-config\" or refer\n"
|
||||||
"configuration file then Tidy will attempt to use it.\n"
|
" to the man page (if your OS has one).\n"
|
||||||
"\n"
|
"\n"
|
||||||
"On some platforms Tidy will also attempt to use a configuration specified \n"
|
"Configuration Files\n"
|
||||||
"in /etc/tidy.conf or ~/.tidy.conf.\n"
|
"===================\n"
|
||||||
|
" If your environment has an $HTML_TIDY variable set to point to a Tidy \n"
|
||||||
|
" configuration file, then Tidy will attempt to use it. \n"
|
||||||
|
"%s"
|
||||||
|
" Use \"-help-env\" for more information about how you can use the environment. \n"
|
||||||
|
" to specify Tidy options. \n"
|
||||||
"\n"
|
"\n"
|
||||||
"Other\n"
|
"Other\n"
|
||||||
"=====\n"
|
"=====\n"
|
||||||
"Input/Output default to stdin/stdout respectively.\n"
|
" Input/Output default to stdin/stdout respectively.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Single letter options apart from -f may be combined\n"
|
" Single letter options apart from -f may be combined\n"
|
||||||
"as in: tidy -f errs.txt -imu foo.html\n"
|
" as in: tidy -f errs.txt -imu foo.html\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Information\n"
|
"Information\n"
|
||||||
"===========\n"
|
"===========\n"
|
||||||
"For more information about HTML Tidy, see\n"
|
" For more information about HTML Tidy, see\n"
|
||||||
" http://www.html-tidy.org/\n"
|
" http://www.html-tidy.org/\n"
|
||||||
"\n"
|
"\n"
|
||||||
"For more information on HTML, see the following:\n"
|
" For more information on HTML, see the following:\n"
|
||||||
"\n"
|
"\n"
|
||||||
" HTML: Edition for Web Authors (the latest HTML specification)\n"
|
" HTML: Edition for Web Authors (the latest HTML specification)\n"
|
||||||
" http://dev.w3.org/html5/spec-author-view\n"
|
" http://dev.w3.org/html5/spec-author-view\n"
|
||||||
|
@ -2267,13 +2277,25 @@ static languageDefinition language_en = { whichPluralForm_en, {
|
||||||
" HTML: The Markup Language (an HTML language reference)\n"
|
" HTML: The Markup Language (an HTML language reference)\n"
|
||||||
" http://dev.w3.org/html5/markup/\n"
|
" http://dev.w3.org/html5/markup/\n"
|
||||||
"\n"
|
"\n"
|
||||||
"File bug reports at https://github.com/htacg/tidy-html5/issues/\n"
|
" File bug reports at https://github.com/htacg/tidy-html5/issues/\n"
|
||||||
"or send questions and comments to public-htacg@w3.org.\n"
|
" or send questions and comments to public-htacg@w3.org.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Validate your HTML documents using the W3C Nu Markup Validator:\n"
|
" Validate your HTML documents using the W3C Nu Markup Validator:\n"
|
||||||
" http://validator.w3.org/nu/\n"
|
" http://validator.w3.org/nu/\n"
|
||||||
"\n"
|
"\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.
|
||||||
|
- Both parameters %s reflect file paths and names. */
|
||||||
|
TC_TXT_HELP_3A, 0,
|
||||||
|
"\n"
|
||||||
|
" Additionally, Tidy will automatically attempt to use configuration specified \n"
|
||||||
|
" in these files, if present: \n"
|
||||||
|
"\n"
|
||||||
|
" %s \n"
|
||||||
|
" %s \n"
|
||||||
|
"\n"
|
||||||
|
},
|
||||||
{/* This console output should be limited to 78 characters per line.
|
{/* 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. */
|
- The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. */
|
||||||
TC_TXT_HELP_CONFIG, 0,
|
TC_TXT_HELP_CONFIG, 0,
|
||||||
|
@ -2293,6 +2315,44 @@ static languageDefinition language_en = { whichPluralForm_en, {
|
||||||
{ TC_TXT_HELP_CONFIG_NAME, 0, "Name" },
|
{ TC_TXT_HELP_CONFIG_NAME, 0, "Name" },
|
||||||
{ TC_TXT_HELP_CONFIG_TYPE, 0, "Type" },
|
{ TC_TXT_HELP_CONFIG_TYPE, 0, "Type" },
|
||||||
{ TC_TXT_HELP_CONFIG_ALLW, 0, "Allowable values" },
|
{ TC_TXT_HELP_CONFIG_ALLW, 0, "Allowable values" },
|
||||||
|
{/* 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.
|
||||||
|
- The first %s indicates two more list items, or an empty string.
|
||||||
|
- The second %s indicates a file name, or a message indicating no file name. */
|
||||||
|
TC_TXT_HELP_ENV_1, 0,
|
||||||
|
"\n"
|
||||||
|
"Tidy can configure its option values from multiple sources, in the \n"
|
||||||
|
"order below. Subsequent use of the same option overrides previous \n"
|
||||||
|
"option settings. \n"
|
||||||
|
"\n"
|
||||||
|
" - Tidy's built-in default values. \n"
|
||||||
|
"%s" /* rc files */
|
||||||
|
" - The file specified in the $HTML_TIDY environment variable: \n"
|
||||||
|
" %s \n"
|
||||||
|
" - Options in a file specified on the command line. \n"
|
||||||
|
" - Options set directly on the command line. \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. */
|
||||||
|
TC_TXT_HELP_ENV_1A, 0,
|
||||||
|
" - The system runtime configuration file: \n"
|
||||||
|
" %s \n"
|
||||||
|
" - The user runtime configuration file: \n"
|
||||||
|
" %s \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.
|
||||||
|
- This message indicates that a file name is not currently set. */
|
||||||
|
TC_TXT_HELP_ENV_1B, 0,
|
||||||
|
"(not currently set)"
|
||||||
|
},
|
||||||
|
{/* 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. */
|
||||||
|
TC_TXT_HELP_ENV_1C, 0,
|
||||||
|
"\n"
|
||||||
|
"Note that because $HTML_TIDY is set, the user runtime configuration file \n"
|
||||||
|
"%s will not be used. \n"
|
||||||
|
},
|
||||||
{/* This console output should be limited to 78 characters per line.
|
{/* 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. */
|
- The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. */
|
||||||
TC_TXT_HELP_LANG_1, 0,
|
TC_TXT_HELP_LANG_1, 0,
|
||||||
|
|
Loading…
Reference in a new issue