Skip to content

Commit 744b69e

Browse files
committed
Merge pull request #2 from mojavelinux/upstream-5_1_36
resolves #1 fast-forward to upstream (v5.1.36) and update Makefile
2 parents 0c71851 + 385a6dd commit 744b69e

File tree

587 files changed

+37150
-4051
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

587 files changed

+37150
-4051
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,4 @@ temp*
3131
*.bak
3232
.DS_Store
3333
.idea
34+
*.old

CMakeLists.txt

Lines changed: 196 additions & 62 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 5 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,9 @@
11
# HTML Tidy with HTML5 support
22

3-
## Prerequisites
3+
All READMEs and related materials have been relocated into [README/][1].
44

5-
1. git - http://git-scm.com/book/en/v2/Getting-Started-Installing-Git
6-
7-
2. cmake - http://www.cmake.org/download/
8-
9-
3. appropriate build tools for the platform
10-
11-
CMake comes in two forms - command line and gui. Some installations only install one or the other, but sometimes both. The build commands below are only for the command line use.
5+
For build instructions please see [README/README.md][2].
126

13-
Also the actual build tools vary for each platform. But that is one of the great features of cmake, it can generate variuous 'native' build files. Running cmake without any parameters will list the generators available on that platform. For sure one of the common ones is "Unix Makefiles", which needs autotools make installed, but many other generators are supported.
14-
15-
In windows cmake offers various versions of MSVC. Again below only the command line use of MSVC is shown, but the tidy solution (*.sln) file can be loaded into the MSVC IDE, and the building done in there.
16-
17-
18-
## Build the tidy library and command line tool
19-
20-
1. `cd build/cmake`
21-
22-
2. `cmake ../.. [-DCMAKE_INSTALL_PREFIX=/path/for/install]`
23-
24-
3. Windows: `cmake --build . --config Release`
25-
Unix/OS X: `make`
26-
27-
4. Install, if desired:
28-
Windows: `cmake --build . --config Release --target INSTALL`
29-
Unix/OS X: `[sudo] make install`
30-
31-
By default cmake sets the install path to /usr/local in unix. If you wanted the binary in say /usr/bin instead, then in 2. above use -DCMAKE_INSTALL_PREFIX=/usr
32-
33-
In windows the default install is to C:\Program Files\tidy5, or C:/Program Files (x86)/tidy5, which is not very useful. After the build the tidy[n].exe is in the Release directory, and can be copied to any directory in your PATH environment variable, for global use.
34-
35-
If you need the tidy library built as a 'shared' (DLL) library, then in 2. add the command -DBUILD_SHARED_LIB:BOOL=ON. This option is OFF by default, so the static library is built and linked with the command line tool for convenience.
36-
37-
## Prebuilt Binaries
38-
39-
An attempt is being made to publish pre-built binaries to http://www.htacg.org/binaries - This is still a work in progress, but getting there..
40-
41-
## History
42-
43-
This repository should be considered canonical for HTML Tidy as of 2015-January-15.
44-
45-
- This repository originally transferred from [w3c.github.com/tidy-html5][1].
46-
47-
- First moved to Github from [tidy.sourceforge.net][2].
48-
49-
50-
[1]: http://w3c.github.com/tidy-html5/
51-
52-
[2]: http://tidy.sourceforge.net
53-
54-
; eof
7+
[1]: https://github.com/htacg/tidy-html5/tree/master/README
8+
[2]:https://github.com/htacg/tidy-html5/blob/master/README/README.md
9+

README/CODESTYLE.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# HTML Tidy Code Style
2+
3+
The source code of **libTidy**, and console app **tidy**, follow the preferences of the original maintainers. Perhaps some of these decisions were arbitrary and based on their sense of aesthetics at the time, but it is good to have all the code looking the same even if it is not exactly what everyone would prefer.
4+
5+
Developers adding code to **Tidy!** are urged to try to follow the existing code style. Code that does not follow these conventions may be accepted, but may be modified as time goes by to best fit the `Tidy Style`.
6+
7+
There has been a suggestion of using available utilities to make the style consistent, like [Uncrusty](https://github/bengardener/uncrusty) - see [issue #245](https://github.com/htacg/tidy-html5/issues/245), and maybe others...
8+
9+
Others have suggested the [AStyle](http://astyle.sourceforge.net/) formatting program with say '-taOHUKk3 -M8' arguments, to conform, but there are a few bugs in AStyle.
10+
11+
But again these, and other tools, may not produce code that everybody agrees with... and are presently not formally used in Tidy!
12+
13+
#### Known Conventions
14+
15+
From reading of the Tidy source, some things are self evident... in no particular order...
16+
17+
- Use of 4-space indenting, and no tabs.
18+
- No C++ single line comments using `//`.
19+
- The openning `{` is indented on the next newline.
20+
- While the maximum code line length varies, generally long `if`, `while`, ... statements are wrapped to newlines.
21+
22+
Look forward to this document being filled out in detail...
23+
24+
Date: 20150904

README/CONTRIBUTING.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Contributing to HTML Tidy
2+
3+
So you want to contribute to Tidy? Fantastic! Here's a brief overview on how best to do so.
4+
5+
### Support request
6+
7+
If you are having trouble running console `Tidy`, or using the `Tidy Library` API in your own project, then maybe the best places to get help is either via a comment in [Tidy Issues](https://github.com/htacg/tidy-html5/issues), or on the [Tidy Mail Archive](https://lists.w3.org/Archives/Public/html-tidy/) list.
8+
9+
In either place please start with a short subject to describe the issue. If it involves running tidy on a html file, or an API question, make sure to include the version: `$ tidy -v`; what was the configuration used; a small sample input; the output, and the output expected; some sample code, to make quick testing easy.
10+
11+
If you do add a sample html input, then it can also be very helpful if that sample **passes** the W3C [validation](https://validator.w3.org/#validate_by_upload)... tidy attempts to follow all current W3C standards...
12+
13+
If you are able to build tidy from [source](https://github.com/htacg/tidy-html5), requires [CMake](https://cmake.org/download/), and can find the problem in the code, then read on about how you can create a `Pull Request`... share your code, ideas, ....
14+
15+
### What to change
16+
17+
Here are some examples of things you might want to make a pull request for:
18+
19+
- New features
20+
- Bug fixes
21+
- Inefficient blocks of code
22+
- Memory problems
23+
- Language translations
24+
25+
If you have a more deeply-rooted problem with how the program is built or some of the stylistic decisions made in the code, it is best to [create an issue](https://github.com/htacg/tidy-html5/issues/new) before putting the effort into a pull request. The same goes for new features - it might be best to check the project's direction, existing pull requests, and currently open and closed issues first.
26+
27+
Concerning the 'Tidy Code Style', checkout [CODESTYLE.md](CODESTYLE.md), but looking at existing code is the best way to get a good feel for the patterns we use.
28+
29+
### Using Git appropriately
30+
31+
1. Fork the repository to your GitHub account.
32+
2. Optionally create a **topical branch** - a branch whose name is succint but explains what
33+
you're doing, such as "feature/add-new-lines"...
34+
3. Make your changes, committing at logical breaks.
35+
4. Push your work to your personal account.
36+
5. [Create a pull request](https://help.github.com/articles/using-pull-requests).
37+
6. Watch for comments or acceptance.
38+
39+
Please note - if you want to change multiple things that don't depend on each
40+
other, it is better to use `branches`, and make sure you check the master branch back out before making more changes - that way we can take in each change seperate. Else github has a tendancy to combine your requests into one.
41+
42+
If you are a continuing contributor then you will need to `rebase` your fork, to htacg `master`, **before** doing any more work, and likewise branches, otherwise we may not be able to cleanly merge your PR. This is a simple process -
43+
44+
```
45+
$ git remote add upstream [email protected]:htacg/tidy-html5.git # once only
46+
$ git checkout master
47+
$ git status
48+
$ git stash # if not clean
49+
$ git fetch upstream
50+
$ git rebase upstream/master
51+
$ git stash pop # if required, and fix conflicts
52+
$ git push # update the fork master
53+
```
54+
55+
This can be repeated for `branches`.
56+
57+
### Help Tidy Get Better
58+
59+
It goes without saying **all help is appreciated**. We need to work together to make Tidy! better...
File renamed without changes.
File renamed without changes.

README/LOCALIZE.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Localize HTML Tidy
2+
3+
HTML Tidy is used worldwide but is not very friendly to non-English speakers.
4+
The latest versions of HTML Tidy and `libtidy` now support other languages and
5+
regional variations, but we need your help to make it accessible to these users
6+
by using your knowledge of other languages to make Tidy better.
7+
8+
Help us translate HTML Tidy into another language and as part of our project
9+
team you will certainly earn the admiration of fellow Tidy users worldwide.
10+
11+
12+
## How to Contribute
13+
14+
All READMEs (including [instructions][2] on how to localize Tidy) and related
15+
materials can be found in [localize][1].
16+
17+
[1]: https://github.com/htacg/tidy-html5/tree/master/localize
18+
[2]:https://github.com/htacg/tidy-html5/blob/master/localize/README.md
19+
File renamed without changes.

README/README.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# HTML Tidy with HTML5 support
2+
3+
## Prerequisites
4+
5+
1. git - http://git-scm.com/book/en/v2/Getting-Started-Installing-Git
6+
7+
2. cmake - http://www.cmake.org/download/
8+
9+
3. appropriate build tools for the platform
10+
11+
CMake comes in two forms - command line and gui. Some installations only install one or the other, but sometimes both. The build commands below are only for the command line use.
12+
13+
Also the actual build tools vary for each platform. But that is one of the great features of cmake, it can generate variuous 'native' build files. Running cmake without any parameters will list the generators available on that platform. For sure one of the common ones is "Unix Makefiles", which needs autotools make installed, but many other generators are supported.
14+
15+
In windows cmake offers various versions of MSVC. Again below only the command line use of MSVC is shown, but the tidy solution (*.sln) file can be loaded into the MSVC IDE, and the building done in there.
16+
17+
18+
## Build the tidy library and command line tool
19+
20+
1. `cd build/cmake`
21+
22+
2. `cmake ../.. [-DCMAKE_INSTALL_PREFIX=/path/for/install]`
23+
24+
3. Windows: `cmake --build . --config Release`
25+
Unix/OS X: `make`
26+
27+
4. Install, if desired:
28+
Windows: `cmake --build . --config Release --target INSTALL`
29+
Unix/OS X: `[sudo] make install`
30+
31+
By default cmake sets the install path to /usr/local in unix. If you wanted the binary in say /usr/bin instead, then in 2. above use -DCMAKE_INSTALL_PREFIX=/usr
32+
33+
Also, in unix if you want to build the release library without any debug `assert` in the code then add `-DCMAKE_BUILD_TYPE=Release` in step 2. This adds a `-DNDEBUG` macro to the compile switches. This is normally added in windows build for the `Release` config.
34+
35+
In windows the default install is to C:\Program Files\tidy5, or C:/Program Files (x86)/tidy5, which is not very useful. After the build the tidy[n].exe is in the Release directory, and can be copied to any directory in your PATH environment variable, for global use.
36+
37+
If you do **not** need the tidy library built as a 'shared' (DLL) library, then in 2. add the command -DBUILD_SHARED_LIB:BOOL=OFF. This option is ON by default. The static library is always built and linked with the command line tool for convenience in windows, and so the binary can be run as part of the man page build without the shared library being installed in unix.
38+
39+
## Build PHP with the tidy-html5 library
40+
41+
Due to API changes in the PHP source, "buffio.h" needs to be changed to "tidybuffio.h" in the file ext/tidy/tidy.c.
42+
43+
That is - prior to configuring php run this in the php source directory:
44+
```
45+
sed -i 's/buffio.h/tidybuffio.h/' ext/tidy/*.c
46+
```
47+
48+
And then continue with (just an example here, use your own php config options):
49+
50+
```
51+
./configure --with-tidy=/usr/local
52+
make
53+
make test
54+
make install
55+
```
56+
57+
## Important Links
58+
59+
- site: http://www.html-tidy.org/
60+
- source: https://github.com/htacg/tidy-html5
61+
- binaries: http://www.htacg.org/binaries/
62+
- bugs: https://github.com/htacg/tidy-html5/issues
63+
- list: https://lists.w3.org/Archives/Public/html-tidy/
64+
- api: http://www.htacg.org/tidy-html5/tidylib_api/
65+
- quickref: http://www.htacg.org/tidy-html5/quickref.html
66+
67+
## Development
68+
69+
The default branch of this repository is `master`. This is the development branch, hopefully always `stable` source.
70+
71+
It will identify as library version X.odd.X. Use it to help us on the forever `bug` quest, addition of new features, options, ..., etc.
72+
73+
However, if you seek **release** code, then do `git branch -r`, and choose one of the `release/X.even.0` branches for your build and install...
74+
75+
This will always be the latest release branch. Important `bug` fixes thought relevant to this release, pushed back, may bump the library version to X.even.1, ..., etc, but will be remain known as `X.even`...
76+
77+
Some more details of the `Tidy Version` can be found in [VERSION.md](VERSION.md).
78+
79+
Concerning the `Tidy Code Style`, some notes can be found in [CODESTYLE.md](CODESTYLE.md).
80+
81+
If you want to contribute to Tidy, then read [CONTRIBUTING.md](CONTRIBUTING.md).
82+
83+
## History
84+
85+
This repository should be considered canonical for HTML Tidy as of 2015-January-15.
86+
87+
- This repository originally transferred from [w3c.github.com/tidy-html5][1].
88+
89+
- First moved to Github from [tidy.sourceforge.net][2].
90+
91+
92+
[1]: http://w3c.github.com/tidy-html5/
93+
94+
[2]: http://tidy.sourceforge.net

README/VERSION.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Tidy Library Versioning
2+
3+
The **libTidy** version is controlled by the contents of `version.txt` in the root.
4+
5+
This file consists of two lines of dot (.) separated items. The first being the MAJOR, MINOR, and PATCH version values, and the second string is a date. Example -
6+
7+
```
8+
5.1.8
9+
2015.09.04
10+
```
11+
12+
When cmake is run this file is read and two MACROS added to the compile flags -
13+
14+
```
15+
add_definitions ( -DLIBTIDY_VERSION="${LIBTIDY_VERSION}" )
16+
add_definitions ( -DRELEASE_DATE="${tidy_YEAR}/${tidy_MONTH}/${tidy_DAY}" )
17+
```
18+
19+
And in CMakeLists.txt there is the posibility to define another MACRO, when and if required -
20+
21+
```
22+
# add_definitions ( -DRC_NUMBER="D231" )
23+
```
24+
25+
These MACROS are put in static const char strings in **libTidy's** `internal` only src/version.h file -
26+
27+
```
28+
static const char TY_(release_date)[] = RELEASE_DATE;
29+
#ifdef RC_NUMBER
30+
static const char TY_(library_version)[] = LIBTIDY_VERSION "." RC_NUMBER;
31+
#else
32+
static const char TY_(library_version)[] = LIBTIDY_VERSION;
33+
#endif
34+
```
35+
36+
These strings are returned respectively by the **libTidy** API functions -
37+
38+
```
39+
TIDY_EXPORT ctmbstr TIDY_CALL tidyLibraryVersion(void);
40+
TIDY_EXPORT ctmbstr TIDY_CALL tidyReleaseDate(void);
41+
```
42+
43+
**NOTE**: `tidyReleaseDate()` is marked deprecated!
44+
45+
The actual `versioning` of the library more or less follows the [Semantic Versioning](http://semver.org/) style.
46+
47+
When a `release` is done a release/5.0.0 **branch**, and a similar release/5.0.0 **tag** is created.
48+
49+
At that point the version.txt is set to the next, 5.1.0.
50+
51+
That is the `master` branch will contain the ongoing development. Any subsequent good bug fixes found for some time after that will be carefully tested and push back (cherry picked I think is the correct term) into the release/5.0.0, making it 5.0.1...
52+
53+
And on just about each fix, or feature addition to the `master` will bump the version to 5.1.1, 5.1.2, 5.1.3, and so on... even 5.1.4567 if necessary ;=)).
54+
55+
When ready for the next release, say some 6 months or so later, then a branch `release/5.2.0` would be created, and tagged, and the master version.txt moved on to 5.3.0, and so on...
56+
57+
That is, each `release` will have an `even` second digit, followed by .0, unless any subsequent fixes are pushed back, making it .1, ... probably not many of those... while the `master` develoment HEAD will have an `odd` second digit, followed by .0, incremented for just about each significant code change...
58+
59+
The intial MAJOR digit, 5, will be maintained while the **libTidy** API remains fully compatible, although there may be additions, extensions, as and when these are identified...
60+
61+
And throughout this, every effort will be made to keep `master` **stable** at all times, but would expect package managers to eventually really only pick up on the `release` branches, tags.
62+
63+
In cases of significant code re-writes, major featues added, these would be done in branches until they are `stable` enought, and tested enough, to be merge back to `master`.
64+
65+
Date: 20150904

0 commit comments

Comments
 (0)