Skip to content
This repository was archived by the owner on Feb 3, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.c9*
.settings
node_modules

.DS_Store
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
examples
vendor
.npm*
21 changes: 19 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ such as XSL transforms.

Installation
------------
To use this library simply install it using [npm](http://npmjs.org/):
To use this library add the following line to your package.json dependencies

npm install htmltidy
"htmltidy": "git+https://github.com/bnicholas/htmltidy.git"

Example
-------
Expand Down Expand Up @@ -58,8 +58,25 @@ Platform support
* Windows
* OSX (experimental)


Running on Heroku Cedar
-----------------------
Add the following folder to your project root .heroku

Copy the vendor folder from this module into .heroku

From the root of your project cp -rf ./node_modules/htmltidy/vendor ./.heroku/

http://www.saintsjd.com/2014/05/12/run-vendored-binaries-on-heroku.html

"On your next push to heroku, the system path will recognize the binary dependencies in your path LD_LIBRARY_PATH."


Changelog
---------
0.0.7 - Oct 15, 2014
- updated linux binary built against heroku cedar
- added required static binary for heroku
0.0.6 - Apr 18, 2013
- bug fix update
0.0.5 - Feb 25, 2013
Expand Down
Binary file modified bin/linux/tidy
Binary file not shown.
4 changes: 4 additions & 0 deletions htmltidy.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ var DEFAULT_OPTS = {
// choose suitable executable
var tidyExec = chooseExec();

// heroku config:add PATH=vendor/tidy/bin:vendor/tidy/lib:/usr/bin:/bin
// heroku config:add LD_LIBRARY_PATH=vendor/tidy/lib
// var tidyExec = tidy;

function TidyWorker(opts) {
Stream.call(this);

Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
{
"name": "htmltidy",
"description": "tidy bad html",
"version": "0.0.6",
"version": "0.0.7",
"author": "lauris <lauris@ma-1.lv>",
"contributors": [
{
"name": "Keith Rosenberg",
"email": "kthrose@netpoetica.com"
},
{
"name": "Brian Nicholas",
"email": "uibri@me.com"
}
],
"main": "htmltidy.js",
Expand Down
Binary file added vendor/bin/tab2space
Binary file not shown.
Binary file added vendor/bin/tidy
Binary file not shown.
118 changes: 118 additions & 0 deletions vendor/include/buffio.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
#ifndef __TIDY_BUFFIO_H__
#define __TIDY_BUFFIO_H__

/** @file buffio.h - Treat buffer as an I/O stream.

(c) 1998-2007 (W3C) MIT, ERCIM, Keio University
See tidy.h for the copyright notice.

CVS Info :

$Author: arnaud02 $
$Date: 2007/01/23 11:17:45 $
$Revision: 1.9 $

Requires buffer to automatically grow as bytes are added.
Must keep track of current read and write points.

*/

#include "platform.h"
#include "tidy.h"

#ifdef __cplusplus
extern "C" {
#endif

/** TidyBuffer - A chunk of memory */
TIDY_STRUCT
struct _TidyBuffer
{
TidyAllocator* allocator; /**< Memory allocator */
byte* bp; /**< Pointer to bytes */
uint size; /**< # bytes currently in use */
uint allocated; /**< # bytes allocated */
uint next; /**< Offset of current input position */
};

/** Initialize data structure using the default allocator */
TIDY_EXPORT void TIDY_CALL tidyBufInit( TidyBuffer* buf );

/** Initialize data structure using the given custom allocator */
TIDY_EXPORT void TIDY_CALL tidyBufInitWithAllocator( TidyBuffer* buf, TidyAllocator* allocator );

/** Free current buffer, allocate given amount, reset input pointer,
use the default allocator */
TIDY_EXPORT void TIDY_CALL tidyBufAlloc( TidyBuffer* buf, uint allocSize );

/** Free current buffer, allocate given amount, reset input pointer,
use the given custom allocator */
TIDY_EXPORT void TIDY_CALL tidyBufAllocWithAllocator( TidyBuffer* buf,
TidyAllocator* allocator,
uint allocSize );

/** Expand buffer to given size.
** Chunk size is minimum growth. Pass 0 for default of 256 bytes.
*/
TIDY_EXPORT void TIDY_CALL tidyBufCheckAlloc( TidyBuffer* buf,
uint allocSize, uint chunkSize );

/** Free current contents and zero out */
TIDY_EXPORT void TIDY_CALL tidyBufFree( TidyBuffer* buf );

/** Set buffer bytes to 0 */
TIDY_EXPORT void TIDY_CALL tidyBufClear( TidyBuffer* buf );

/** Attach to existing buffer */
TIDY_EXPORT void TIDY_CALL tidyBufAttach( TidyBuffer* buf, byte* bp, uint size );

/** Detach from buffer. Caller must free. */
TIDY_EXPORT void TIDY_CALL tidyBufDetach( TidyBuffer* buf );


/** Append bytes to buffer. Expand if necessary. */
TIDY_EXPORT void TIDY_CALL tidyBufAppend( TidyBuffer* buf, void* vp, uint size );

/** Append one byte to buffer. Expand if necessary. */
TIDY_EXPORT void TIDY_CALL tidyBufPutByte( TidyBuffer* buf, byte bv );

/** Get byte from end of buffer */
TIDY_EXPORT int TIDY_CALL tidyBufPopByte( TidyBuffer* buf );


/** Get byte from front of buffer. Increment input offset. */
TIDY_EXPORT int TIDY_CALL tidyBufGetByte( TidyBuffer* buf );

/** At end of buffer? */
TIDY_EXPORT Bool TIDY_CALL tidyBufEndOfInput( TidyBuffer* buf );

/** Put a byte back into the buffer. Decrement input offset. */
TIDY_EXPORT void TIDY_CALL tidyBufUngetByte( TidyBuffer* buf, byte bv );


/**************
TIDY
**************/

/* Forward declarations
*/

/** Initialize a buffer input source */
TIDY_EXPORT void TIDY_CALL tidyInitInputBuffer( TidyInputSource* inp, TidyBuffer* buf );

/** Initialize a buffer output sink */
TIDY_EXPORT void TIDY_CALL tidyInitOutputBuffer( TidyOutputSink* outp, TidyBuffer* buf );

#ifdef __cplusplus
}
#endif
#endif /* __TIDY_BUFFIO_H__ */

/*
* local variables:
* mode: c
* indent-tabs-mode: nil
* c-basic-offset: 4
* eval: (c-set-offset 'substatement-open 0)
* end:
*/
Loading