Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to HTML Tidy 5.3.1 #4

Closed
wants to merge 32 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
2780b40
correct submodule repo
geoffmcl Jun 2, 2015
b07999b
Update tim-html5 to 4.9.30
geoffmcl Jun 2, 2015
ef4158b
Small update in About box
geoffmcl Jun 2, 2015
6ccea96
Swing over to using CMake
geoffmcl Jun 2, 2015
d5e6a4f
add convenient out of source build folder
geoffmcl Jun 2, 2015
c2d493c
Update tidy-html5 source
geoffmcl Jun 2, 2015
e853cca
some updates to the readme.md
geoffmcl Jun 2, 2015
e226e37
remove current solution file. Now generated by cmake
geoffmcl Jun 2, 2015
c457d2e
clean up the Tidy2\ReadMe.txt
geoffmcl Jun 2, 2015
3779b26
Add some sample tidy configs
geoffmcl Jun 2, 2015
8dcb853
Add more on installation
geoffmcl Jun 2, 2015
006186e
fix typo
geoffmcl Jun 2, 2015
933514d
Allow for finding tidy library external
geoffmcl Jun 6, 2015
ee67d54
ignore built components
geoffmcl Jun 6, 2015
8cb4cb4
Some notes on using tidy library
geoffmcl Jun 6, 2015
6142f05
Update tidy-html5
geoffmcl Jun 6, 2015
2e20537
Update About dialog with current Tidy 5.3.1 version.
geoffmcl Jun 15, 2016
0591267
Update to current version
geoffmcl Jun 15, 2016
cdea94c
Update readme.md
Jan 14, 2017
49998da
Issue #2 - Update to Tidy 5.5.24 20170517
geoffmcl May 17, 2017
fb9dbe9
Ignore MCVC14 database - closes #2
geoffmcl May 17, 2017
87e3ebc
Issue #2 - tried to go further, adding a 'version.txt'
geoffmcl May 18, 2017
006de37
Issue #2 - but all attempts to use the TIDY2_VERSION define failed
geoffmcl May 18, 2017
29f5c4f
Issue #2 - Gave up on external version/date and manually fixed
geoffmcl May 19, 2017
5b491e7
ignore all 'temp*' items
geoffmcl May 19, 2017
79d2bd6
Small update of readme.md, about using external HTML Tidy
geoffmcl May 19, 2017
a91f730
Issue #3 - Small change to build in 64-bits
geoffmcl Dec 7, 2017
7c82aae
Issue #3 - Add convenient build-me.bat for 64-bits
geoffmcl Dec 7, 2017
5216237
Issue #3 - Ignore built components
geoffmcl Dec 7, 2017
c912b15
Issue #3 - Beef up the readme.md for a 64-bit build
geoffmcl Dec 7, 2017
badff32
Issue #3 - Correct project name.
geoffmcl Dec 7, 2017
a537c7f
Issue #3 - small fix to build with MSVC10
geoffmcl Dec 9, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ ipch/
[Rr]elease*/
_ReSharper*/
[Tt]est[Rr]esult*
temp*
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "tidy-html5"]
path = tidy-html5
url = git://github.com/w3c/tidy-html5.git
url = git@github.com:htacg/tidy-html5.git
221 changes: 221 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
# CMakeLists.txt generated 2015/06/02 14:25:36
# by vcproj05.pl from F:\Projects\npptidy2\Tidy2.sln

# local CMake Scripts.
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMakeModules )

cmake_minimum_required (VERSION 2.8.8)

project (Tidy2)

option( USE_EXTERNAL_TIDY "Set OFF to not search for an installed lib tidy." ON )
option( USE_SUBDIRECTORY "Set OFF to comile directly from this root CMakeLists.txt." ON )

file(READ version.txt versionFile)
if (NOT versionFile)
message(FATAL_ERROR "Unable to determine Tidy2 version. version.txt file is missing.")
endif()

string(STRIP "${versionFile}" VERSION_TEXT)
string(REGEX REPLACE "(.*)[\r\n|\n](.*)" "\\1" TIDY2_VERSION ${VERSION_TEXT})
string(REGEX REPLACE "(.*)[\r\n|\n](.*)" "\\2" TIDY2_DATE ${VERSION_TEXT})

# establish version number
if (TIDY2_VERSION)
add_definitions( -DTIDY2_VERSION="${TIDY2_VERSION}" )
else ()
message(FATAL_ERROR "*** FAILED to get TIDY2_VERSION from version.txt!")
endif ()
# establish version date
if (TIDY2_DATE)
add_definitions( -DTIDY2_DATE="${TIDY2_DATE}" )
else ()
message(FATAL_ERROR "*** FAILED to get TIDY2_DATE from version.txt!")
endif ()

# Setup MSVC 3rd party directories if available and needed
# include( ConfigureMsvc3rdParty )

if(CMAKE_COMPILER_IS_GNUCXX)
set(WARNING_FLAGS_CXX "-Wall")
set(WARNING_FLAGS_C "-Wall")
endif(CMAKE_COMPILER_IS_GNUCXX)

if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set (WARNING_FLAGS_CXX "-Wall -Wno-overloaded-virtual")
set (WARNING_FLAGS_C "-Wall")
endif()

if(WIN32 AND MSVC)
set(MSVC_FLAGS "-DNOMINMAX -D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS -D__CRT_NONSTDC_NO_WARNINGS")
# turn off various warnings
# foreach(warning 4244 4251 4267 4275 4290 4786 4305 4996)
# set(MSVC_FLAGS "${MSVC_FLAGS} /wd${warning}")
# endforeach()
#if (${MSVC_VERSION} EQUAL 1600)
# set( MSVC_LD_FLAGS "/FORCE:MULTIPLE" )
#endif ()
#set(NOMINMAX 1)
# to distinguish between debug and release lib in windows
set( CMAKE_DEBUG_POSTFIX "d" )
list( APPEND add_LIBS Shlwapi )
endif()

# Uncomment to REDUCE the Windows configurations buildable
# set(CMAKE_CONFIGURATION_TYPES "Release;Debug" CACHE STRING "" FORCE) # Disables MinSizeRel & MaxSpeedRel

set (BOOST_CXX_FLAGS "-DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION -DBOOST_BIMAP_DISABLE_SERIALIZATION")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS_C} ${MSVC_FLAGS} -D_REENTRANT")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS_CXX} ${MSVC_FLAGS} -D_REENTRANT ${BOOST_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${MSVC_LD_FLAGS}")

if (USE_EXTERNAL_TIDY)
# TIDY_FOUND - True if tidy found.
# TIDY_INCLUDE_DIRS - where to find tidy.h, etc.
# TIDY_LIBRARIES - List of libraries when using tidy.
find_package( Tidy )
if (TIDY_FOUND)
message(STATUS "*** Found EXTERNAL Tidy lib ${TIDY_LIBRARIES} inc ${TIDY_INCLUDE_DIRS}")
list( APPEND add_LIBS ${TIDY_LIBRARIES} )
include_directories( ${TIDY_INCLUDE_DIRS} )
else ()
message(STATUS "*** External Tidy library NOT FOUND" )
endif ()
endif ()

if (NOT TIDY_FOUND)
# =======================================================================
# =======================================================================
if (USE_SUBDIRECTORY)
###########################################################################
add_subdirectory( tidy-html5 ) # Needed modifcation to remove CPack etc...
###########################################################################
else ()
###########################################################################
set(LIB_NAME tidy5)

file(READ tidy-html5/version.txt versionFile)
if (NOT versionFile)
message(FATAL_ERROR "Unable to determine libtidy version. version.txt file is missing.")
endif()
string(STRIP "${versionFile}" LIBTIDY_VERSION)
string(REPLACE "." ";" VERSION_LIST ${LIBTIDY_VERSION})
list(GET VERSION_LIST 0 TIDY_MAJOR_VERSION)
list(GET VERSION_LIST 1 TIDY_MINOR_VERSION)
list(GET VERSION_LIST 2 TIDY_POINT_VERSION)

add_definitions ( -DSUPPORT_UTF16_ENCODINGS=1 )
add_definitions ( -DSUPPORT_ASIAN_ENCODINGS=1 )
add_definitions ( -DSUPPORT_ACCESSIBILITY_CHECKS=1 )
add_definitions ( -DLIBTIDY_VERSION="${LIBTIDY_VERSION}" )

# Issue #188 - Support user items in platform.h
if (TIDY_CONFIG_FILE)
add_definitions( -DTIDY_CONFIG_FILE="${TIDY_CONFIG_FILE}" )
endif ()
if (TIDY_USER_CONFIG_FILE)
add_definitions( -DTIDY_USER_CONFIG_FILE="${TIDY_USER_CONFIG_FILE}" )
endif ()
if (SUPPORT_GETPWNAM)
add_definitions( -DSUPPORT_GETPWNAM=1 )
endif ()

### tidy library
# file locations
set ( SRCDIR tidy-html5/src )
set ( INCDIR tidy-html5/include )
# file lists
set ( CFILES
${SRCDIR}/access.c ${SRCDIR}/attrs.c ${SRCDIR}/istack.c
${SRCDIR}/parser.c ${SRCDIR}/tags.c ${SRCDIR}/entities.c
${SRCDIR}/lexer.c ${SRCDIR}/pprint.c ${SRCDIR}/charsets.c ${SRCDIR}/clean.c
${SRCDIR}/localize.c ${SRCDIR}/config.c ${SRCDIR}/alloc.c
${SRCDIR}/attrask.c ${SRCDIR}/attrdict.c ${SRCDIR}/attrget.c
${SRCDIR}/buffio.c ${SRCDIR}/fileio.c ${SRCDIR}/streamio.c
${SRCDIR}/tagask.c ${SRCDIR}/tmbstr.c ${SRCDIR}/utf8.c
${SRCDIR}/tidylib.c ${SRCDIR}/mappedio.c ${SRCDIR}/gdoc.c )
set ( HFILES
${INCDIR}/platform.h ${INCDIR}/tidy.h ${INCDIR}/tidyenum.h
${INCDIR}/buffio.h )
set ( LIBHFILES
${SRCDIR}/access.h ${SRCDIR}/attrs.h ${SRCDIR}/attrdict.h ${SRCDIR}/charsets.h
${SRCDIR}/clean.h ${SRCDIR}/config.h ${SRCDIR}/entities.h
${SRCDIR}/fileio.h ${SRCDIR}/forward.h ${SRCDIR}/lexer.h
${SRCDIR}/mappedio.h ${SRCDIR}/message.h ${SRCDIR}/parser.h
${SRCDIR}/pprint.h ${SRCDIR}/streamio.h ${SRCDIR}/tags.h
${SRCDIR}/tmbstr.h ${SRCDIR}/utf8.h ${SRCDIR}/tidy-int.h
${SRCDIR}/version.h ${SRCDIR}/gdoc.h )
if (MSVC)
list(APPEND CFILES ${SRCDIR}/sprtf.c)
list(APPEND LIBHFILES ${SRCDIR}/sprtf.h)
endif ()
#######################################
# Always build the STATIC library
set(name tidy-static)
add_library ( ${name} STATIC ${CFILES} ${HFILES} ${LIBHFILES} )
set_target_properties( ${name} PROPERTIES
OUTPUT_NAME ${LIB_NAME}s
)
list ( APPEND add_LIBS ${name} )
###########################################################################
endif ()
include_directories( tidy-html5/include )

# =======================================================================
# =======================================================================
endif ()

# Adding 2 of 7 defines indicated.
add_definitions(
-DTIDY2_EXPORTS
-DTIDY_STATIC
-DUNICODE
-D_UNICODE
)

# Add 3 include directories indicated
include_directories(
Tidy2
Tidy2/NppInterface
)

### 1 DLL #############################################
# Project [Tidy2], type [Application], 6 C/C++, 12 Hdrs, 0 Other, 0 INCS, 7 DEFS
# File dir [F:\Projects\npptidy2\Tidy2\], out [F:\Projects\npptidy2], rel = [Tidy2\]
# tidy-html5/include/tidy.h
set(name Tidy2)
set(dir Tidy2)
set( ${name}_SRCS
${dir}/AboutDialog.cpp
${dir}/NppInterface/StaticDialog.cpp
${dir}/PluginMain.cpp
${dir}/VersionAndAbout.rc
${dir}/dllmain.cpp
${dir}/stdafx.cpp
)
set( ${name}_HDRS
${dir}/AboutDialog.h
${dir}/NppInterface/Notepad_plus_msgs.h
${dir}/NppInterface/PluginInterface.h
${dir}/NppInterface/Scintilla.h
${dir}/NppInterface/StaticDialog.h
${dir}/NppInterface/Window.h
${dir}/PluginDetails.h
${dir}/PluginMain.h
${dir}/resource.h
${dir}/stdafx.h
${dir}/targetver.h )
add_library( ${name} SHARED ${${name}_SRCS} ${${name}_HDRS} )
target_link_libraries( ${name} ${add_LIBS} )
message(STATUS "*** target_link_libraries( ${name} ${add_LIBS} )")
###list(APPEND add_LIBS ${name})

# deal with install, if required
# install(TARGETS ${inst_LIBS}
# RUNTIME DESTINATION bin
# LIBRARY DESTINATION lib
# ARCHIVE DESTINATION lib )
# install(TARGETS ${inst_BINS} DESTINATION bin)
# install(FILES ${inst_HDRS} DESTINATION include)

# eof
111 changes: 111 additions & 0 deletions CMakeModules/FindTidy.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# Find Tidy
# Find the native TIDY includes and library.
# Once done this will define
#
# TIDY_FOUND - True if tidy found.
# TIDY_INCLUDE_DIRS - where to find tidy.h, etc.
# TIDY_LIBRARIES - List of libraries when using tidy.
#
# An includer may set TIDY_ROOT to a Tidy installation root to tell
# this module where to look.
#

set(_TIDY_SEARCHES ${CMAKE_INSTALL_PREFIX})

# Search TIDY_ROOT first if it is set.
if (TIDY_ROOT)
set(_TIDY_SEARCH_ROOT PATHS ${TIDY_ROOT})
list(APPEND _TIDY_SEARCHES ${_TIDY_SEARCH_ROOT})
endif()
set( _TIDY_ROOT $ENV{TIDY_ROOT} )
if (_TIDY_ROOT)
list(APPEND _TIDY_SEARCHES ${_TIDY_ROOT})
endif ()

set(TIDY_NAMES tidy tidy5)

if (_TIDY_SEARCHES)
# Try each search configuration.
message(STATUS "+++ Search using paths ${_TIDY_SEARCHES}")
if (MSVC)
foreach(search ${_TIDY_SEARCHES})
find_path(TIDY_INCLUDE_DIR
NAMES tidy.h
PATHS ${search}
PATH_SUFFIXES include
)
# search for the STATIC version first
find_library(TIDY_LIBRARY_DBG
NAMES tidy5sd tidysd
PATHS ${search}
PATH_SUFFIXES lib
)
find_library(TIDY_LIBRARY_REL
NAMES tidy5s tidys
PATHS ${search}
PATH_SUFFIXES lib
)
endforeach()
if (TIDY_LIBRARY_DBG AND TIDY_LIBRARY_REL)
set(TIDY_LIBRARY
debug ${TIDY_LIBRARY_DBG}
optimized ${TIDY_LIBRARY_REL}
)
elseif (TIDY_LIBRARY_REL)
set(TIDY_LIBRARY ${TIDY_LIBRARY_REL} )
endif ()
if (NOT TIDY_LIBRARY)
foreach(search ${_TIDY_SEARCHES})
find_path(TIDY_INCLUDE_DIR
NAMES tidy.h
PATHS ${search}
PATH_SUFFIXES include
)
find_library(TIDY_LIBRARY
NAMES ${TIDY_NAMES}
PATHS ${search}
PATH_SUFFIXES lib
)
endforeach()
endif ()
else ()
foreach(search ${_TIDY_SEARCHES})
find_path(TIDY_INCLUDE_DIR
NAMES tidy.h
PATHS ${search}
PATH_SUFFIXES include
)
find_library(TIDY_LIBRARY
NAMES ${TIDY_NAMES}
PATHS ${search}
PATH_SUFFIXES lib
)
endforeach()
endif ()

else ()
message(STATUS "+++ Default search with no search paths")
find_path(TIDY_INCLUDE_DIR
NAMES tidy.h
PATH_SUFFIXES include
)
find_library(TIDY_LIBRARY
NAMES ${TIDY_NAMES}
PATH_SUFFIXES lib
)
endif ()
###mark_as_advanced(TIDY_LIBRARY TIDY_INCLUDE_DIR)

# handle the QUIETLY and REQUIRED arguments and set TIDY_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)

FIND_PACKAGE_HANDLE_STANDARD_ARGS(TIDY REQUIRED_VARS TIDY_LIBRARY TIDY_INCLUDE_DIR
VERSION_VAR TIDY_VERSION_STRING)

if(TIDY_FOUND)
set(TIDY_INCLUDE_DIRS ${TIDY_INCLUDE_DIR})
set(TIDY_LIBRARIES ${TIDY_LIBRARY})
endif()

# eof
17 changes: 17 additions & 0 deletions README.tidy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# README.tidy.md

THe first search is for an extern tidy library, if USE_EXTERNAL_TIDY is left ON by default.

If such an 'external' tidy library is NOT found, then the source in the submodule will be used.

To use the tidy-html5 submodule, on the first clone of this repo need to use -

`git submodule init`

To update to the latest tidy-html5 source...

`git submodule foreach git pull origin master`

This did nothing: `git submodule update --recursive`

; eof
29 changes: 0 additions & 29 deletions Tidy2.sln

This file was deleted.