Merge branch 'unix_features' into next

This commit is contained in:
Jim Derry 2017-10-02 13:39:17 -04:00
commit 77632e2fb8
7 changed files with 646 additions and 185 deletions

View file

@ -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)
set(LIB_NAME tidy)
@ -8,18 +25,30 @@ set(LIBTIDY_URL "http://www.html-tidy.org")
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.
#################################################
# Setup
#################################################
#------------------------------------------------------------------------
# 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)
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
# Establish version number
if (LIBTIDY_VERSION)
string(REPLACE "." ";" VERSION_LIST ${LIBTIDY_VERSION})
list(GET VERSION_LIST 0 TIDY_MAJOR_VERSION)
@ -27,8 +56,9 @@ if (LIBTIDY_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
endif ()
# Establish version date
if (LIBTIDY_DATE)
string(REPLACE "." ";" DATE_LIST ${LIBTIDY_DATE})
list(GET DATE_LIST 0 tidy_YEAR)
@ -38,61 +68,106 @@ 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
#------------------------------------------------------------------------
# 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
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 ()
option( BUILD_SHARED_LIB "Set OFF to NOT build shared library" ON )
# 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
#------------------------------------------------------------------------
# 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 )
if (SUPPORT_LOCALIZATIONS)
add_definitions ( -DSUPPORT_LOCALIZATIONS=1 )
add_definitions ( -DSUPPORT_LOCALIZATIONS=1 )
else ()
add_definitions ( -DSUPPORT_LOCALIZATIONS=0 )
add_definitions ( -DSUPPORT_LOCALIZATIONS=0 )
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.
option( SUPPORT_CONSOLE_APP "Set OFF to libraries only without console application support." ON )
#------------------------------------------------------------------------
# Console Application
# 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)
add_definitions ( -DSUPPORT_CONSOLE_APP=1 )
add_definitions ( -DSUPPORT_CONSOLE_APP=1 )
else ()
add_definitions ( -DSUPPORT_CONSOLE_APP=0 )
add_definitions ( -DSUPPORT_CONSOLE_APP=0 )
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)
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_CRTDBG_MEMORY "Set ON to enable the Windows CRT debug library." OFF )
if (ENABLE_MEMORY_DEBUG)
add_definitions ( -DDEBUG_MEMORY ) # see alloc.c for details
message(STATUS "*** Note, alloc.c memory diagnostics are ON")
endif ()
if (ENABLE_ALLOC_DEBUG)
add_definitions ( -DDEBUG_ALLOCATION ) # see lexer.c for details
message(STATUS "*** Note, lexer.c node allocation diagnostics are ON")
endif ()
if (ENABLE_CRTDBG_MEMORY)
add_definitions ( -D_CRTDBG_MAP_ALLOC ) # see tidy.c for details
message(STATUS "*** Note, tidy.c Windows CRT memory debug is ON")
endif ()
endif ()
#------------------------------------------------------------------------
# Complier Flags
# Setup other compiler-specific and platform-specific compiler flags.
#------------------------------------------------------------------------
if(CMAKE_COMPILER_IS_GNUCXX)
set( WARNING_FLAGS -Wall )
endif(CMAKE_COMPILER_IS_GNUCXX)
@ -102,20 +177,16 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
endif()
if(WIN32 AND MSVC)
# turn off various warnings
set(WARNING_FLAGS "${WARNING_FLAGS} /wd4996")
# C4996: The compiler encountered a deprecated declaration.
# 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)
foreach(warning 4996 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()
@ -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_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)
option( USE_STATIC_RUNTIME "Set ON to change /MD(DLL) to /MT(static)" OFF )
if (USE_STATIC_RUNTIME)
@ -147,53 +223,78 @@ if (MSVC)
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_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}" )
# Optionally specify an extra version point for pre-release/debug versions.
if (TIDY_RC_NUMBER)
add_definitions ( -DRC_NUMBER="${TIDY_RC_NUMBER}" )
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,
# support runtime configuration files in /etc/ and in ~/. To prevent this,
# set ENABLE_CONFIG_FILES to NO. Specify -DTIDY_CONFIG_FILE and/or
# -DTIDY_USER_CONFIG_FILE to override the default paths in tidyplatform.h.
# @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 )
if ( ENABLE_CONFIG_FILES )
message(STATUS "*** Building support for runtime configuration files.")
add_definitions( -DTIDY_ENABLE_CONFIG_FILES )
# For example, /etc/tidy.conf
if (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}" )
endif ()
# 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.")
add_definitions( -DTIDY_ENABLE_CONFIG_FILES )
# define a default here so we can pass to XSL.
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_USER_CONFIG_FILE="${TIDY_USER_CONFIG_FILE}" )
endif ()
#------------------------------------------------------------------------
# Shared Library
# Setup whether or not we will build the shared library.
#------------------------------------------------------------------------
if(BUILD_SHARED_LIB)
set(LIB_TYPE SHARED)
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}")
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" )
##############################################################################
### 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
@ -219,11 +326,11 @@ set ( CFILES
${SRCDIR}/tagask.c ${SRCDIR}/tmbstr.c ${SRCDIR}/utf8.c
${SRCDIR}/tidylib.c ${SRCDIR}/mappedio.c ${SRCDIR}/gdoc.c
${SRCDIR}/language.c ${SRCDIR}/messageobj.c )
set ( HFILES
${INCDIR}/tidyplatform.h ${INCDIR}/tidy.h ${INCDIR}/tidyenum.h
${INCDIR}/tidybuffio.h )
option (TIDY_COMPAT_HEADERS "If set to ON, compatability headers are included" OFF)
if (TIDY_COMPAT_HEADERS)
set ( HFILES ${HFILES} ${INCDIR}/buffio.h ${INCDIR}/platform.h )
endif ()
@ -237,12 +344,16 @@ set ( LIBHFILES
${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 ()
#######################################
#------------------------------------------------------------------------
# Target Locations
#------------------------------------------------------------------------
if (NOT LIB_INSTALL_DIR)
set(LIB_INSTALL_DIR lib${LIB_SUFFIX})
endif ()
@ -255,12 +366,15 @@ if (NOT INCLUDE_INSTALL_DIR)
set(INCLUDE_INSTALL_DIR include/${LIB_NAME})
endif ()
# Always build the STATIC library
#------------------------------------------------------------------------
# Static Library
# The static library always builds.
#------------------------------------------------------------------------
set(name tidy-static)
add_library ( ${name} STATIC ${CFILES} ${HFILES} ${LIBHFILES} )
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
list ( APPEND add_LIBS ${name} )
endif ()
@ -270,13 +384,17 @@ install(TARGETS ${name}
LIBRARY DESTINATION ${LIB_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)
set(name tidy-share)
add_library ( ${name} SHARED ${CFILES} ${HFILES} ${LIBHFILES} )
set_target_properties( ${name} PROPERTIES
OUTPUT_NAME ${LIB_NAME} )
OUTPUT_NAME ${LIB_NAME} )
set_target_properties( ${name} PROPERTIES
VERSION ${LIBTIDY_VERSION}
SOVERSION ${TIDY_MAJOR_VERSION} )
@ -289,13 +407,17 @@ if (BUILD_SHARED_LIB)
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
)
if (TIDY_CONSOLE_SHARED) # user wants shared/dll linkage
if (TIDY_CONSOLE_SHARED) # user wants shared/dll linkage
list ( APPEND add_LIBS ${name} )
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)
set(name ${LIB_NAME})
set ( BINDIR console )
@ -311,6 +433,10 @@ if (SUPPORT_CONSOLE_APP)
install (TARGETS ${name} DESTINATION bin)
endif ()
#------------------------------------------------------------------------
# Miscellaneous Targets
#------------------------------------------------------------------------
if (BUILD_TAB2SPACE)
set(name tab2space)
add_executable( ${name} ${BINDIR}/tab2space.c )
@ -331,9 +457,11 @@ if (BUILD_SAMPLE_CODE)
# no INSTALL of this 'local' sample
endif ()
#==========================================================
#################################################
# Create man pages
#==========================================================
#################################################
if (UNIX AND SUPPORT_CONSOLE_APP)
find_program( XSLTPROC_FOUND xsltproc )
if (XSLTPROC_FOUND)
@ -345,12 +473,14 @@ if (UNIX AND SUPPORT_CONSOLE_APP)
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}")
## Populate the @VARIABLES@ in the input file.
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/man/tidy1.xsl.in
${TIDY1XSL}
)
# run built EXE to generate xml output
# Run the built EXE to generate xml output .
add_custom_command(
TARGET man
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${LIB_NAME} -xml-help > ${TIDYHELP}
@ -358,7 +488,7 @@ if (UNIX AND SUPPORT_CONSOLE_APP)
VERBATIM
)
# run built EXE to generate more xml output
# Run the built EXE to generate more xml output.
add_custom_command(
TARGET man
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${LIB_NAME} -xml-config > ${TIDYCONFIG}
@ -366,7 +496,7 @@ if (UNIX AND SUPPORT_CONSOLE_APP)
VERBATIM
)
# run xsltproc to generate the install files..
# Run xsltproc to generate the install files.
add_custom_command(
TARGET man
DEPENDS ${TIDYHELP}
@ -383,17 +513,24 @@ if (UNIX AND SUPPORT_CONSOLE_APP)
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()
##########################################################
### Create MSI,EXE, DMG, DEB/RPM
### TODO: Check each of these builds
##########################################################
# Need to ensure that system dlls get included in a binary distribution
# But since it can miss some... seems incomplete, make optionional
#------------------------------------------------------------------------
# System Runtime Libraries
# Need to ensure that system DLLs get included in a binary
# distribution, but since it can miss some - seems incomplete - make
# optional.
#------------------------------------------------------------------------
option( ADD_SYSTEM_RUNTIMES "Set ON to include system runtime DLLS in distribution" OFF )
if (MSVC AND ADD_SYSTEM_RUNTIMES)
if (NOT DEFINED CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
@ -403,11 +540,15 @@ if (MSVC AND ADD_SYSTEM_RUNTIMES)
endif ()
set (CMAKE_INSTALL_DEBUG_LIBRARIES OFF)
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)
# 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")
@ -419,6 +560,10 @@ else ()
set(CPACK_SOURCE_GENERATOR "TGZ")
endif ()
#------------------------------------------------------------------------
# General
#------------------------------------------------------------------------
set(CPACK_PACKAGE_NAME "${LIB_NAME}")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${LIBTIDY_DESCRIPTION}")
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_PATCH "${TIDY_POINT_VERSION}")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README/README.html")
# use one compatible license file for all
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
#------------------------------------------------------------------------
# Debian
#------------------------------------------------------------------------
set(CPACK_DEBIAN_PACKAGE_MAINTAINER ${CPACK_PACKAGE_CONTACT})
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE ${LIBTIDY_URL})
#set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc")
@ -443,7 +592,10 @@ set(CPACK_SOURCE_IGNORE_FILES
"${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_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)
#------------------------------------------------------------------------
# pkg-config
#------------------------------------------------------------------------
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/${LIB_NAME}.pc.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/${LIB_NAME}.pc"
@ONLY
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/${LIB_NAME}.pc"
DESTINATION "${LIB_INSTALL_DIR}/pkgconfig"

View file

@ -345,57 +345,60 @@ typedef struct {
** 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" },
{ 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>" },
{ 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 },
{ 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 },
{ 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 },
{ 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 },
{ 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 },
{ 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, "-version", TC_OPT_VERSION, 0, NULL, "-v" },
{ CmdOptMisc, "-help", TC_OPT_HELP, 0, NULL, "-h", "-?" },
{ 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, "-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, "-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 }
};
@ -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. */
)
{
tmbstr title_line = NULL;
tmbstr temp_string = NULL;
uint width = 78;
printf("\n");
@ -870,19 +873,26 @@ static void help(TidyDoc tdoc, /**< The tidy document for which help is showing.
printf("\n");
#ifdef PLATFORM_NAME
title_line = stringWithFormat( tidyLocalizedString(TC_TXT_HELP_2A), PLATFORM_NAME);
temp_string = stringWithFormat( tidyLocalizedString(TC_TXT_HELP_2A), PLATFORM_NAME);
#else
title_line = stringWithFormat( tidyLocalizedString(TC_TXT_HELP_2B) );
#endif
width = width < strlen(title_line) ? width : strlen(title_line);
printf( "%s\n", title_line );
width = width < strlen(temp_string) ? width : strlen(temp_string);
printf( "%s\n", temp_string );
printf( "%*.*s\n\n", width, width, ul);
free( title_line );
free( temp_string );
print_help_options( tdoc );
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");
}
@ -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 */
/***************************************************************************//**
** @defgroup service_help_option Provide the -help-option Service
@ -1452,6 +1500,78 @@ static void optionvalues( TidyDoc tdoc )
/** @} 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 */
/***************************************************************************//**
** @defgroup service_version Provide the -version Service
@ -2117,6 +2237,12 @@ int main( int argc, char** argv )
tidyRelease( tdoc );
return 0; /* success */
}
else if ( strcasecmp(arg, "help-env") == 0 )
{
helpEnv( tdoc );
tidyRelease( tdoc );
return 0; /* success */
}
else if ( strcasecmp(arg, "help-option") == 0 )
{
if ( argc >= 3)
@ -2142,6 +2268,18 @@ int main( int argc, char** argv )
tidyRelease( tdoc );
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 )
{
if ( argc >= 3 )

View file

@ -434,6 +434,7 @@ extern "C" {
FN(TC_OPT_GDOC) \
FN(TC_OPT_HELP) \
FN(TC_OPT_HELPCFG) \
FN(TC_OPT_HELPENV) \
FN(TC_OPT_HELPOPT) \
FN(TC_OPT_IBM858) \
FN(TC_OPT_INDENT) \
@ -450,6 +451,8 @@ extern "C" {
FN(TC_OPT_RAW) \
FN(TC_OPT_SHIFTJIS) \
FN(TC_OPT_SHOWCFG) \
FN(TC_OPT_EXP_CFG) \
FN(TC_OPT_EXP_DEF) \
FN(TC_OPT_UPPER) \
FN(TC_OPT_UTF16) \
FN(TC_OPT_UTF16BE) \
@ -488,10 +491,15 @@ extern "C" {
FN(TC_TXT_HELP_2A) \
FN(TC_TXT_HELP_2B) \
FN(TC_TXT_HELP_3) \
FN(TC_TXT_HELP_3A) \
FN(TC_TXT_HELP_CONFIG) \
FN(TC_TXT_HELP_CONFIG_NAME) \
FN(TC_TXT_HELP_CONFIG_TYPE) \
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_2) \
FN(TC_TXT_HELP_LANG_3)

View file

@ -5,7 +5,7 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: HTML Tidy poconvert.rb\n"
"Project-Id-Version: \n"
"POT-Creation-Date: 2017-10-02 13:26:57\n"
"POT-Creation-Date: 2017-10-02 13:38:21\n"
"Last-Translator: jderry\n"
"Language-Team: \n"
@ -3155,6 +3155,10 @@ msgctxt "TC_OPT_HELPCFG"
msgid "list all configuration options"
msgstr ""
msgctxt "TC_OPT_HELPENV"
msgid "show information about the environment and runtime configuration"
msgstr ""
msgctxt "TC_OPT_HELPOPT"
msgid "show a description of the <option>"
msgstr ""
@ -3223,6 +3227,14 @@ msgctxt "TC_OPT_SHOWCFG"
msgid "list the current configuration settings"
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"
msgid "force tags to upper case"
msgstr ""
@ -3402,48 +3414,71 @@ 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.
#. - %s represents either a blank line, or TC_TXT_HELP_3A explaining environment options.
#, c-format
msgctxt "TC_TXT_HELP_3"
msgid ""
"\n"
"Tidy Configuration Options\n"
"==========================\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"
" Use Tidy's configuration options as command line arguments in the form\n"
" of \"--some-option <value>\", for example, \"--indent-with-tabs yes\".\n"
"\n"
"For a list of all configuration options, use \"-help-config\" or refer\n"
"to the man page (if your OS has one).\n"
" You can also specify a file containing configuration options with the \n"
" -options <file> directive, or in one or more files specific to your \n"
" environment (see next section). \n"
"\n"
"If your environment has an $HTML_TIDY variable set point to a Tidy \n"
"configuration file then Tidy will attempt to use it.\n"
" For a list of all configuration options, use \"-help-config\" or refer\n"
" to the man page (if your OS has one).\n"
"\n"
"On some platforms Tidy will also attempt to use a configuration specified \n"
"in /etc/tidy.conf or ~/.tidy.conf.\n"
"Configuration Files\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"
"Other\n"
"=====\n"
"Input/Output default to stdin/stdout respectively.\n"
" Input/Output default to stdin/stdout respectively.\n"
"\n"
"Single letter options apart from -f may be combined\n"
"as in: tidy -f errs.txt -imu foo.html\n"
" Single letter options apart from -f may be combined\n"
" as in: tidy -f errs.txt -imu foo.html\n"
"\n"
"Information\n"
"===========\n"
"For more information about HTML Tidy, see\n"
" For more information about HTML Tidy, see\n"
" http://www.html-tidy.org/\n"
"\n"
"For more information on HTML, see the following:\n"
" For more information on HTML, see the following:\n"
"\n"
" HTML: Edition for Web Authors (the latest HTML specification)\n"
" http://dev.w3.org/html5/spec-author-view\n"
" HTML: Edition for Web Authors (the latest HTML specification)\n"
" http://dev.w3.org/html5/spec-author-view\n"
"\n"
" HTML: The Markup Language (an HTML language reference)\n"
" http://dev.w3.org/html5/markup/\n"
" HTML: The Markup Language (an HTML language reference)\n"
" http://dev.w3.org/html5/markup/\n"
"\n"
"File bug reports at https://github.com/htacg/tidy-html5/issues/\n"
"or send questions and comments to public-htacg@w3.org.\n"
" File bug reports at https://github.com/htacg/tidy-html5/issues/\n"
" or send questions and comments to public-htacg@w3.org.\n"
"\n"
"Validate your HTML documents using the W3C Nu Markup Validator:\n"
" http://validator.w3.org/nu/\n"
" Validate your HTML documents using the W3C Nu Markup Validator:\n"
" http://validator.w3.org/nu/\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.
#. - 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 ""
@ -3477,6 +3512,54 @@ msgctxt "TC_TXT_HELP_CONFIG_ALLW"
msgid "Allowable values"
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.
#. - The strings "Tidy" and "HTML Tidy" are the program name and must not be translated.
msgctxt "TC_TXT_HELP_LANG_1"

View file

@ -26,6 +26,9 @@
-->
<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: -->
<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
(defined with -DTIDY_CONFIG_FILE), but before any of the files specified
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"
.IP 0
All input files were processed successfully.

View file

@ -722,7 +722,7 @@ static ctmbstr ExpandTilde( TidyDocImpl* doc, ctmbstr filename )
while ( *s && *s != '/' )
s++;
if ( t = TidyDocAlloc(doc, s - filename) )
if ( (t = TidyDocAlloc(doc, s - filename)) )
{
memcpy(t, filename+1, s-filename-1);
t[s-filename-1] = 0;

View file

@ -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_HELP, 0, "list the command line 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_IBM858, 0, "use IBM-858 (CP850+Euro) for input, US-ASCII for output" },
{ 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_SHIFTJIS, 0, "use Shift_JIS for both input and output" },
{ 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_UTF16, 0, "use UTF-16 for both input and output" },
{ TC_OPT_UTF16BE, 0, "use UTF-16BE for both input and output" },
@ -2230,48 +2233,67 @@ static languageDefinition language_en = { whichPluralForm_en, {
"Command Line Arguments for HTML Tidy:"
},
{/* 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,
"\n"
"Tidy Configuration Options\n"
"==========================\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"
" Use Tidy's configuration options as command line arguments in the form\n"
" of \"--some-option <value>\", for example, \"--indent-with-tabs yes\".\n"
"\n"
"For a list of all configuration options, use \"-help-config\" or refer\n"
"to the man page (if your OS has one).\n"
" You can also specify a file containing configuration options with the \n"
" -options <file> directive, or in one or more files specific to your \n"
" environment (see next section). \n"
"\n"
"If your environment has an $HTML_TIDY variable set point to a Tidy \n"
"configuration file then Tidy will attempt to use it.\n"
" For a list of all configuration options, use \"-help-config\" or refer\n"
" to the man page (if your OS has one).\n"
"\n"
"On some platforms Tidy will also attempt to use a configuration specified \n"
"in /etc/tidy.conf or ~/.tidy.conf.\n"
"Configuration Files\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"
"Other\n"
"=====\n"
"Input/Output default to stdin/stdout respectively.\n"
" Input/Output default to stdin/stdout respectively.\n"
"\n"
"Single letter options apart from -f may be combined\n"
"as in: tidy -f errs.txt -imu foo.html\n"
" Single letter options apart from -f may be combined\n"
" as in: tidy -f errs.txt -imu foo.html\n"
"\n"
"Information\n"
"===========\n"
"For more information about HTML Tidy, see\n"
" For more information about HTML Tidy, see\n"
" http://www.html-tidy.org/\n"
"\n"
"For more information on HTML, see the following:\n"
" For more information on HTML, see the following:\n"
"\n"
" HTML: Edition for Web Authors (the latest HTML specification)\n"
" http://dev.w3.org/html5/spec-author-view\n"
" HTML: Edition for Web Authors (the latest HTML specification)\n"
" http://dev.w3.org/html5/spec-author-view\n"
"\n"
" HTML: The Markup Language (an HTML language reference)\n"
" http://dev.w3.org/html5/markup/\n"
" HTML: The Markup Language (an HTML language reference)\n"
" http://dev.w3.org/html5/markup/\n"
"\n"
"File bug reports at https://github.com/htacg/tidy-html5/issues/\n"
"or send questions and comments to public-htacg@w3.org.\n"
" File bug reports at https://github.com/htacg/tidy-html5/issues/\n"
" or send questions and comments to public-htacg@w3.org.\n"
"\n"
"Validate your HTML documents using the W3C Nu Markup Validator:\n"
" http://validator.w3.org/nu/\n"
" Validate your HTML documents using the W3C Nu Markup Validator:\n"
" http://validator.w3.org/nu/\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.
@ -2293,6 +2315,44 @@ static languageDefinition language_en = { whichPluralForm_en, {
{ TC_TXT_HELP_CONFIG_NAME, 0, "Name" },
{ TC_TXT_HELP_CONFIG_TYPE, 0, "Type" },
{ 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.
- The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. */
TC_TXT_HELP_LANG_1, 0,