Merge branch 'next' into issue-692

This commit is contained in:
Jim Derry 2021-06-30 09:08:04 -04:00
commit 64784e2582
1451 changed files with 35837 additions and 301 deletions

101
.github/workflows/build_and_test.yml vendored Normal file
View file

@ -0,0 +1,101 @@
################################################################################
# Build and Test tidy on the latest versions of all of the major platforms.
#
# - Build on multiple operating systems, and where possible, multiple
# architectures. On Windows, we will also build and test MingGW in
# addition to MSVC.
#
# - Report the version number for each binary that is built.
#
# - Run each binary against the regression test suite.
#
################################################################################
name: Build and Test
on:
push:
paths:
- 'src/**'
- 'include/**'
- '.github/workflows/**'
pull_request:
paths:
- 'src/**'
- 'include/**'
- '.github/workflows/**'
jobs:
build_and_test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
flags:
vers_command: "./tidy --version"
test_command: "ruby test.rb test"
- os: macOS-latest
flags: "'-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64'"
vers_command: "./tidy --version"
test_command: "ruby test.rb test"
- os: windows-latest
flags:
vers_command: "./tidy.exe --version"
test_command: "ruby test.rb test"
- os: windows-2016
flags: "-G 'MinGW Makefiles'"
vers_command: "./tidy --version"
test_command: "ruby test.rb test"
steps:
- uses: actions/checkout@v2
# We'll use the windows-2016 instance to perform a MinGW build.
# Of course, we only want to install if this is the correct target.
- name: Install MinGW-w64
if: ${{matrix.os == 'windows-2016'}}
uses: egor-tensin/setup-mingw@v2
with:
platform: x64
- name: Build
working-directory: ${{github.workspace}}/build/cmake
run: cmake ../.. -DCMAKE_BUILD_TYPE=Release ${{matrix.flags}}
- name: Make
working-directory: ${{github.workspace}}/build/cmake
run: cmake --build . --config Release
# Windows MSVC is the only oddball here; why does it install the
# binary into a subfolder, unlike all of the other builds? Let's
# make everything else easier by relocating it to the same spot
# as all the other build locations.
- name: Move the exe to someplace sensible
if: ${{matrix.os == 'windows-latest'}}
run: move-item -path "${{github.workspace}}/build/cmake/Release/tidy.exe" -destination "${{github.workspace}}/build/cmake/"
- name: Show Version
working-directory: ${{github.workspace}}/build/cmake
run: ${{matrix.vers_command}}
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true
- name: Bundle Install
working-directory: ${{github.workspace}}/regression_testing
run: bundle install
- name: Run Regression Test
working-directory: ${{github.workspace}}/regression_testing
run: ${{matrix.test_command}}

1
.gitignore vendored
View file

@ -16,3 +16,4 @@ temp*
.DS_Store
.idea
*.old
/regression_testing/cases/*-results/

View file

@ -394,7 +394,11 @@ install(TARGETS ${name}
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
)
install( FILES ${HFILES} DESTINATION ${INCLUDE_INSTALL_DIR} )
if(MSVC)
# install(FILES $<TARGET_PDB_FILE:${name}> DESTINATION lib OPTIONAL)
INSTALL(FILES ${PROJECT_BINARY_DIR}/${name}.dir/Debug/${name}.pdb
DESTINATION lib CONFIGURATIONS Debug )
endif()
#------------------------------------------------------------------------
# Dynamic Library
@ -412,9 +416,7 @@ if (BUILD_SHARED_LIB)
VERSION ${LIBTIDY_VERSION}
SOVERSION ${TIDY_MAJOR_VERSION} )
set_target_properties( ${name} PROPERTIES
COMPILE_FLAGS "-DBUILD_SHARED_LIB" )
set_target_properties( ${name} PROPERTIES
COMPILE_FLAGS "-DBUILDING_SHARED_LIB" )
COMPILE_FLAGS "-DBUILD_SHARED_LIB -DBUILDING_SHARED_LIB")
install(TARGETS ${name}
RUNTIME DESTINATION ${BIN_INSTALL_DIR}
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
@ -439,6 +441,14 @@ if (SUPPORT_CONSOLE_APP)
if (MSVC)
set_target_properties( ${name} PROPERTIES DEBUG_POSTFIX d )
endif ()
if (APPLE)
string(TIMESTAMP CURRENT_YEAR "%Y")
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/console/Info.plist.in
${CMAKE_CURRENT_BINARY_DIR}/Info.plist
)
target_link_options(${name} PRIVATE LINKER:-sectcreate,__TEXT,__info_plist,Info.plist)
endif ()
if (NOT TIDY_CONSOLE_SHARED)
set_target_properties( ${name} PROPERTIES
COMPILE_FLAGS "-DTIDY_STATIC" )

View file

@ -32,13 +32,14 @@ When youre ready to add a great new feature, these write-ups may be useful.
- Discover how to add new tags to Tidy in [README/TAGS.md][130].
- If you want to add new messages to Tidy, read [README/MESSAGE.md][150].
- Configuration options can be added according to [README/OPTIONS.md][155].
- Pull Requests must pass all existing regression tests, or you must change existing regression test expectations with a good explanation. New features require that you add new regression tests. See [README/TESTING.md][165] for more details.
### Language Localization Guides
Tidy supports localization, and welcomes translations into various languages. Please read up on how to localize HTML Tidy.
- The general README for localizing can be found in [/README/LOCALIZE.md][140].
- And [/localize/README.md][145] contains specific instructions for localizing.
- The general README for localizing can be found in [README/LOCALIZE.md][140].
- And [localize/README.md][145] contains specific instructions for localizing.
## Other Important Links
@ -88,9 +89,10 @@ HTML Tidy and LibTidy are free and open source software with a permissive licens
[125]: README/CONTRIBUTING.md
[130]: README/TAGS.md
[135]: README/LICENSE.md
[140]: /README/LOCALIZE.md
[145]: /localize/README.md
[140]: README/LOCALIZE.md
[145]: localize/README.md
[150]: README/MESSAGE.md
[155]: README/OPTIONS.md
[160]: README/VERSION.md
[165]: README/TESTING.md

View file

@ -6,7 +6,7 @@ Starting with **HTML Tidy** 5.4.0, HTACG will adopt a new branch management stra
As described thoroughly in our [VERSION.md](VERSION.md) document, this means that **master** will always consist of an even-numbered minor version, and activity will remain relatively quiet unless we backport a critical bug fix from **next**.
The **next** branch, then will host the majority of our development activity, and any contributions and PRs should be again this branch. This means that **next** will always consist of an odd minor version number.
The **next** branch, then will host the majority of our development activity, and any contributions and PRs should be against this branch. This means that **next** will always consist of an odd minor version number.
## About Versioning

View file

@ -50,7 +50,7 @@ See the `CMakeLists.txt` file for other CMake **options** offered.
## Build PHP with the tidy-html5 library
Due to API changes in the PHP source, `buffio.h` needs to be renamed to `tidybuffio.h` in the file `ext/tidy/tidy.c` in PHP's source.
Before PHP 7.1, due to API changes in the PHP source, `buffio.h` needs to be renamed to `tidybuffio.h` in the file `ext/tidy/tidy.c` in PHP's source.
That is - prior to configuring PHP run this in the PHP source directory:
~~~

View file

@ -6,16 +6,18 @@ So you want to contribute to Tidy? Fantastic! Here's a brief overview on how bes
If you are having trouble running console `Tidy`, or using the `LibTidy` API in your own project, then maybe the best places to get help is either via a comment in [Tidy Issues](https://github.com/htacg/tidy-html5/issues), or on the [Tidy Mail Archive](https://lists.w3.org/Archives/Public/html-tidy/) list.
And please do a **search** using different **key** words - see [searching](https://help.github.com/articles/searching-issues-and-pull-requests/) - to make sure it is **not** a duplicate. If something similar has been discussed before, but you still feel this is **different**, then add that related reference in your post...
In either place please start with a short subject to describe the issue. If it involves running Tidy on an html file, or if its an API question, make sure to include:
- the version: `$ tidy -v`
- what was the configuration used
- a small sample input
- the output
- the _expected_ output expected
- the _expected_ output
- some sample code (if an API question).
These data will make replication of your issue much simpler for us.
This information will make replication of your issue much simpler for us.
If you do add sample HTML input, then it can also be very helpful if that sample **passes** the W3C [validator](https://validator.w3.org/#validate_by_upload). Tidy attempts to follow all current W3C standards.
@ -39,17 +41,25 @@ Concerning the “Tidy Code Style,” checkout [CODESTYLE.md](CODESTYLE.md), but
### Using Git appropriately
1. Fork the repository to your GitHub account.
2. Optionally create a **topical branch**, a branch whose name is succint but explains what you're doing, such as "feature/add-new-lines".
3. Make your changes, committing at logical breaks.
4. Push your work to your personal account.
5. [Create a pull request](https://help.github.com/articles/using-pull-requests).
6. Watch for comments or acceptance.
1. Fork tidy to your own github account. Use top right `Fork` icon.
2. Optional: Generate a SSH Key, and add it to your `https://github.com/<name>` settings, SSH and GPG keys
3. Clone your own fork - `$ git clone git@github.com:<name>/tidy-html5.git [tidy-fork]` Or using `https`.
4. Create a branch - `$ cd tidy-fork; $ git checkout -b <branch-name>`
5. Edit, and commit your changes to this `branch` of your fork.
6. Test your changes, and if appropriate run [regression](https://github.com/htacg/tidy-html5-tests/blob/next/README/RUNTESTS.md) tests.
7. Publish the branch - `$ git push -u origin <branch-name.` - to your remote fork.
8. Create a [Pull Request](https://help.github.com/articles/about-pull-requests/), a **PR**, here.
9. Watch for comments, acceptance.
Please note - if you want to change multiple things that don't depend on each
other, it is better to use `branches`, and make sure you check the master branch back out before making more changes - that way we can take in each change seperately, otherwise Github has a tendancy to combine your requests into one.
Item 2., SSH Key, is optional, and only required if you want to use `clone git@github.com...`. And if you generate the ssh without a `passphrase`, things like `git push` can be done without a password. Just convenience. Alternatively you can use the `HTTPS` protocol...
If you are a continuing contributor then you will need to `rebase` your fork, to htacg `next`, **before** doing any more work, and likewise branches, otherwise we may not be able to cleanly merge your PR. This is a simple process:
Concerning 5., editing and committing your changes, **generally** it is better to `commit` changes often, adding an appropriate commit message to each, like `$ git commit -m "Is. #NNN - reason for change" <file[s]>`. This also aids in the **PR** review.
But the situation varies. Like adding say an option, which can mean several files have to be edited, where it is likely appropriate to combine a considerable number of edits into one commit. There can be no hard and fast rules on this.
Please note, if you want to change **multiple** things that don't depend on each other, use **different** `branches`, and make sure you check the `next` branch back out, before making more changes in a **new** branch name. That way we can take in each **change** separately, otherwise Github will **combine** all your branch commits into one **PR**.
See below on keeping your forks `next` fully in sync with here, called `upstream` - **this is important**.
```
$ git remote add upstream git@github.com:htacg/tidy-html5.git # once only
@ -62,8 +72,28 @@ $ git stash pop # if required, and fix conflicts
$ git push # update the fork next
```
This can be repeated for other branches, too.
This has to be repeated for other branches, too. `$ git checkout <your-branch>`, `$ git rebase next`, fix conflict, if any, and `$ git push`, for **each** branch. It is **not** fun to keep multiple `branches` fully up-to-date with an active `upstream`...
Of course, the **regression** tests, 6., are really only if you have made `code` changes, but it is a good habit to get into. As can be seen the `tests` are in a **separate** repo, so you must also clone that, or **fork** and clone that, to be able to present a **PR**. This is best done in the same `root` folder where where you cloned `tidy-html5`, and your `tidy-fork`. See [RUNTESTS.md](https://github.com/htacg/tidy-html5-tests/blob/next/README/RUNTESTS.md).
In brief, for unix, to use your potentially **new** `tidy-fork` tidy executable -
```
$ git clone git@github.com:htacg/tidy-html5-tests.git
$ cd tidy-html5-tests/tools-sh
$ ./testall.sh ../../tidy-fork/build/cmake/tidy
$ diff -u ../cases/testbase-expects ../cases/testbase-results
```
Use folder `tools-cmd` for windows. Run `alltest.bat --help`.
If the `tests` shows a different exit value, or there are differences between the `expects` and `results`, these **must** be studied, and checked, very carefully. There may be cases where the **new** `results` are correct, in which case a simultaneous **PR** for the forked `tests` **must** be created to match your forked source **PR**.
Do **NOT** change either the root `version.txt` here, nor the `cases/_version.txt` in `tests`. This will be handled by the person that does the **PR** merge. To differentiate your modified `tidy` there is a cmake option, like `-DTIDY_RC_NUMBER=I123`, which will appear in `tidy -v` as `5.7.16.I123`. The number can be anything, but using the relevant issue value is a good choice.
Add an `issue` if you need further **help**... thanks...
### Help Tidy Get Better
It goes without saying **all help is appreciated**. We need to work together to make Tidy better!

46
README/RELEASE.md Normal file
View file

@ -0,0 +1,46 @@
# HTACG HTML Tidy
The **Release Process** is made up of many little steps. These have been documented before in issues like [394-1](https://github.com/htacg/tidy-html5/issues/394#issuecomment-206952915), and [394-2](https://github.com/htacg/tidy-html5/issues/394#issuecomment-207814834), and others, but this is to further **document** the process...
This assumes the current `next` branch is version 5.7.XXX. See VERSION.md for chosen version scheme.
## Release Process for 5.8.0
### Lead up:
- Create the next release milestone, 5.10, if not already done...
- Decide on PR's to include, bumping version.txt, accordingly...
- Decide on any show-stopper outstanding issues, and action...
- Change milestone of all excluded this time issues to the next 5.10 milestone, or to indefinite...
- Decide target date for release...
### The Release:
1. Update version.txt to 5.8.0, and date... commit
2. Create branch, `$ git checkout -b release/5.8`
3. Update README/vershist.log... perl script... commit
4. Add `$ git tag 5.8.0`
5. Publish `$ git push -u origin release/5.8 --tags`
6. Generate release 5.8.0.html... perl script... copy to...
7. Create Github release v5.8.0 - becomes [Latest Release](https://github.com/htacg/tidy-html5/releases)
8. Other things?
- Generate release binaries
- Add [binaries](http://binaries.html-tidy.org/)
- Add api [docs](http://api.html-tidy.org/#part_apiref)
- Update web pages [html-tidy.org](http://www.html-tidy.org/)
### Post:
- Update `master` branch to `release`
- Update `next` version.txt to 5.9.0, open for new fixes...
- Add more binaries...
## Notes on `Release Process`:
This **HTACG HTML Tidy** `official` release process must be supplemented with distribution by others.
Of course, if possible, we recomend building tidy from the git source, it is easy, but also in some OS'es others offer distribution in various ways...
See [Get Tidy](http://www.html-tidy.org/#homepage19700601get_tidy) - This page really needs expanding. There are some suggestions pending, and more feedback welcome...
; eof

72
README/TESTING.md Normal file
View file

@ -0,0 +1,72 @@
# Testing
Its critical that changes you introduce do not cause regressions, i.e., that
Tidys output remains consistent with the introduction of your changes, except
for very specific circumstances.
Additionally, changes that you introduce to Tidy must usually be accompanied by
one or more test cases demonstrating the new feature or changed behavior.
Both of these concerns can be addressed with the Tidy repositorys automated
regression testing features, which are enabled by Github Actions. Any pull
request you make will automatically test your PR against the existing set of
test cases, and any failures are prima facie grounds for rejecting the PR.
You _must_ test your changes locally using the tools and test cases provided in
the `regression_testing/` directory prior to submitting a PR, including adding
test cases to this directory as needed.
## Changes to Existing Output
If your changes affect existing output, its critical to understand _why_, and
if necessary, regenerate the `-expects` files so that the regression testing
tool will pass with your new changes. These `-expects` changes, of course,
become part of your Pull Request, and will be subject to review and conversation
in the Pull Request thread.
If you do cause such regressions, please be prepared to defend why they are
needed.
## New Tests
If youre adding new features to Tidy, code reviewers need to be able to see the
intended effect of your changes via some type of demonstration. As such, please
write at least one test case in `github-cases` and put the expected results in
`github-expects`. These also constitute a part of your Pull Request, and more
importantly, will become part of the standard regression testing suite once the
PR is merged.
Try to keep your test case(s) as succint as possible, and do try to put some HTML
comments in the file explaining the purpose of the test case, and if applicable,
the Github issue and/or PR number.
Note that the files generated in `github-results` for your new test cases are
suitable for use in `github-expects` when you are satisfied with the results.
A sample `case-123a@0.html` might represent issue #123, test **a** in a series
of multiple tests for this issue number, expecting Tidy exit code 0, and might
look something like this:
```
<!DOCTYPE html>
<html>
<!--
This test case represents HTML Tidy issue #123, and demonstrates
the use of new feature #xxx. Tidy should exit with status code 0.
The reason this change is needed is because WHATWG suddently
determined that a standards change #yyyy impacts us because of zzz.
-->
<head>
<title>Case #123a</title>
</head>
<p>The quick brown fox jumps over the lazy dog.<//p>
<body>
</body>
</html>
```
## Regression Testing Specifics
The regression testing mechanism is described more fully in [regression_testing/README.md](../regression_testing/README.md).

View file

@ -33,3 +33,4 @@ tidy1.xsl
tidy.pc
*.vcproj
.pkg
Info.plist

View file

@ -4,11 +4,15 @@
@set TMPPRJ=tidy
@set TMPSRC=..\..
@set TMPBGN=%TIME%
@set TMPINS=..\..\..\software
@set TMPINS=D:\Projects\3rdParty
@set TMPLOG=bldlog-1.txt
@set DOPAUSE=1
@set TMPGEN=Visual Studio 16 2019
@set TMPBR=next
@set TMPINDBG=0
@set TMPOPTS=-DCMAKE_INSTALL_PREFIX=%TMPINS%
@set TMPOPTS=-G "%TMPGEN%" -A Win32
@set TMPOPTS=%TMPOPTS% -DCMAKE_INSTALL_PREFIX=%TMPINS%
@set TMPOPTS=%TMPOPTS% -DBUILD_SHARED_LIB=ON
:RPT
@ -23,9 +27,11 @@
:GOTCMD
@call chkmsvc %TMPPRJ%
@call chkbranch master
@if "%TMPBR%x" == "x" goto DNBR
@call chkbranch %TMPBR%
:DNBR
@echo Build %DATE% %TIME% > %TMPLOG%
@echo Build %TMPPRJ% 32-bits %DATE% %TIME%, in %CD%, to %TMPLOG% > %TMPLOG%
@if NOT EXIST %TMPSRC%\nul goto NOSRC
@ -57,6 +63,11 @@
@call elapsed %TMPBGN%
@echo Appears a successful build... see %TMPLOG%
@echo Note install location %TMPINS%
@if "%TMPINDBG%x" == "1x" (
@echo Will install Debug and Release
) else {
@echo Will only intall Release
)
@echo.
@REM ##############################################
@ -86,10 +97,12 @@
:DOINST
@echo Proceeding with INSTALL...
@echo.
@if NOT "%TMPINDBG%x" == "1x" goto DNDBGIN
@echo Doing: 'cmake --build . --config Debug --target INSTALL'
@echo Doing: 'cmake --build . --config Debug --target INSTALL' >> %TMPLOG% 2>&1
@cmake --build . --config Debug --target INSTALL >> %TMPLOG% 2>&1
@if ERRORLEVEL 1 goto ERR4
:DNDBGIN
@echo Doing: 'cmake --build . --config Release --target INSTALL'
@echo Doing: 'cmake --build . --config Release --target INSTALL' >> %TMPLOG% 2>&1

139
build/cmake/gen-html.sh Executable file
View file

@ -0,0 +1,139 @@
#!/bin/sh
#< gen-html.sh 2021/03/26, from gen-html.bat
BN=`basename $0`
ask()
{
pause
if [ ! "$?" = "0" ]; then
exit 1
fi
}
# @REM Build HTML from log of 'version.txt'
# @REM Versify the tools used
echo "$BN: Doing: 'verhist.pl -? >/dev/null'"
verhist.pl -? >/dev/null
if [ ! "$?" = "0" ]; then
echo "Unable to run 'verhist.pl'! *** FIX ME ***"
exit 1
fi
echo "$BN: Doing: 'emailobfuscate.pl -? >/dev/null'"
emailobfuscate.pl -? >/dev/null
if [ ! "$?" = "0" ]; then
echo "Unable to run 'emailobfuscate.pl'! *** FIX ME ***"
exit 1
fi
TMPFIL1="../../version.txt"
if [ ! -f "$TMPFIL1" ]; then
echo "Can NOT locate $TMPFIL1, in $(pwd) - *** FIX ME ***"
exit 1
fi
echo "$BN: Doing: 'dirmin $TMPFIL1'"
ls -l "$TMPFIL1"
# TMPVER=$(cat $TMPFIL1)
TMPCNT=0
while read -r a; do
TMPCNT=`expr $TMPCNT + 1`;
if [ ! -z "$a" ]; then
echo "$TMPCNT: '$a'"
if [ "$TMPCNT" = "1" ]; then
export TMPVER="$a";
fi
break;
fi
done < $TMPFIL1
echo "Current version '$TMPVER' ..."
TMPLOG1="../../../temp-$TMPVER.log"
TMPLOG2="../../../temp2-$TMPVER.log"
TMPLOG3="../../../temp3-$TMPVER.log"
if [ ! -f "$TMPLOG1" ]; then
echo "$BN: Doing: 'git log -p $TMPFIL1 > $TMPLOG1'"
git log -p $TMPFIL1 > $TMPLOG1
if [ ! -f "$TMPLOG1" ]; then
echo "Gen of $TMPLOG1 FAILED! *** FIX ME ***"
exit 1
fi
fi
echo "$BN: Got log 1 '$TMPLOG1' ..."
ls -l "$TMPLOG1"
if [ ! -f "$TMPLOG2" ]; then
echo "$BN: Doing: 'verhist.pl $TMPLOG1 -o $TMPLOG2'"
verhist.pl $TMPLOG1 -o $TMPLOG2
if [ ! -f "$TMPLOG2" ]; then
echo "Gen of $TMPLOG2 FAILED! *** FIX ME ***"
exit 1
fi
fi
echo "$BN: Got log 2 '$TMPLOG2' ..."
ls -l $TMPLOG2
TMPV="$1"
if [ -z "$TMPV" ]; then
echo "Give the cut-off version, like 5.6.0, to continue.."
exit 1
fi
echo "$BN: Doing: 'grep $TMPV $TMPLOG2'"
grep $TMPV $TMPLOG2
if [ ! "$?" = "0" ]; then
echo "Failed to find '$TMPV'... check the file '$TMPLOG2'"
exit 1
fi
TMPD="$2"
if [ -z "$TMPD" ]; then
echo "Give the DATE of the cut-off, like 'Sat Nov 25 14:50:00 2017 +0100', to continue..."
exit 1
fi
if [ ! -f "$TMPLOG3" ]; then
echo "$BN: Doing: 'git log "--decorate=full" "--since=$TMPD" > $TMPLOG3'"
git log "--decorate=full" "--since=$TMPD" > $TMPLOG3
if [ ! -f "$TMPLOG3" ]; then
echo "Failed to generate 'git log ...' - *** FIX ME ***"
exit 1
fi
fi
echo "$BN: Got log 3 '$TMPLOG3' ..."
ls -l "$TMPLOG3"
# @REM at last generate the release HTML
TMPHTM="../../../temp-$TMPVER.html"
if [ ! -f "$TMPHTM" ]; then
echo "$BN: Doing: 'emailobfuscate.pl $TMPLOG3 -o $TMPHTM -a $TMPVER -i'"
emailobfuscate.pl $TMPLOG3 -o $TMPHTM -a $TMPVER -i
if [ ! -f "$TMPHTM" ]; then
echo "FAILED to generate $TMPHTM! *** FIX ME ***"
exit 1
fi
fi
echo "$BN: Got HTML file '$TMPHTM' ..."
ls -l "$TMPHTM"
echo "$BN: Generation appears ok, check file '$TMPHTM' in browser..."
### start $TMPHTM
TMPVFIL="../../README/verhist.log"
if [ ! -f "$TMPVFIL" ]; then
echo ""
echo "$BN: *** WARNING *** - Missing existing '$TMPVFIL'"
echo ""
fi
echo ""
echo "$BN: Is all OK, final actions, for release are -"
echo "copy $TMPLOG2 to $TMPVFIL - push this to repo..."
echo "copy $TMPHTM to the binaries repo..."
echo ""
# @REM eof

View file

@ -21,3 +21,5 @@ install_manifest.txt
_CPack_Packages/*
dir
*.VC.db
.vs/*
tidy.pc

View file

@ -0,0 +1,202 @@
@setlocal
@REM 20170702 - Check branch
@set TMPBR=next
@REM 20161002 - Change to msvc140 build
@set VCVERS=14
@set GENERATOR=Visual Studio %VCVERS% Win64
@REM 20160324 - Change to relative, and use choice
@set TMPPRJ=tidy
@echo Build %TMPPRJ% project, in 64-bits
@set TMPLOG=bldlog-1.txt
@set BLDDIR=%CD%
@set TMPROOT=..\..\..
@set SET_BAT=%ProgramFiles(x86)%\Microsoft Visual Studio %VCVERS%.0\VC\vcvarsall.bat
@if NOT EXIST "%SET_BAT%" goto NOBAT
@REM if NOT EXIST %TMPROOT%\nul goto NOROOT
@set TMPSRC=..\..
@if NOT EXIST %TMPSRC%\CMakeLists.txt goto NOCM
@set DOPAUSE=1
@if /I "%PROCESSOR_ARCHITECTURE%" EQU "AMD64" (
@set TMPINST=%TMPROOT%\software.x64
) ELSE (
@if /I "%PROCESSOR_ARCHITECTURE%" EQU "x86_64" (
@set TMPINST=%TMPROOT%\software.x64
) ELSE (
@echo ERROR: Appears 64-bit is NOT available... aborting...
@goto ISERR
)
)
@if NOT EXIST %TMPINST%\nul goto NOINST
@echo Doing build output to %TMPLOG%
@echo Doing build output to %TMPLOG% > %TMPLOG%
@echo Doing: 'call "%SET_BAT%" %PROCESSOR_ARCHITECTURE%'
@echo Doing: 'call "%SET_BAT%" %PROCESSOR_ARCHITECTURE%' >> %TMPLOG%
@call "%SET_BAT%" %PROCESSOR_ARCHITECTURE% >> %TMPLOG% 2>&1
@if ERRORLEVEL 1 goto ERR0
@REM call setupqt64
@cd %BLDDIR%
@REM :DNARCH
@REM ############################################
@REM NOTE: SPECIAL INSTALL LOCATION
@REM Adjust to suit your environment
@REM ##########################################
@REM set TMPINST=F:\Projects\software.x64
@set TMPOPTS=-DCMAKE_INSTALL_PREFIX=%TMPINST%
@set TMPOPTS=%TMPOPTS% -G "%GENERATOR%"
@REM set TMPOPTS=%TMPOPTS% -DTIDY_CONFIG_FILE="C:\MDOS\tidy5.cfg"
@REM set TMPOPTS=%TMPOPTS% -DTIDY_USER_CONFIG_FILE="C:\MDOS\tidy5.cfg"
@set TMPOPTS=%TMPOPTS% -DBUILD_SHARED_LIB:BOOL=OFF
:RPT
@if "%~1x" == "x" goto GOTCMD
@if "%~1x" == "NOPAUSEx" (
@set DOPAUSE=0
) else (
@set TMPOPTS=%TMPOPTS% %1
)
@shift
@goto RPT
:GOTCMD
@call chkmsvc %TMPPRJ%
@call chkbranch %TMPBR%
@if ERRORLEVEL 1 goto BADBR
:GOTBR
@echo Begin %DATE% %TIME%, output to %TMPLOG%
@echo Begin %DATE% %TIME% >> %TMPLOG%
@echo Doing: 'cmake %TMPSRC% %TMPOPTS%'
@echo Doing: 'cmake %TMPSRC% %TMPOPTS%' >> %TMPLOG%
@cmake %TMPSRC% %TMPOPTS% >> %TMPLOG% 2>&1
@if ERRORLEVEL 1 goto ERR1
@echo Doing: 'cmake --build . --config debug'
@echo Doing: 'cmake --build . --config debug' >> %TMPLOG%
@cmake --build . --config debug >> %TMPLOG%
@if ERRORLEVEL 1 goto ERR2
@echo Doing: 'cmake --build . --config release'
@echo Doing: 'cmake --build . --config release' >> %TMPLOG%
@cmake --build . --config release >> %TMPLOG% 2>&1
@if ERRORLEVEL 1 goto ERR3
:DNREL
@echo Appears a successful build
@echo Note install location %TMPINST%
@echo.
@REM ##############################################
@REM Check if should continue with install
@REM ##############################################
@if "%DOPAUSE%x" == "0x" goto DOINST
@choice /? >nul 2>&1
@if ERRORLEVEL 1 goto NOCHOICE
@choice /D N /T 10 /M "Pausing for 10 seconds. Def=N"
@if ERRORLEVEL 2 goto GOTNO
@goto DOINST
:NOCHOICE
@echo Appears OS does not have the 'choice' command!
@ask *** CONTINUE with install? *** Only y continues
@if ERRORLEVEL 2 goto NOASK
@if ERRORLEVEL 1 goto DOINST
@echo Skipping install to %TMPINST% at this time...
@echo.
@goto END
:NOASK
@echo 'ask' utility not found in path...
@echo.
@echo *** CONTINUE with install? *** Only Ctrl+c aborts...
@echo.
@pause
:DOINST
@echo Proceeding with INSTALL...
@echo.
@REM cmake -P cmake_install.cmake
@echo Doing: 'cmake --build . --config debug --target INSTALL'
@echo Doing: 'cmake --build . --config debug --target INSTALL' >> %TMPLOG%
@cmake --build . --config debug --target INSTALL >> %TMPLOG% 2>&1
@echo Doing: 'cmake --build . --config release --target INSTALL'
@echo Doing: 'cmake --build . --config release --target INSTALL' >> %TMPLOG%
@cmake --build . --config release --target INSTALL >> %TMPLOG% 2>&1
@fa4 " -- " %TMPLOG%
@echo Done build and install of %TMPPRJ%...
@goto END
:GOTNO
@echo.
@echo No install at this time, but there may be an updexe.bat to copy the EXE to c:\MDOS...
@echo.
@goto END
:NOBAT
@echo Can NOT locate MSVC setup batch "%SET_BAT%"! *** FIX ME ***
@goto ISERR
@REM :NOROOT
@REM @echo Can NOT locate %TMPROOT%! *** FIX ME ***
@REM @goto ISERR
:NOCM
@echo Can NOT locate %TMPSRC%\CMakeLists.txt! *** FIX ME ***
@goto ISERR
:NOINST
@echo Can NOT locate directory %TMPINST%! *** FIX ME ***
@goto ISERR
:ERR0
@echo MSVC 10 setup error
@goto ISERR
:ERR1
@echo cmake config, generation error
@goto ISERR
:ERR2
@echo debug build error
@goto ISERR
:ERR3
@fa4 "mt.exe : general error c101008d:" %TMPLOG% >nul
@if ERRORLEVEL 1 goto ERR32
:ERR33
@echo release build error
@goto ISERR
:ERR32
@echo Stupid error... trying again...
@echo Doing: 'cmake --build . --config release'
@echo Doing: 'cmake --build . --config release' >> %TMPLOG%
@cmake --build . --config release >> %TMPLOG% 2>&1
@if ERRORLEVEL 1 goto ERR33
@goto DNREL
:BADBR
@call git checkout %TMPBR%
@call chkbranch %TMPBR%
@if ERRORLEVEL 1 goto BADBR2
@goto GOTBR
:BADBR2
@call shwbranch
@echo Not on correct branch %TMPBR%
@goto ISERR
:ISERR
@endlocal
@exit /b 1
:END
@endlocal
@exit /b 0
@REM eof

View file

@ -1,56 +1,19 @@
@setlocal
@REM 20170702 - Check branch
@set TMPBR=next
@REM 20161002 - Change to msvc140 build
@set VCVERS=14
@set GENERATOR=Visual Studio %VCVERS% Win64
@REM 20160324 - Change to relative, and use choice
@set TMPVER=1
@set TMPPRJ=tidy
@echo Build %TMPPRJ% project, in 64-bits
@set TMPLOG=bldlog-1.txt
@set BLDDIR=%CD%
@set TMPROOT=..\..\..
@set SET_BAT=%ProgramFiles(x86)%\Microsoft Visual Studio %VCVERS%.0\VC\vcvarsall.bat
@if NOT EXIST "%SET_BAT%" goto NOBAT
@REM if NOT EXIST %TMPROOT%\nul goto NOROOT
@set TMPSRC=..\..
@if NOT EXIST %TMPSRC%\CMakeLists.txt goto NOCM
@set TMPBGN=%TIME%
@set TMPINS=D:\Projects\3rdParty.x64
@set TMPLOG=bldlog-1.txt
@set DOPAUSE=1
@set TMPGEN=Visual Studio 16 2019
@set TMPBR=next
@set TMPINDBG=1
@if /I "%PROCESSOR_ARCHITECTURE%" EQU "AMD64" (
@set TMPINST=%TMPROOT%\software.x64
) ELSE (
@if /I "%PROCESSOR_ARCHITECTURE%" EQU "x86_64" (
@set TMPINST=%TMPROOT%\software.x64
) ELSE (
@echo ERROR: Appears 64-bit is NOT available... aborting...
@goto ISERR
)
)
@if NOT EXIST %TMPINST%\nul goto NOINST
@echo Doing build output to %TMPLOG%
@echo Doing build output to %TMPLOG% > %TMPLOG%
@echo Doing: 'call "%SET_BAT%" %PROCESSOR_ARCHITECTURE%'
@echo Doing: 'call "%SET_BAT%" %PROCESSOR_ARCHITECTURE%' >> %TMPLOG%
@call "%SET_BAT%" %PROCESSOR_ARCHITECTURE% >> %TMPLOG% 2>&1
@if ERRORLEVEL 1 goto ERR0
@REM call setupqt64
@cd %BLDDIR%
@REM :DNARCH
@REM ############################################
@REM NOTE: SPECIAL INSTALL LOCATION
@REM Adjust to suit your environment
@REM ##########################################
@REM set TMPINST=F:\Projects\software.x64
@set TMPOPTS=-DCMAKE_INSTALL_PREFIX=%TMPINST%
@set TMPOPTS=%TMPOPTS% -G "%GENERATOR%"
@REM set TMPOPTS=%TMPOPTS% -DTIDY_CONFIG_FILE="C:\MDOS\tidy5.cfg"
@REM set TMPOPTS=%TMPOPTS% -DTIDY_USER_CONFIG_FILE="C:\MDOS\tidy5.cfg"
@set TMPOPTS=%TMPOPTS% -DBUILD_SHARED_LIB:BOOL=OFF
@set TMPOPTS=-G "%TMPGEN%" -A x64
@set TMPOPTS=%TMPOPTS% -DCMAKE_INSTALL_PREFIX=%TMPINS%
@set TMPOPTS=%TMPOPTS% -DBUILD_SHARED_LIB=ON
:RPT
@if "%~1x" == "x" goto GOTCMD
@ -64,31 +27,48 @@
:GOTCMD
@call chkmsvc %TMPPRJ%
@if "%TMPBR%x" == "x" goto DNBR
@call chkbranch %TMPBR%
@if ERRORLEVEL 1 goto BADBR
:GOTBR
@if ERRORLEVEL 1 goto BAD_BR
:DNBR
@echo Begin %DATE% %TIME%, output to %TMPLOG%
@echo Begin %DATE% %TIME% >> %TMPLOG%
@echo Build %TMPPRJ% 64-bits %DATE% %TIME%, in %CD%, to %TMPLOG% > %TMPLOG%
@echo Doing: 'cmake %TMPSRC% %TMPOPTS%'
@echo Doing: 'cmake %TMPSRC% %TMPOPTS%' >> %TMPLOG%
@cmake %TMPSRC% %TMPOPTS% >> %TMPLOG% 2>&1
@if NOT EXIST %TMPSRC%\nul goto NOSRC
@echo Build source %TMPSRC%... all output to build log %TMPLOG%
@echo Build source %TMPSRC%... all output to build log %TMPLOG% >> %TMPLOG%
@if EXIST build-cmake.bat (
@call build-cmake >> %TMPLOG%
)
@if NOT EXIST %TMPSRC%\CMakeLists.txt goto NOCM
@echo Doing: 'cmake -S %TMPSRC% %TMPOPTS%'
@echo Doing: 'cmake -S %TMPSRC% %TMPOPTS%' >> %TMPLOG% 2>&1
@cmake -S %TMPSRC% %TMPOPTS% >> %TMPLOG% 2>&1
@if ERRORLEVEL 1 goto ERR1
@echo Doing: 'cmake --build . --config debug'
@echo Doing: 'cmake --build . --config debug' >> %TMPLOG%
@cmake --build . --config debug >> %TMPLOG%
@echo Doing: 'cmake --build . --config Debug'
@echo Doing: 'cmake --build . --config Debug' >> %TMPLOG% 2>&1
@cmake --build . --config Debug >> %TMPLOG% 2>&1
@if ERRORLEVEL 1 goto ERR2
@echo Doing: 'cmake --build . --config release'
@echo Doing: 'cmake --build . --config release' >> %TMPLOG%
@cmake --build . --config release >> %TMPLOG% 2>&1
@echo Doing: 'cmake --build . --config Release'
@echo Doing: 'cmake --build . --config Release' >> %TMPLOG% 2>&1
@cmake --build . --config Release >> %TMPLOG% 2>&1
@if ERRORLEVEL 1 goto ERR3
:DNREL
@echo Appears a successful build
@echo Note install location %TMPINST%
@fa4 "***" %TMPLOG%
@call elapsed %TMPBGN%
@echo Appears a successful build... see %TMPLOG%
@echo Note install location %TMPINS%
@if "%TMPINDBG%x" == "1x" (
@echo Will install Debug and Release
) else (
@echo Will only intall Release
)
@echo.
@REM ##############################################
@ -118,80 +98,90 @@
:DOINST
@echo Proceeding with INSTALL...
@echo.
@REM cmake -P cmake_install.cmake
@echo Doing: 'cmake --build . --config debug --target INSTALL'
@echo Doing: 'cmake --build . --config debug --target INSTALL' >> %TMPLOG%
@cmake --build . --config debug --target INSTALL >> %TMPLOG% 2>&1
@if NOT "%TMPINDBG%x" == "1x" goto DNDBGIN
@if EXIST install_manifest.txt @del install_manifest.txt
@echo Doing: 'cmake --build . --config Debug --target INSTALL'
@echo Doing: 'cmake --build . --config Debug --target INSTALL' >> %TMPLOG% 2>&1
@cmake --build . --config Debug --target INSTALL >> %TMPLOG% 2>&1
@if ERRORLEVEL 1 goto ERR4
@if EXIST install_manifest.txt (
@copy install_manifest.txt install_manifest_debug.txt >nul
@call add2installs install_manifest.txt -o %TMPINS%\install_manifest.txt >> %TMPLOG%
)
:DNDBGIN
@echo Doing: 'cmake --build . --config release --target INSTALL'
@echo Doing: 'cmake --build . --config release --target INSTALL' >> %TMPLOG%
@cmake --build . --config release --target INSTALL >> %TMPLOG% 2>&1
@if EXIST install_manifest.txt @del install_manifest.txt
@echo Doing: 'cmake --build . --config Release --target INSTALL'
@echo Doing: 'cmake --build . --config Release --target INSTALL' >> %TMPLOG% 2>&1
@cmake --build . --config Release --target INSTALL >> %TMPLOG% 2>&1
@if ERRORLEVEL 1 goto ERR5
@if EXIST install_manifest.txt (
@copy install_manifest.txt install_manifest_release.txt >nul
@call add2installs install_manifest.txt -o %TMPINS%\install_manifest.txt >> %TMPLOG%
)
@fa4 " -- " %TMPLOG%
@echo Done build and install of %TMPPRJ%...
@call elapsed %TMPBGN%
@echo All done... see %TMPLOG%
@goto END
:BAD_BR
@echo Try to do 'git checkout %TMPBR%'
@git checkout %TMPBR% >> %TMPLOG% 2>&1
@call chkbranch %TMPBR%
@if ERRORLEVEL 1 goto NO_BR
@goto DNBR
:NO_BR
@echo.
@echo Unable to check out %TMPBR%! *** FIX ME ***
@echo.
@goto ISERR
:GOTNO
@echo.
@echo No install at this time, but there may be an updexe.bat to copy the EXE to c:\MDOS...
@echo.
@goto END
:NOBAT
@echo Can NOT locate MSVC setup batch "%SET_BAT%"! *** FIX ME ***
:NOSRC
@echo Can NOT locate source %TMPSRC%! *** FIX ME ***
@echo Can NOT locate source %TMPSRC%! *** FIX ME *** >> %TMPLOG%
@goto ISERR
@REM :NOROOT
@REM @echo Can NOT locate %TMPROOT%! *** FIX ME ***
@REM @goto ISERR
:NOCM
@echo Can NOT locate %TMPSRC%\CMakeLists.txt! *** FIX ME ***
@goto ISERR
:NOINST
@echo Can NOT locate directory %TMPINST%! *** FIX ME ***
@goto ISERR
:ERR0
@echo MSVC 10 setup error
@echo Can NOT locate %TMPSRC%\CMakeLists.txt!
@echo Can NOT locate %TMPSRC%\CMakeLists.txt! >> %TMPLOG%
@goto ISERR
:ERR1
@echo cmake config, generation error
@echo cmake configuration or generations ERROR
@echo cmake configuration or generations ERROR >> %TMPLOG%
@goto ISERR
:ERR2
@echo debug build error
@echo ERROR: Cmake build Debug FAILED!
@echo ERROR: Cmake build Debug FAILED! >> %TMPLOG%
@goto ISERR
:ERR3
@fa4 "mt.exe : general error c101008d:" %TMPLOG% >nul
@if ERRORLEVEL 1 goto ERR32
:ERR33
@echo release build error
@echo ERROR: Cmake build Release FAILED!
@echo ERROR: Cmake build Release FAILED! >> %TMPLOG%
@goto ISERR
:ERR32
@echo Stupid error... trying again...
@echo Doing: 'cmake --build . --config release'
@echo Doing: 'cmake --build . --config release' >> %TMPLOG%
@cmake --build . --config release >> %TMPLOG% 2>&1
@if ERRORLEVEL 1 goto ERR33
@goto DNREL
:BADBR
@call git checkout %TMPBR%
@call chkbranch %TMPBR%
@if ERRORLEVEL 1 goto BADBR2
@goto GOTBR
:BADBR2
@call shwbranch
@echo Not on correct branch %TMPBR%
:ERR4
@echo ERROR: Install Debug FAILED!
@echo ERROR: Install Debug FAILED! >> %TMPLOG%
@goto ISERR
:ERR5
@echo ERROR: Install Release FAILED!
@echo ERROR: Install Release FAILED! >> %TMPLOG%
@goto ISERR
:ISERR
@echo See %TMPLOG% for details...
@endlocal
@exit /b 1

93
build/win64/gen-html.bat Normal file
View file

@ -0,0 +1,93 @@
@setlocal
@REM Build HTML from log of 'version.txt'
@REM Versify the tools used
@call verhist -? >nul
@if ERRORLEVEL 1 (
@echo Unable to run 'verhist.pl'! *** FIX ME ***
@exit /b 1
)
@call emailobfuscate -? >nul
@if ERRORLEVEL 1 (
@echo Unable to run 'emailobfuscate.pl'! *** FIX ME ***
@exit /b 1
)
@set TMPFIL1=..\..\version.txt
@if NOT EXIST %TMPFIL1% (
@echo Can NOT locate %TMPFIL1%, in %CD% - *** FIX ME ***
@exit /b 1
)
@call dirmin %TMPFIL1%
@set /P TMPVER=<%TMPFIL1%
@echo Current version '%TMPVER%' ...
@set TMPLOG1=..\..\..\temp-%TMPVER%.log
@set TMPLOG2=..\..\..\temp2-%TMPVER%.log
@set TMPLOG3=..\..\..\temp3-%TMPVER%.log
@if EXIST %TMPLOG1% goto GOTL1
@call git log -p %TMPFIL1% > %TMPLOG1%
@if NOT EXIST %TMPLOG1% (
@echo Gen of %TMPLOG1% FAILED! *** FIX ME ***
@exit /b 1
)
:GOTL1
@echo Got log 1 '%TMPLOG1%' ...
@call dirmin %TMPLOG1%
@if EXIST %TMPLOG2% goto GOTL2
@call verhist %TMPLOG1% -o %TMPLOG2%
@if EXIST %TMPLOG2% goto GOTL2
@echo Gen of %TMPLOG2% FAILED! *** FIX ME ***
@exit /b 1
:GOTL2
@echo Got log 2 '%TMPLOG2%' ...
@call dirmin %TMPLOG2%
@set TMPV=%1
@if "%TMPV%x" == "x" (
@echo Give the cut-off version, like 5.6.0, to continue..
@exit /b 1
)
@echo Doing: 'call grep %TMPV% %TMPLOG2%' ...
@call grep %TMPV% %TMPLOG2%
@if ERRORLEVEL 1 (
@echo Failed to find '%TMPV%'... check the file '%TMPLOG2%'
@exit /b 1
)
@set TMPD=%~2
@if "%TMPD%x" == "x" (
@echo Give the DATE of the cut-off, like 'Sat Nov 25 14:50:00 2017 +0100', to continue...
@exit /b 1
)
@if EXIST %TMPLOG3% goto GOTL3
@call git log "--decorate=full" "--since=%TMPD%" > %TMPLOG3%
@if EXIST %TMPLOG3% goto GOTL3
@echo Failed to generate 'git log ...' - *** FIX ME ***
@exit /b 1
:GOTL3
@echo Got log 3 '%TMPLOG3%' ...
@call dirmin %TMPLOG3%
@REM at last generate the release HTML
@set TMPHTM=..\..\..\temp-%TMPVER%.html
@if EXIST %TMPHTM% goto GOTL4
@call emailobfuscate %TMPLOG3% -o %TMPHTM% -a %TMPVER% -i
@if EXIST %TMPHTM% goto GOTL4
@echo FAILED to generate %TMPHTM%! *** FIX ME ***
@exit /b 1
:GOTL4
@echo Got HTML '%TMPHTM%' ...
@call dirmin %TMPHTM%
@REM All success - check image
@call start %TMPHTM%
@REM eof

18
console/Info.plist.in Normal file
View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDisplayName</key>
<string>HTML Tidy</string>
<key>CFBundleIdentifier</key>
<string>org.htacg.html-tidy.tidy5</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleShortVersionString</key>
<string>@LIBTIDY_VERSION@</string>
<key>CFBundleVersion</key>
<string>@LIBTIDY_DATE@</string>
<key>NSHumanReadableCopyright</key>
<string>©@CURRENT_YEAR@ HTACG and Contributors</string>
</dict>
</plist>

View file

@ -845,7 +845,6 @@ static void help(TidyDoc tdoc, /**< The tidy document for which help is showing.
tmbstr temp_string = NULL;
uint width = 78;
printf("\n");
printf( tidyLocalizedString(TC_TXT_HELP_1), get_final_name(prog), tidyLibraryVersion() );
printf("\n");
@ -1445,6 +1444,24 @@ static void printOptionValues(TidyDoc ARG_UNUSED(tdoc), /**< The Tidy document.
}
}
break;
case TidyPriorityAttributes: /* Is #697 - This case seems missing */
{
TidyIterator itAttr = tidyOptGetPriorityAttrList(tdoc);
if (itAttr && (itAttr != (TidyIterator)-1))
{
while (itAttr)
{
d->def = tidyOptGetNextPriorityAttr(tdoc, &itAttr);
if (itAttr)
{
printf(fmt, d->name, d->type, d->def);
d->name = "";
d->type = "";
}
}
}
}
break;
default:
break;
}
@ -1484,6 +1501,33 @@ static void optionvalues( TidyDoc tdoc )
** @{
*/
/* Is #697 - specialised service to 'invert' a buffers content
split on a space character */
static void invertBuffer(TidyBuffer *src, TidyBuffer *dst)
{
uint len = src->size;
char *in = (char *)src->bp;
char *cp;
if (!in)
return;
while (len)
{
unsigned char uc;
len--;
uc = in[len];
if (uc == ' ')
{
in[len] = 0;
cp = &in[len + 1];
if (dst->size)
tidyBufAppend(dst, " ", 1);
tidyBufAppend(dst, cp, strlen(cp));
}
}
if (dst->size)
tidyBufAppend(dst, " ", 1);
tidyBufAppend(dst, in, strlen(in));
}
/** Prints the option value for a given option.
*/
@ -1493,6 +1537,7 @@ static void printOptionExportValues(TidyDoc ARG_UNUSED(tdoc), /**< The Tidy doc
)
{
TidyOptionId optId = tidyOptGetId( topt );
TidyBuffer buf1, buf2;
if ( tidyOptGetCategory(topt) == TidyInternalCategory )
return;
@ -1505,18 +1550,56 @@ static void printOptionExportValues(TidyDoc ARG_UNUSED(tdoc), /**< The Tidy doc
case TidyPreTags:
{
TidyIterator pos = tidyOptGetDeclTagList( tdoc );
while ( pos )
if ( pos ) /* Is #697 - one or more values */
{
d->def = tidyOptGetNextDeclTag(tdoc, optId, &pos);
if ( pos )
tidyBufInit(&buf1);
tidyBufInit(&buf2);
while (pos)
{
printf( "%s: %s\n", d->name, d->def );
d->name = "";
d->type = "";
d->def = tidyOptGetNextDeclTag(tdoc, optId, &pos);
if (d->def)
{
if (buf1.size)
tidyBufAppend(&buf1, " ", 1);
tidyBufAppend(&buf1, (void *)d->def, strlen(d->def));
}
}
invertBuffer(&buf1, &buf2); /* Is #697 - specialised service to invert words */
tidyBufAppend(&buf2, (void *)"\0", 1); /* is this really required? */
printf("%s: %s\n", d->name, buf2.bp);
d->name = "";
d->type = "";
d->def = 0;
tidyBufFree(&buf1);
tidyBufFree(&buf2);
}
}
break;
case TidyPriorityAttributes: /* Is #697 - This case seems missing */
{
TidyIterator itAttr = tidyOptGetPriorityAttrList(tdoc);
if (itAttr && (itAttr != (TidyIterator)-1))
{
tidyBufInit(&buf1);
while (itAttr)
{
d->def = tidyOptGetNextPriorityAttr(tdoc, &itAttr);
if (d->def)
{
if (buf1.size)
tidyBufAppend(&buf1, " ", 1);
tidyBufAppend(&buf1, (void *)d->def, strlen(d->def));
}
}
tidyBufAppend(&buf1, (void *)"\0", 1); /* is this really required? */
printf("%s: %s\n", d->name, buf1.bp);
d->name = "";
d->type = "";
d->def = 0;
tidyBufFree(&buf1);
}
}
break;
default:
break;
}
@ -1657,6 +1740,10 @@ static void printXMLCrossRefEqConsole(TidyDoc tdoc, /**< The Tidy document. */
free((tmbstr)localHit.name3);
free(localName);
}
if ( localHit.eqconfig ) /* Is. #791 */
{
free((tmbstr)localHit.eqconfig);
}
}
else
@ -1803,6 +1890,7 @@ static void xml_help( void )
if (localPos.name1) free((tmbstr)localPos.name1);
if (localPos.name2) free((tmbstr)localPos.name2);
if (localPos.name3) free((tmbstr)localPos.name3);
if (localPos.eqconfig) free((tmbstr)localPos.eqconfig); /* Is. #791 */
}
printf( "</cmdline>\n" );
@ -2405,8 +2493,17 @@ int main( int argc, char** argv )
if ( argc > 1 )
{
htmlfil = argv[1];
DEBUG_LOG( SPRTF("Tidying '%s'\n", htmlfil) );
if ( tidyOptGetBool(tdoc, TidyEmacs) )
#ifdef ENABLE_DEBUG_LOG
SPRTF("Tidy: '%s'\n", htmlfil);
#else /* !ENABLE_DEBUG_LOG */
/* Is #713 - show-filename option */
if (tidyOptGetBool(tdoc, TidyShowFilename))
{
fprintf(errout, "Tidy: '%s'", htmlfil);
fprintf(errout, "\n");
}
#endif /* ENABLE_DEBUG_LOG yes/no */
if ( tidyOptGetBool(tdoc, TidyEmacs) || tidyOptGetBool(tdoc, TidyShowFilename))
tidySetEmacsFile( tdoc, htmlfil );
status = tidyParseFile( tdoc, htmlfil );
}

View file

@ -481,16 +481,16 @@ TIDY_EXPORT void TIDY_CALL tidyGeneralInfo( TidyDoc tdoc );
/** Load an ASCII Tidy configuration file and set the configuration per its
** contents.
** @result Returns 0 upon success, or any other value if there was an error.
** contents. Reports config option errors, which can be filtered.
** @result Returns 0 upon success, or any other value if there was an option error.
*/
TIDY_EXPORT int TIDY_CALL tidyLoadConfig(TidyDoc tdoc, /**< The TidyDoc to which to apply the configuration. */
ctmbstr configFile /**< The complete path to the file to load. */
);
/** Load a Tidy configuration file with the specified character encoding, and
** set the configuration per its contents.
** @result Returns 0 upon success, or any other value if there was an error.
** set the configuration per its contents. Reports config option errors, which can be filtered.
** @result Returns 0 upon success, or any other value if there was an option error.
*/
TIDY_EXPORT int TIDY_CALL tidyLoadConfigEnc(TidyDoc tdoc, /**< The TidyDoc to which to apply the configuration. */
ctmbstr configFile, /**< The complete path to the file to load. */
@ -2053,7 +2053,7 @@ TIDY_EXPORT ctmbstr TIDY_CALL tidyGetLanguage(void);
** @{
*/
/** @struct tidyLocalMapItem
/** @struct tidyLocaleMapItem
** Represents an opaque type we can use for tidyLocaleMapItem, which
** is used to iterate through the language list, and used to access
** the windowsName() and the posixName().
@ -2088,17 +2088,17 @@ TIDY_EXPORT TidyIterator TIDY_CALL getWindowsLanguageList(void);
*/
TIDY_EXPORT const tidyLocaleMapItem* TIDY_CALL getNextWindowsLanguage( TidyIterator* iter );
/** Given a `tidyLocalMapItem`, return the Windows name.
** @param item An instance of tidyLocalMapItem to query.
/** Given a `tidyLocaleMapItem`, return the Windows name.
** @param item An instance of tidyLocaleMapItem to query.
** @result Returns a string with the Windows name of the mapping.
*/
TIDY_EXPORT const ctmbstr TIDY_CALL TidyLangWindowsName( const tidyLocaleMapItem *item );
TIDY_EXPORT ctmbstr TIDY_CALL TidyLangWindowsName( const tidyLocaleMapItem *item );
/** Given a `tidyLocalMapItem`, return the POSIX name.
** @param item An instance of tidyLocalMapItem to query.
/** Given a `tidyLocaleMapItem`, return the POSIX name.
** @param item An instance of tidyLocaleMapItem to query.
** @result Returns a string with the POSIX name of the mapping.
*/
TIDY_EXPORT const ctmbstr TIDY_CALL TidyLangPosixName( const tidyLocaleMapItem *item );
TIDY_EXPORT ctmbstr TIDY_CALL TidyLangPosixName( const tidyLocaleMapItem *item );
/** @}
** @name Getting Localized Strings

View file

@ -107,6 +107,7 @@ extern "C" {
*/
#define FOREACH_MSG_MISC(FN) \
/** line %d column %d */ FN(LINE_COLUMN_STRING) \
/** %s: line %d column %d */ FN(FN_LINE_COLUMN_STRING) \
/** discarding */ FN(STRING_DISCARDING) \
/** error and errors */ FN(STRING_ERROR_COUNT_ERROR) \
/** warning and warnings */ FN(STRING_ERROR_COUNT_WARNING) \
@ -171,6 +172,7 @@ extern "C" {
#define FOREACH_REPORT_MSG(FN) \
FN(ADDED_MISSING_CHARSET) \
FN(ANCHOR_NOT_UNIQUE) \
FN(ANCHOR_DUPLICATED) \
FN(APOS_UNDEFINED) \
FN(ATTR_VALUE_NOT_LCASE) \
FN(ATTRIBUTE_IS_NOT_ALLOWED) \
@ -608,7 +610,7 @@ typedef enum
TidyLiteralAttribs, /**< If true attributes may use newlines */
TidyLogicalEmphasis, /**< Replace i by em and b by strong */
TidyLowerLiterals, /**< Folds known attribute values to lower case */
TidyMakeBare, /**< Make bare HTML: remove Microsoft cruft */
TidyMakeBare, /**< Replace smart quotes, em dashes, etc with ASCII */
TidyMakeClean, /**< Replace presentational clutter by style rules */
TidyMark, /**< Add meta element indicating tidied doc */
TidyMergeDivs, /**< Merge multiple DIVs */
@ -635,6 +637,7 @@ typedef enum
TidyQuoteNbsp, /**< Output non-breaking space as entity */
TidyReplaceColor, /**< Replace hex color attribute values with names */
TidyShowErrors, /**< Number of errors to put out */
TidyShowFilename, /**< If true, the input filename is displayed with the error messages */
TidyShowInfo, /**< If true, info-level messages are shown */
TidyShowMarkup, /**< If false, normal output is suppressed */
TidyShowMetaChange, /**< show when meta http-equiv content charset was changed - compatibility */
@ -654,7 +657,7 @@ typedef enum
TidyWrapAttVals, /**< Wrap within attribute values */
TidyWrapJste, /**< Wrap within JSTE pseudo elements */
TidyWrapLen, /**< Wrap margin */
TidyWrapPhp, /**< Wrap within PHP pseudo elements */
TidyWrapPhp, /**< Wrap consecutive PHP pseudo elements */
TidyWrapScriptlets, /**< Wrap within JavaScript string literals */
TidyWrapSection, /**< Wrap within <![ ... ]> section tags */
TidyWriteBack, /**< If true then output tidied markup */
@ -968,6 +971,7 @@ typedef enum
TidyTag_BDI, /**< BDI */
TidyTag_CANVAS, /**< CANVAS */
TidyTag_COMMAND, /**< COMMAND */
TidyTag_DATA, /**< DATA */
TidyTag_DATALIST, /**< DATALIST */
TidyTag_DETAILS, /**< DETAILS */
TidyTag_DIALOG, /**< DIALOG */
@ -990,6 +994,7 @@ typedef enum
TidyTag_TIME, /**< TIME */
TidyTag_TRACK, /**< TRACK */
TidyTag_VIDEO, /**< VIDEO */
TidyTag_SLOT, /**< SLOT */
N_TIDY_TAGS /**< Must be last */
} TidyTagId;
@ -1338,7 +1343,25 @@ typedef enum
TidyAttr_AS, /**< AS= */
TidyAttr_XMLNSXLINK, /**< svg xmls:xlink="url" */
TidyAttr_SLOT, /**< SLOT= */
TidyAttr_LOADING, /**< LOADING= */
/* SVG paint attributes (SVG 1.1) */
TidyAttr_FILL, /**< FILL= */
TidyAttr_FILLRULE, /**< FILLRULE= */
TidyAttr_STROKE, /**< STROKE= */
TidyAttr_STROKEDASHARRAY, /**< STROKEDASHARRAY= */
TidyAttr_STROKEDASHOFFSET, /**< STROKEDASHOFFSET= */
TidyAttr_STROKELINECAP, /**< STROKELINECAP= */
TidyAttr_STROKELINEJOIN, /**< STROKELINEJOIN= */
TidyAttr_STROKEMITERLIMIT, /**< STROKEMITERLIMIT= */
TidyAttr_STROKEWIDTH, /**< STROKEWIDTH= */
TidyAttr_COLORINTERPOLATION, /**< COLORINTERPOLATION= */
TidyAttr_COLORRENDERING, /**< COLORRENDERING= */
TidyAttr_OPACITY, /**< OPACITY= */
TidyAttr_STROKEOPACITY, /**< STROKEOPACITY= */
TidyAttr_FILLOPACITY, /**< FILLOPACITY= */
N_TIDY_ATTRIBS /**< Must be last */
} TidyAttrId;

View file

@ -569,7 +569,7 @@ extern "C" {
typedef unsigned int uint;
#endif
#if defined(HPUX_OS) || defined(CYGWIN_OS) || defined(MAC_OS) || defined(BSD_BASED_OS) || defined(_WIN32)
#if defined(HPUX_OS) || defined(CYGWIN_OS) || defined(MAC_OS) || defined(BSD_BASED_OS) || defined(_WIN32) || defined(__ANDROID__)
# undef ulong
typedef unsigned long ulong;
#endif

File diff suppressed because it is too large Load diff

View file

@ -898,7 +898,17 @@ msgid ""
"<code>&lt;?php ... ?&gt;</code>. As always, all other tabs, or sequences of tabs, in "
"the source will continue to be replaced with a space. "
msgstr ""
"Com <var>no</var> preconfigurado, Tidy substituirá todas as tabulações da fonte com espaços, "
"em conformidade com a opção <code>tab-size</code> e o deslocamento da linha atual. "
"Obviamente, com exceção dos blocos/elementos enumerados abaixo, isto será "
"reduzido depois a apenas um espaço "
"<br/>"
"Se configurado para <var>yes</var> essa opção determina que Tidy deve manter "
"certas tabulaçõess encontradas na fonte, mas apenas "
"em blocos preformatados como <code>&lt;pre&gt;</code> e outros elementos CDATA como "
"<code>&lt;script&gt;</code>, <code>&lt;style&gt;</code> e outros pseudo-elementos como "
"<code>&lt;?php ... ?&gt;</code>. Como sempre, todas as demais tabulações ou "
"sequências de tabulações na fonte continuarão a ser substituídas por um espaço. "
#. Important notes for translators:
#. - Use only <code></code>, <var></var>, <em></em>, <strong></strong>, and
#. <br/>.
@ -1618,7 +1628,13 @@ msgid ""
"<code>mute-id</code> configuration option and examining Tidy's "
"output. "
msgstr ""
"Use esta opção para impedir que Tidy mostre certos tipos de "
"relatórios, por exemplo, para condições que você deseja ignorar. "
"<br/>"
"Essa opção recebe uma lista de uma ou mais chaves que indicam o tipo de "
"mensagem a ser silenciada. Você pode descobrir as chaves destas mensagens "
"usando a opção de configuração <code>mute-id</code> e examinando o resultado "
"produzido por Tidy. "
#. Important notes for translators:
#. - Use only <code></code>, <var></var>, <em></em>, <strong></strong>, and
#. <br/>.
@ -1634,7 +1650,10 @@ msgid ""
"use the <code>mute</code> configuration option in order to filter "
"out certain report messages. "
msgstr ""
"Essa opção determina se Tidy deve apresentar ou não os IDs da mensagem "
"com cada um de seus relatórios de erros. Pode ser útil se você quiser "
"usar a opção de configuração <code>mute</code> a fim de filtrar "
"certas mensagens do relatório. "
#. Important notes for translators:
#. - Use only <code></code>, <var></var>, <em></em>, <strong></strong>, and
#. <br/>.
@ -2196,7 +2215,7 @@ msgstr ""
msgctxt "TidyWarning"
msgid "Warning: "
msgstr "Acesso: "
msgstr "Aviso: "
msgctxt "TidyConfig"
msgid "Config: "
@ -2549,6 +2568,10 @@ msgid ""
"this behavior, then consider setting the option \"drop-empty-elements\"\n"
"to no.\n"
msgstr ""
"Um ou mais elementos vazios estavam presentes no documento-fonte mas\n"
"foram descartados no resultado. Se esses elementos são necessários ou\n"
"se você não deseja esse comportamento, então considere configurar a opção\n"
"\"drop-empty-elements\" para no.\n"
#. This console output should be limited to 78 characters per line.
#. - The URL should not be translated unless you find a matching URL in your language.
@ -2921,15 +2944,15 @@ msgstr "hífenes adjacentes dentro de comentário"
msgctxt "MALFORMED_COMMENT_DROPPING"
msgid "dropping a possible comment due to a missing hyphen"
msgstr ""
msgstr "descartando um possível comentário devido à falta de hífen"
msgctxt "MALFORMED_COMMENT_EOS"
msgid "the end of the document was reached before the end of the comment"
msgstr ""
msgstr "o fim do documento foi alcançado antes do fim do comentário"
msgctxt "MALFORMED_COMMENT_WARN"
msgid "detected adjacent hyphens within the comment; consider fix-bad-comments"
msgstr ""
msgstr "hífens adjacentes detectados dentro do comentário; considere fix-bad-comments"
msgctxt "MALFORMED_DOCTYPE"
msgid "discarding malformed <!DOCTYPE>"
@ -2972,7 +2995,7 @@ msgstr "faltando </%s>"
#, c-format
msgctxt "MISSING_ENDTAG_OPTIONAL"
msgid "missing optional end tag </%s>"
msgstr ""
msgstr "faltando tag final opcional </%s>"
#, c-format
msgctxt "MISSING_IMAGEMAP"
@ -2987,7 +3010,7 @@ msgstr "atributo de %s faltando aspas ao final"
#, c-format
msgctxt "MISSING_QUOTEMARK_OPEN"
msgid "value for attribute \"%s\" missing quote marks"
msgstr ""
msgstr "valor para atributo \"%s\" faltando aspas"
#, c-format
msgctxt "MISSING_SEMICOLON_NCR"
@ -3044,17 +3067,17 @@ msgstr "substituindo elemento obsoleto %s por %s"
#, c-format
msgctxt "OPTION_REMOVED"
msgid "option \"%s\" no longer exists, and no replacement could be found."
msgstr ""
msgstr "opção \"%s\" não existe mais e nenhum substituto pôde ser encontrado."
#, c-format
msgctxt "OPTION_REMOVED_APPLIED"
msgid "option \"%s\" replaced with \"%s\", which Tidy has set to \"%s\"."
msgstr ""
msgstr "opção \"%s\" substituída por \"%s\", que Tidy configurou para \"%s\"."
#, c-format
msgctxt "OPTION_REMOVED_UNAPPLIED"
msgid "option \"%s\" replaced with \"%s\", but Tidy could not set it for you."
msgstr ""
msgstr "opção \"%s\" substituída por \"%s\", mas Tidy não pôde configurar para você"
#, c-format
msgctxt "PREVIOUS_LOCATION"
@ -3103,7 +3126,7 @@ msgstr "removendo espaço em branco precedendo a declaração XML"
#, c-format
msgctxt "STRING_ARGUMENT_BAD"
msgid "option \"%s\" given bad argument \"%s\""
msgstr ""
msgstr "opção \"%s\" recebeu argumento errado \"%s\""
#, c-format
msgctxt "STRING_MISSING_MALFORMED"
@ -3113,7 +3136,7 @@ msgstr "argumento faltando ou malformado para opção: %s"
#, c-format
msgctxt "STRING_MUTING_TYPE"
msgid "messages of type \"%s\" will not be output"
msgstr ""
msgstr "mensagens de tipo \"%s\" não vão ser geradas"
#, c-format
msgctxt "STRING_UNKNOWN_OPTION"
@ -3790,11 +3813,11 @@ msgstr "lista todas as opções de configuração"
msgctxt "TC_OPT_HELPENV"
msgid "show information about the environment and runtime configuration"
msgstr ""
msgstr "mostra informações sobre o ambiente e a configuração de execução"
msgctxt "TC_OPT_HELPOPT"
msgid "show a description of the <option>"
msgstr " mostra uma descrição da <opção>"
msgstr "mostra uma descrição da <opção>"
msgctxt "TC_OPT_IBM858"
msgid "use IBM-858 (CP850+Euro) for input, US-ASCII for output"
@ -3866,11 +3889,11 @@ msgstr "lista as definições da configuração atual"
msgctxt "TC_OPT_EXP_CFG"
msgid "list the current configuration settings, suitable for a config file"
msgstr ""
msgstr "lista as configurações atuais, apropriadas para um documento config"
msgctxt "TC_OPT_EXP_DEF"
msgid "list the default configuration settings, suitable for a config file"
msgstr ""
msgstr "lista as configurações padrões, apropriadas para um documento config"
msgctxt "TC_OPT_UPPER"
msgid "force tags to upper case"
@ -4170,7 +4193,13 @@ msgid ""
" %s \n"
"\n"
msgstr ""
"\n"
" Ademais, Tidy tentará automaticamente utilizar configuração especificada \n"
" nesses documentos, se presentes: \n"
"\n"
" %s \n"
" %s \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.
msgctxt "TC_TXT_HELP_CONFIG"
@ -4232,6 +4261,17 @@ msgid ""
" - Options in a file specified on the command line. \n"
" - Options set directly on the command line. \n"
msgstr ""
"\n"
"Tidy pode configurar valores de opções a partir de várias fontes, \n"
"na ordem abaixo. O uso subsequente da mesma opção sobreescreve \n"
"configurações anteriores. \n"
"\n"
" - Valores inbutidos padrões de Tidy. \n"
"%s" /* rc files */
" - O documento especificado na variável de ambiente $HTML_TIDY: \n"
" %s \n"
" - Opções num arquivo especificado na linha do comando. \n"
" - Opções definidas diretamente na linha de comando. \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.
@ -4243,13 +4283,16 @@ msgid ""
" - The user runtime configuration file: \n"
" %s \n"
msgstr ""
" - O documento de configuração de execução do sistema: \n"
" %s \n"
" - O documento de configuração de execução do usuário: \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.
msgctxt "TC_TXT_HELP_ENV_1B"
msgid "(not currently set)"
msgstr ""
msgstr "(não definido no momento)"
#. 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.
@ -4260,7 +4303,9 @@ msgid ""
"Note that because $HTML_TIDY is set, the user runtime configuration file \n"
"%s will not be used. \n"
msgstr ""
"\n"
"Note que, dado que $HTML_TIDY foi definida, o documento de configuração \n"
"de execução do usuário %s não será utilizado. \n"
#. This console output should be limited to 78 characters per line.
#. - The strings "Tidy" and "HTML Tidy" are the program name and must not be translated.
msgctxt "TC_TXT_HELP_LANG_1"

View file

@ -75,8 +75,9 @@ They are listed in the first part of this section.
\fIConfiguration\fR options, on the other hand, can either be passed
on the command line, starting with two dashes \fB--\fR,
or specified in a configuration file,
using the option name without the starting dashes.
They are listed in the second part of this section.
using the option name, followed by a colon \fB:\fR, plus the value, without
the starting dashes. They are listed in the second part of this section,
with a sample config file.
.LP
For \fIcommand-line\fR options that expect a numerical argument,
a default is assumed if no meaningful value can be found.

View file

@ -0,0 +1,4 @@
source 'https://rubygems.org'
gem 'thor'
gem "tty-editor"

View file

@ -0,0 +1,30 @@
GEM
remote: https://rubygems.org/
specs:
pastel (0.8.0)
tty-color (~> 0.5)
thor (1.1.0)
tty-color (0.6.0)
tty-cursor (0.7.1)
tty-editor (0.6.0)
tty-prompt (~> 0.22)
tty-prompt (0.23.1)
pastel (~> 0.8)
tty-reader (~> 0.8)
tty-reader (0.9.0)
tty-cursor (~> 0.7)
tty-screen (~> 0.8)
wisper (~> 2.0)
tty-screen (0.8.1)
wisper (2.0.1)
PLATFORMS
ruby
x64-mingw32
DEPENDENCIES
thor
tty-editor
BUNDLED WITH
2.1.4

View file

@ -0,0 +1,205 @@
Tidy Regression Testing Specification
=====================================
Background
----------
HTML Tidy uses regression testing as its main means of quality control when
implementing new features and fixing bugs. HTML Tidy has been in constant
development since before unit testing and automated testing were in wide use,
and has proven effective in guiding the development of Tidy.
This repository is the regression testing tool used by Tidy for both
continuous integration, and for development work, and consists for test
cases split into multiple set sets, as well as tools for automating testing.
Testing consists of automatically running some version (of your choice) of HTML
Tidy on various operating systems and architectures against the suite of
test cases, and comparing the Tidy and report output against known, “good”
versions thereof.
This testing process ensures that:
- No regressions occur as a result of the changes you make to HTML Tidy.
Everything that has passed in the past should continue to pass, regardless
of your changes. Changing test expectations for existing test cases must
result in a discussion on the pull request discussion thread, otherwise
regressions are _prima facie_ cause for rejecting your pull request.
- Although touted as a “regression test,” code changes should also be
furnished with a test case that demonstrates the issue being corrected or
the feature being added. Logically you are already informally using one or
most test cases during your development of the patch; this simply
formalizes the requirement for HTML Tidy, and makes it much easier for the
maintainers to understand the impact of your proposed change.
Additionally, when introducing new features or fixing bugs,
new test cases should be written to demonstrate that the fix works against
the test case.
About the Test Tool (test.rb)
-----------------------------
The `test.rb` tool replaces the previous Windows shell and Bash testing
scripts. This start-from-scratch approach is intended to provide a single
script thats platform agnostic, for the primary purpose of enabling
automated testing, but with strong support for use as a manual tool during
HTML Tidy development.
Ruby was chosen as the scripting language of choice because it is available
on every platform, is easy to read (even if you're not a Ruby programmer),
and is supported by the major continuous integration testing providers, such
as Github.
We recognize that some developers have scripting environment preferences,
and as such, please feel free write wrappers around `test.rb` as needed in
order to suit your prefences. If additional CLI API is needed to enable your
scripting environment wrapper, please feel free to request such.
Building Tidy, and Tidy Versions
--------------------------------
The testing tool works by executing `tidy` (or `tidy.exe`, referred to only
as `tidy` continuing) on your platform. Naturally, you dont want to conduct
testing using the normal, installed version of `tidy`, but rather version(s)
that youve built for testing.
By default, the `tidy` used will be in the standard build folder of the
`tidy-html5` directory that is a sibling to this `tidy-html5-tests`
directory. The complete relative path from `test.rb`, then, is:
```
../tidy-html5/build/cmake/tidy[.exe]
```
This makes it convenient when performing testing on both repositories when
theyre checked out. However you can also specify another build of HTML Tidy
as an optional argument, too.
Static Build Considerations
---------------------------
By default, HTML Tidy is built as a console application statically linked to
LibTidy. Although the option to link against a dylib or dll exist when
building, its suggested that you no longer do so, because you might put
yourself into a situation where youre testing multiple command line
executables that are all linked to the same dynamic library!
Although not formally deprecated, you should consider dynamic linking
deprecated and treat it that way. In a world where entire Java Runtime
Environments are shipped _per program_, the benefits of dynamic linking no
longer exist on any modern computer or operating system. In some cases,
modern security hardening even prevents dynamic linking, and were likely to
see such restrictions become more common in the future.
Running Test Tests
------------------
### Preparing the Environment
Assuming that you have a working Ruby interpretor, version 2.7 or so, upon
`CD`-ing into the `tidy-html5-test` directory, you should execute `bundle
install`, which ensures that any dependencies that your environment doesnt
already have will be downloaded.
### Executing the Program
In Windows shell and powershell, simply typing
~~~
test
~~~
will run the tool. Usually. Probably. If not, try `ruby test.rb` in case
your environment is not configured to work directly.
Unix and Unix-like operating systems (including WSL and other Unix-like
environments for Windows) can run the program like such:
~~~
test.rb
~~~
### Testing
When used without any arguments, help will be provided. In general, though,
you can do the following:
| Command | Effect |
|--------------------------------|-----------------------------------|
| `./test.rb test` | Tests all cases in all test sets. |
| `./test.rb only <setname>` | Tests only in the given test set. |
| `./test.rb case <case_number>` | Tests only on a single case. |
Input Specification
-------------------
### Test Sets
“Test sets” are groups of individual tests that are thematically related,
such as accessibility checks, XML-specific tests, historical tests, etc.
Each set of cases consists of directories and a text file within the `cases/`
directory. Each test set shall consist of the following directories/files, where
`setname` indicates the name of the testing set, e.g., `testbase` (our default
set of case files).
- `setname/`, which contains the HTML files to tidy, and an optional
configuration file for each case.
- Test files shall have the format `case-basename@n<.html|.xml|.xhtml>`,
where `nnn` represents the test case name, and the `@n` metadata
represents the required shell exit status code that HTML Tidy should
produce after running the test case. The case name cannot contain
hyphens or the `@` symbol, and should represent something meaningful
such a a Github issue number.
- Optional Tidy configuration files shall be named `case-basename.conf`.
- In the absense of a configuration file, the file `config_default.conf` in
each directory will be used instead.
- `README<.txt|.md>`, which describes the test set.
- `setname-expects/`, which contains the expected output from HTML Tidy.
- Files in the format `case-nnn<.html|.xml|.xhtml>` represent the expected
HTML file as generated by Tidy.
- Files in the format `case-nnn.txt` represent the expected warning/error
output from Tidy.
#### Example
```
cases/
testbase/
config_default.cong
case-427821.html
case-427821.conf
testbase-expects/
case-427821.html
case-427821.txt
```
Output Specification
--------------------
The output specification is written such that it makes it trivial to easily
`diff` a `setname-expects` directory with the output of a test in order
to check for differences.
Test results consist of Tidy's HTML output and Tidy's warning/error output.
Each set of results consists of directories within the `cases/` directory.
- `setname-results` contains Tidy's HTML and warning/error output.
- Files in the format `case-nnn.html` are the HTML file generated by Tidy.
- Files in the format `case-nnn.txt` are the warning/error output from Tidy.
### Example
~~~
cases/
testbase-results/
case-427821.html
case-427821.txt
~~~

View file

@ -0,0 +1 @@
5.7.48

View file

@ -0,0 +1,10 @@
About this test suite:
======================
These files ensure that Tidy is presenting the correct accessibility information
when used with Tidys various levels of accessibility checking.
The original accessibility test script looked for a single line of output
present in Tidy's error output. Current treatment as a standard regression
test accomplishes the same result, in that testing the entire error output is
a superset of testing only the desired output anyway.

View file

@ -0,0 +1,3 @@
char-encoding: latin1
accessibility-check: 2
show-info: no

View file

@ -0,0 +1,9 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<title>aert1.0/10.1.1</title>
</head>
<body>
<a href="newpage.html" target="_new">Opens in new window.</a>
</body>
</html>

View file

@ -0,0 +1,3 @@
char-encoding: latin1
accessibility-check: 2
show-info: no

View file

@ -0,0 +1,9 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<title>aert1.0/10.1.1</title>
</head>
<body>
<a href="newpage.html" target="_blank">Opens in new window.</a>
</body>
</html>

View file

@ -0,0 +1,3 @@
char-encoding: latin1
accessibility-check: 2
show-info: no

View file

@ -0,0 +1,3 @@
char-encoding: latin1
accessibility-check: 2
show-info: no

View file

@ -0,0 +1,11 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<title>aert1.0/11.2.1</title>
</head>
<body>
<u>x</u>
</body>
</html>

View file

@ -0,0 +1,10 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<title>aert1.0/11.2.1</title>
</head>
<body>
<applet>
</applet>
</body>
</html>

View file

@ -0,0 +1,3 @@
char-encoding: latin1
accessibility-check: 2
show-info: no

View file

@ -0,0 +1,9 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<title>aert1.0/11.2.1</title>
</head>
<body>
<basefont>
</body>
</html>

View file

@ -0,0 +1,3 @@
char-encoding: latin1
accessibility-check: 2
show-info: no

View file

@ -0,0 +1,11 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<title>aert1.0/11.2.1</title>
</head>
<body>
<center>Hello</center>
</body>
</html>

View file

@ -0,0 +1,3 @@
char-encoding: latin1
accessibility-check: 2
show-info: no

View file

@ -0,0 +1,11 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<title>aert1.0/11.2.1</title>
</head>
<body>
<dir>Hello</dir>
</body>
</html>

View file

@ -0,0 +1,3 @@
char-encoding: latin1
accessibility-check: 2
show-info: no

View file

@ -0,0 +1,9 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<title>aert1.0/11.2.1</title>
</head>
<body>
<font size="6">Hello</font>
</body>
</html>

View file

@ -0,0 +1,3 @@
char-encoding: latin1
accessibility-check: 2
show-info: no

View file

@ -0,0 +1,9 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<title>aert1.0/11.2.1</title>
</head>
<body>
<isindex prompt="Enter your search phrase: ">
</body>
</html>

View file

@ -0,0 +1,3 @@
char-encoding: latin1
accessibility-check: 2
show-info: no

View file

@ -0,0 +1,9 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<title>aert1.0/11.2.1</title>
</head>
<body>
<menu></menu>
</body>
</html>

View file

@ -0,0 +1,3 @@
char-encoding: latin1
accessibility-check: 2
show-info: no

View file

@ -0,0 +1,9 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<title>aert1.0/11.2.1</title>
</head>
<body>
<s>x</s>
</body>
</html>

View file

@ -0,0 +1,3 @@
char-encoding: latin1
accessibility-check: 2
show-info: no

View file

@ -0,0 +1,9 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<title>aert1.0/11.2.1</title>
</head>
<body>
<strike>x</strike>
</body>
</html>

View file

@ -0,0 +1,3 @@
char-encoding: latin1
accessibility-check: 1
show-info: no

View file

@ -0,0 +1,10 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
<html lang="en">
<head>
<title>aert1.0/12.1.1</title>
</head>
<frameset>
<frame></frame>
</frameset>
</html>

View file

@ -0,0 +1,3 @@
char-encoding: latin1
accessibility-check: 1
show-info: no

View file

@ -0,0 +1,10 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
<html lang="en">
<head>
<title>aert1.0/12.1.1</title>
</head>
<frameset>
<frame title=""></frame>
</frameset>
</html>

View file

@ -0,0 +1,3 @@
char-encoding: latin1
accessibility-check: 1
show-info: no

View file

@ -0,0 +1,10 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
<html lang="en">
<head>
<title>aert1.0/12.1.1</title>
</head>
<frameset>
<frame title=" "></frame>
</frameset>
</html>

View file

@ -0,0 +1,3 @@
char-encoding: latin1
accessibility-check: 2
show-info: no

View file

@ -0,0 +1,12 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<title>aert1.0/12.4.1</title>
</head>
<body>
<form action="">
<label>Some text:</label>
<input value="****" type="text">
</form>
</body>
</html>

View file

@ -0,0 +1,3 @@
char-encoding: latin1
accessibility-check: 2
show-info: no

View file

@ -0,0 +1,12 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<title>aert1.0/12.4.1</title>
</head>
<body>
<form action="">
<label>Some text:</label>
<input id="control1" value="****" type="text">
</form>
</body>
</html>

View file

@ -0,0 +1,3 @@
char-encoding: latin1
accessibility-check: 2
show-info: no

View file

@ -0,0 +1,12 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<title>aert1.0/12.4.1</title>
</head>
<body>
<form action="">
<label for="control1">Some text:</label>
<input value="****" type="text">
</form>
</body>
</html>

View file

@ -0,0 +1,3 @@
char-encoding: latin1
accessibility-check: 3
show-info: no

View file

@ -0,0 +1,23 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<title>aert1.0/13.10.1</title>
</head>
<body>
<pre>
% __ __ __ __ __ __ __ __ __ __ __ __ __ __
100 | * |
90 | * * |
80 | * * |
70 | @ * |
60 | @ * |
50 | * @ * |
40 | @ * |
30 | * @ @ @ * |
20 | |
10 | @ @ @ @ @ |
0 5 10 15 20 25 30 35 40 45 50 55 60 65 70
Flash frequency (Hertz)
</pre>
</body>
</html>

View file

@ -0,0 +1,3 @@
char-encoding: latin1
accessibility-check: 2
show-info: no

View file

@ -0,0 +1,11 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<title>aert1.0/13.1.1</title>
</head>
<body>
<a href="animals.htm">cats</a>
some text
<a href="animals.htm">cats</a>
</body>
</html>

View file

@ -0,0 +1,3 @@
char-encoding: latin1
accessibility-check: 2
show-info: no

View file

@ -0,0 +1,9 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<title>aert1.0/13.1.1</title>
</head>
<body>
<a href="animals.htm"></a>
</body>
</html>

View file

@ -0,0 +1,3 @@
char-encoding: latin1
accessibility-check: 2
show-info: no

View file

@ -0,0 +1,10 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<title>aert1.0/13.1.1</title>
</head>
<body>
<a href="animals.htm">Want to find out more about small furry animals?
Then click here and this link will take you there.</a>
</body>
</html>

View file

@ -0,0 +1,3 @@
char-encoding: latin1
accessibility-check: 2
show-info: no

View file

@ -0,0 +1,9 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<title>aert1.0/13.1.1</title>
</head>
<body>
<a href="animals.htm">click here</a>
</body>
</html>

View file

@ -0,0 +1,3 @@
char-encoding: latin1
accessibility-check: 2
show-info: no

View file

@ -0,0 +1,9 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<title></title>
<!-- aert1.0/13.2.1 -->
</head>
<body>
</body>
</html>

View file

@ -0,0 +1,3 @@
char-encoding: latin1
accessibility-check: 2
show-info: no

View file

@ -0,0 +1,9 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<title>aert1.0/13.2.1</title>
<meta http-equiv="refresh" content="http://www.foo.com/bar.html">
</head>
<body>
</body>
</html>

View file

@ -0,0 +1,3 @@
char-encoding: latin1
accessibility-check: 1
show-info: no

View file

@ -0,0 +1,9 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<title>aert1.0/1.1.10</title>
</head>
<body>
<script><!-- do nothing --></script>
</body>
</html>

View file

@ -0,0 +1,3 @@
char-encoding: latin1
accessibility-check: 2
show-info: no

View file

@ -0,0 +1,23 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<title>aert1.0/1.1.12</title>
</head>
<body>
<pre>
% __ __ __ __ __ __ __ __ __ __ __ __ __ __
100 | * |
90 | * * |
80 | * * |
70 | @ * |
60 | @ * |
50 | * @ * |
40 | @ * |
30 | * @ @ @ * |
20 | |
10 | @ @ @ @ @ |
0 5 10 15 20 25 30 35 40 45 50 55 60 65 70
Flash frequency (Hertz)
</pre>
</body>
</html>

View file

@ -0,0 +1,3 @@
char-encoding: latin1
accessibility-check: 1
show-info: no

View file

@ -0,0 +1,3 @@
char-encoding: latin1
accessibility-check: 1
show-info: no

View file

@ -0,0 +1,9 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<title>aert1.0/1.1.1</title>
</head>
<body>
<img src="hasAlt.gif" alt="0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789">
</body>
</html>

View file

@ -0,0 +1,9 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<title>aert1.0/1.1.1</title>
</head>
<body>
<img src="noAlt.jpg">
</body>
</html>

View file

@ -0,0 +1,3 @@
char-encoding: latin1
accessibility-check: 1
show-info: no

View file

@ -0,0 +1,9 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<title>aert1.0/1.1.1</title>
</head>
<body>
<img src="gifimage.gif" alt="gifimage.gif">
</body>
</html>

View file

@ -0,0 +1,3 @@
char-encoding: latin1
accessibility-check: 1
show-info: no

View file

@ -0,0 +1,9 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<title>aert1.0/1.1.1</title>
</head>
<body>
<img src="bytesImage.gif" alt="34K bytes">
</body>
</html>

View file

@ -0,0 +1,3 @@
char-encoding: latin1
accessibility-check: 1
show-info: no

View file

@ -0,0 +1,9 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<title>aert1.0/1.1.1</title>
</head>
<body>
<img src="animage.gif" alt="{short description of image}">
</body>
</html>

View file

@ -0,0 +1,3 @@
char-encoding: latin1
accessibility-check: 1
show-info: no

View file

@ -0,0 +1,9 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<title>aert1.0/1.1.2</title>
</head>
<body>
<img src="pie-chart.jpg" alt="Pie chart of federal expenditures">
</body>
</html>

View file

@ -0,0 +1,3 @@
char-encoding: latin1
accessibility-check: 1
show-info: no

View file

@ -0,0 +1,9 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<title>bobby/g13</title>
</head>
<body>
<img src="pie-chart.jpg" longdesc="pie-chart.html" alt="Pie chart of federal expenditures">
</body>
</html>

View file

@ -0,0 +1,3 @@
char-encoding: latin1
accessibility-check: 1
show-info: no

View file

@ -0,0 +1,10 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<title>aert1.0/1.1.2</title>
</head>
<body>
<img src="pie-chart.jpg" alt="Pie chart of federal expenditures">
<a href="pie-chart.html">D</a>
</body>
</html>

View file

@ -0,0 +1,3 @@
char-encoding: latin1
accessibility-check: 1
show-info: no

Some files were not shown because too many files have changed in this diff Show more