Commit Graph

307 Commits

Author SHA1 Message Date
Wilson Lin 126c719d23 Merge entity code; simplify build IO 2019-12-29 21:51:25 +11:00
Wilson Lin 7f56cff39e Remove date in comment 2019-12-29 21:42:03 +11:00
Wilson Lin 2149d20ae5 Generate patterns at compile time; update comment on entities; fix unused code 2019-12-29 21:39:29 +11:00
Wilson Lin 53904f1956 Build entities trie at compile time; support entities without semicolon 2019-12-29 21:00:20 +11:00
Wilson Lin 95be64d868 Fix entity decoding in attribute; create fuzzer project; simplify code 2019-12-28 23:06:04 +11:00
Wilson Lin 492eb64e4f Update README to describe whitespace minification; do not destroy whole whitespace in content-first elements 2019-12-28 17:15:23 +11:00
Wilson Lin 5f8da411b3 Clear out archive and unused tag names sets; update README with whitespace minification modes 2019-12-28 11:58:01 +11:00
Wilson Lin 1db8f4aa13 Enforce no whitespace between attribute name and value 2019-12-28 11:21:44 +11:00
Wilson Lin 530b7d7410 Fix writing UTF-8; update README 2019-12-28 11:16:28 +11:00
Wilson Lin 0b3e662d63 Update README; fix entity decoding in content 2019-12-27 22:32:04 +11:00
Wilson Lin a14def709f Update README; cleanup comments 2019-12-27 22:14:03 +11:00
Wilson Lin e15381c1cb Handle text script content 2019-12-27 21:52:49 +11:00
Wilson Lin a76c1f3cd5 Fix entity decoding in attribute value; enforce valid Unicode Scalar Value numeric entity refs; update named entities; error messages for CLI; support post-minification empty attributes 2019-12-27 00:23:33 +11:00
Wilson Lin 4ef7574487 Update README; clear old files; fix long lived ranges 2019-12-26 17:16:13 +11:00
Wilson Lin 4ddcb36e42 Faster non-sequence matching; improved attribute value minification 2019-12-26 16:17:57 +11:00
Wilson Lin da796a5839 Refactoring; fix whitespace minification in content 2019-12-26 13:47:18 +11:00
Wilson Lin 85a388d7c8 Develop basic CLI and get working 2019-12-25 23:29:18 +11:00
Wilson Lin 806560dd94 Complete initial migration to Rust 2019-12-25 20:44:51 +11:00
Wilson Lin d75d62883b Migrate mostly to Rust with significant optimisations and refactoring 2019-12-23 22:48:41 +11:00
Wilson Lin 2f24d2e618 Remove C infrastructure 2019-12-15 19:48:44 +11:00
Wilson Lin 1fb675ef91 Start migration to Rust 2019-12-15 19:37:53 +11:00
Wilson Lin 73ffe4ea88 Minor refactoring 2019-11-18 12:30:13 +11:00
Wilson Lin ba03841945 Complete refactoring; move CLI to separate project 2019-04-30 00:09:51 +10:00
Wilson Lin 104e55c778 Complete refactor of bang, comment, and attribute units 2019-04-22 17:03:21 +10:00
Wilson Lin 8b6e4c5c0b Don't decode entities in quoted attribute values if cfg says so 2019-04-22 17:02:57 +10:00
Wilson Lin e8fd813a2e Implement an accept function accepts if next character doesn't match some provided character
This makes it easy to do something like "accept until".
2019-04-22 17:01:35 +10:00
Wilson Lin d782d21108 Fix proc offset documentation and behaviour mismatch 2019-04-22 17:00:16 +10:00
Wilson Lin ba9e17b6bc Fix entity unit not writing complete entity if not decoding 2019-04-22 16:58:46 +10:00
Wilson Lin 4b4622b73f Update rules to use new nicehash; complete refactor of units attr, attr/unquoted, attr/quoted, entity, and tag/name; improve cfg usage 2019-04-21 02:40:25 +10:00
Wilson Lin e0bba6ac19 Complete restructuring of rule 2019-04-10 17:05:47 +10:00
Wilson Lin df4044d332 Refactor most of core, proc, and rule 2019-04-09 23:16:29 +10:00
Wilson Lin 39e0260f73 Begin restructuring 2019-03-18 22:46:04 +11:00
Wilson Lin 4b98c6a6b2 Incomplete major refactoring 2019-01-25 21:25:10 +13:00
Wilson Lin 277ea3303c Refactor out Emscripten version and restructure 2018-10-26 00:54:54 +13:00
Wilson Lin 7bdefd916a Don't do preprocessing anymore 2018-09-30 01:00:27 +12:00
Wilson Lin 21c4b75d4c Add hbu_pipe_skip_if 2018-09-30 00:59:53 +12:00
Wilson Lin c4b8c3128b Exit with 0 instead of EXIT_SUCCESS 2018-09-30 00:59:43 +12:00
Wilson Lin 198704d344 Add test for whitespace minification at root 2018-08-23 00:36:25 +12:00
Wilson Lin 52bcc4fde7 Handle errors gracefully by unwinding stack; implement Emscripten version 2018-08-22 03:02:14 +12:00
Wilson Lin a929268cc0 Add missing type info to pipe data in TS 2018-08-14 15:59:17 +12:00
Wilson Lin 69e2a66ee9 Pooling POC 2018-08-11 01:42:12 +12:00
Wilson Lin 10c49d152d Start directives stream 2018-08-10 22:02:35 +12:00
Wilson Lin 376afcd793 Fix entity stream refactoring 2018-08-10 22:01:27 +12:00
Wilson Lin 9ab8a0fafb Allow buffers as pipe inputs and give pipes an input_name 2018-08-10 22:00:53 +12:00
Wilson Lin 1df4fab239 Lazy-load and reuse default tags set options, and fix no value not being accepted as CLI tags list option values 2018-08-10 21:59:16 +12:00
Wilson Lin c16a77a568 Process entities in attribute values and ensure unquoted attribute values have at least one character 2018-08-09 15:48:34 +12:00
Wilson Lin 6fcdae711b Minify attribute value quotes 2018-08-08 16:58:54 +12:00
Wilson Lin a24f5a904e Implement pipe require_skip_predicate 2018-08-08 16:58:08 +12:00
Wilson Lin 6abb16ef18 Implement pipe output redirects 2018-08-08 16:57:55 +12:00
Wilson Lin 17896a20c4 Minify tag whitespace 2018-08-08 14:31:28 +12:00
Wilson Lin 6503cfa376 Fix removal of whitespace in specific attribute values 2018-08-08 13:39:43 +12:00
Wilson Lin 4f41c7d197 Fix parsing of tags 2018-08-08 13:39:32 +12:00
Wilson Lin 61649ea46a Clarify standard tags requirement in CLI tag list option arguments 2018-08-08 13:39:22 +12:00
Wilson Lin 7be3f6b09b Add more context to UNCLOSED_TAG error message 2018-08-08 13:38:50 +12:00
Wilson Lin d1f3476f4b Allow colons and hyphens in tag names 2018-08-08 13:38:32 +12:00
Wilson Lin e61ca93d21 Return acceptance count to while_predicate 2018-08-08 13:38:16 +12:00
Wilson Lin 59971c7319 Create case-insensitive matcher 2018-08-08 13:37:58 +12:00
Wilson Lin f0e5b5e66e Fix script tag comment parsing 2018-08-08 13:37:29 +12:00
Wilson Lin 48820d8377 Allow formatting in hbu_pipe_error 2018-08-08 13:37:06 +12:00
Wilson Lin b382fb9bd0 Clean up JS error messages 2018-08-08 11:09:37 +12:00
Wilson Lin 6db5e5c0a7 Make bare ampersands a separate error 2018-08-08 11:09:06 +12:00
Wilson Lin 6ca4363936 Fix double free error when expanding lists 2018-08-08 10:41:56 +12:00
Wilson Lin e2e12f408b More memory cleanup and safety 2018-08-08 10:41:39 +12:00
Wilson Lin 78b4ccf6a8 Detect memory allocation failures 2018-08-08 10:40:30 +12:00
Wilson Lin 959156c261 Fix bang parsing 2018-08-08 10:37:32 +12:00
Wilson Lin 2997fab7cd Minify class attribute values 2018-08-07 16:25:15 +12:00
Wilson Lin 73839141d3 Fix UCASE_ATTR enforcement 2018-08-07 16:24:57 +12:00
Wilson Lin f73cb82cd1 Enforce ILLEGAL_CHILD 2018-08-07 16:02:32 +12:00
Wilson Lin f8f884373f Minor fixes to internal documentation 2018-08-07 14:47:56 +12:00
Wilson Lin 4cee9588ac Update and simplify tests 2018-08-07 10:37:54 +12:00
Wilson Lin d6081bdd19 Enforce UNQUOTED_ATTR 2018-08-05 13:04:01 +12:00
Wilson Lin b42818a2e7 Simplify JS wrapper function 2018-08-05 12:58:24 +12:00
Wilson Lin d0dd65dde7 Parse response messages in JS better 2018-08-05 01:41:12 +12:00
Wilson Lin 89921f9397 Enforce UCASE_TAG 2018-08-04 23:52:06 +12:00
Wilson Lin 8d46291542 Fix passing array-based args via JS 2018-08-04 23:42:02 +12:00
Wilson Lin acbd843aa2 Make self-closing tags errors 2018-08-04 23:41:44 +12:00
Wilson Lin 4b740c23df Fix UCASE_ATTR not accepted in CLI 2018-08-04 23:41:17 +12:00
Wilson Lin 2a40290d7f Create wrapper Node.js module and tests 2018-08-04 22:38:17 +12:00
Wilson Lin 036dbb4c4b Enforce UCASE_ATTR 2018-08-04 22:37:41 +12:00
Wilson Lin 71c5ffd6fd Fix destroy whole whitespace minification 2018-08-04 22:37:26 +12:00
Wilson Lin 9ddba89e67 Internal documentation 2018-08-04 22:36:32 +12:00
Wilson Lin 9148946802 Clarify require_match functionality 2018-08-04 16:56:03 +12:00
Wilson Lin 577637c59a Respect --MXcomments 2018-08-04 16:55:50 +12:00
Wilson Lin fa635377ac Fix literal entity writer 2018-08-04 16:11:25 +12:00
Wilson Lin 9f632dd2ae Stricter content parsing 2018-08-04 16:11:11 +12:00
Wilson Lin a4edc1886a Enforce standard tags rule 2018-08-04 16:01:12 +12:00
Wilson Lin 1ce1155f1a Count SVG tags as specific tags 2018-08-04 16:01:04 +12:00
Wilson Lin 26bbe20a04 Add SVG tags to set of all tags 2018-08-04 16:00:39 +12:00
Wilson Lin c53b522c38 SVG tags 2018-08-04 16:00:22 +12:00
Wilson Lin 250a704c2e Simplify checking suppressed errors config 2018-08-04 15:59:53 +12:00
Wilson Lin bc2a935932 Minify whitespace 2018-08-04 15:38:21 +12:00
Wilson Lin 0985dafb14 Fix unrecognised suppressable error logging 2018-08-04 14:33:33 +12:00
Wilson Lin caf8dcac22 Stream entities 2018-08-04 00:15:44 +12:00
Wilson Lin d051650527 Various helper pipe write methods 2018-08-04 00:14:15 +12:00
Wilson Lin 01e805bf0d Return char on skip 2018-08-04 00:14:01 +12:00
Wilson Lin 30c322ab96 Add hex char rule 2018-08-04 00:13:44 +12:00
Wilson Lin abb47e0d15 Create lists with a specific initial size 2018-08-04 00:13:14 +12:00
Wilson Lin 90ad433c38 Fix parsing --supress 2018-08-04 00:12:34 +12:00
Wilson Lin dee2e03b21 Suppressable errors config 2018-08-03 23:02:10 +12:00
Wilson Lin cdad4f95e6 Missing include header 2018-08-03 23:01:17 +12:00
Wilson Lin a1513a88c1 Style parser 2018-08-03 23:01:07 +12:00
Wilson Lin a343241cfd Optimise script parser 2018-08-03 23:00:54 +12:00
Wilson Lin 8127690e89 Function to require from pipe but skip (don't output) 2018-08-03 22:57:56 +12:00
Wilson Lin 88017538f5 Add function to add Unicode code point to buffer 2018-08-03 22:57:30 +12:00
Wilson Lin 7dc321b86a Allow self-closing tags 2018-07-20 22:40:05 +12:00
Wilson Lin 301bd36650 Parse JS code in script tags 2018-07-20 22:39:55 +12:00
Wilson Lin cbc837978d Parse comments 2018-07-20 22:39:37 +12:00
Wilson Lin 6080451453 Parse bangs 2018-07-20 22:39:28 +12:00
Wilson Lin 2c7992585a Buffer attr name when streaming 2018-07-20 22:37:15 +12:00
Wilson Lin a5a38c3a01 Fix missing hbchar.h include in streamoptions.c 2018-07-20 22:36:57 +12:00
Wilson Lin a0573b337d Buffer comparison to const char[] 2018-07-20 22:36:34 +12:00
Wilson Lin 9ca1294f26 Debug log when EOF 2018-07-20 22:36:20 +12:00
Wilson Lin 286547e209 Fix stalled parsing when `&` reached in text node 2018-07-20 22:36:06 +12:00
Wilson Lin aa76e9e415 Fix attrvalquote set existence checking 2018-07-20 22:35:38 +12:00
Wilson Lin 0270aaa61d Add position info to expected but not found errors 2018-07-20 22:35:25 +12:00
Wilson Lin 6a53d28f5e Fix prebuffering functionality for pipes 2018-07-20 22:34:53 +12:00
Wilson Lin 379a83a4a1 Add matching functionality to pipes 2018-07-20 22:34:38 +12:00
Wilson Lin 9d52db325c Add extra logging functions for pipes and debug logging level 2018-07-20 22:33:55 +12:00
Wilson Lin 785b146e39 Add base tag 2018-07-13 22:54:40 +12:00
Wilson Lin 70f4fa1a4e Querying tags list arguments 2018-07-06 22:59:51 +12:00
Wilson Lin f53f0b367c Set up default values for tags list arguments 2018-07-06 22:59:39 +12:00
Wilson Lin 2f94043ddb Fix SEGV from no NULL check when parsing `*` as tags list argument values 2018-07-06 22:58:45 +12:00
Wilson Lin 445a7e1b68 Make `code` a specific tag (instead of a formatting tag) 2018-07-06 22:06:50 +12:00
Wilson Lin 8ac0ca57b3 Allow empty tags list arguments 2018-07-06 22:02:26 +12:00
Wilson Lin 79f0d0ea4e Set up tags list arguments in CLI 2018-07-06 21:51:22 +12:00
Wilson Lin ef518866a8 List of buffers structure 2018-07-06 21:50:37 +12:00
Wilson Lin 7b6c86116a Fix missing stdlib for malloc in util/list.h 2018-07-06 21:50:28 +12:00
Wilson Lin 18401bcf7d Basic math util functions 2018-07-06 21:49:54 +12:00
Wilson Lin 3c68a9c15b Generify buffer into list 2018-07-06 21:02:43 +12:00
Wilson Lin f880acae33 Create arguments for stream options 2018-07-06 17:05:41 +12:00
Wilson Lin a1108c5327 Stream options constructor and logger 2018-07-06 17:05:12 +12:00
Wilson Lin ce162224fc Check and fail when extra arguments provided via CLI 2018-07-06 17:04:51 +12:00
Wilson Lin b4d5ae92cb Enable toggling info logging 2018-07-06 17:04:13 +12:00
Wilson Lin a67257d740 Rename debug to info (logging) 2018-07-06 17:03:26 +12:00
Wilson Lin cd306005bb Helper key-value info logging 2018-07-06 17:01:50 +12:00
Wilson Lin fcf065f1db Rename hb_r_* to hbr_* for consistency 2018-07-06 16:11:02 +12:00
Wilson Lin 52d62dd7c8 Minifier options struct 2018-07-06 16:07:20 +12:00
Wilson Lin b77f3dd03b Mask output in pipe 2018-07-06 16:07:09 +12:00
Wilson Lin 34d2d828be Colourful printing 2018-07-06 15:19:03 +12:00
Wilson Lin 2538e24a17 Set up --buffer and --keep 2018-07-06 15:18:58 +12:00
Wilson Lin 20bd56c08e Fix duplicate <caption> whitelist parents rule 2018-07-06 13:48:12 +12:00
Wilson Lin 9037789510 Auto-delete output file on error 2018-07-06 13:47:54 +12:00
Wilson Lin cabf7c4e02 Warning logging 2018-07-06 13:47:35 +12:00
Wilson Lin 0631df5dd2 Allow tag rules to be reused 2018-07-06 11:41:55 +12:00
Wilson Lin 4c70adc3b5 Minor comment clarification 2018-07-06 11:41:23 +12:00
Wilson Lin acb868ce25 Add missing tag rules initialisers to main rules init.c 2018-07-06 10:00:42 +12:00
Wilson Lin c922ae59c1 Add missing heading tags to content tags 2018-07-06 10:00:22 +12:00
Wilson Lin cf0d9cc066 `html`, `head`, `body` tags 2018-07-06 10:00:09 +12:00
Wilson Lin 0badaac1f1 Whitespace tags 2018-07-06 09:59:49 +12:00
Wilson Lin ab284aa71e Complete tag relation rules 2018-07-05 23:58:05 +12:00
Wilson Lin 2856aa71c2 Update formatting tags 2018-07-05 23:57:48 +12:00
Wilson Lin 18cc08659a Specific tags 2018-07-05 23:57:36 +12:00
Wilson Lin 041cc5a73b Layout tags 2018-07-05 23:57:29 +12:00
Wilson Lin 7f5695bf02 Content-first tags 2018-07-05 23:57:16 +12:00
Wilson Lin cc3b047e36 Content tags 2018-07-05 23:57:07 +12:00
Wilson Lin 1328d8e0e5 Standard sectioning tags 2018-07-05 23:56:32 +12:00
Wilson Lin 8a966155f6 Standard media tags 2018-07-05 23:56:19 +12:00
Wilson Lin 34ceee4048 Standard heading tags 2018-07-05 23:55:56 +12:00
Wilson Lin b803b05751 Allow no input and output in CLI, and use debug logger 2018-07-05 21:21:07 +12:00
Wilson Lin df5e05b397 Add debug logger 2018-07-05 21:20:41 +12:00
Wilson Lin cb6930d9a8 Support stdin and stdout in file stream utils 2018-07-05 21:20:26 +12:00
Wilson Lin ff984c1551 Rearrange error codes to support exit codes 2018-07-05 21:18:41 +12:00
Wilson Lin 75ed1fe903 Fix error printing line terminator to stdout 2018-07-05 21:18:09 +12:00
Wilson Lin 1c637e6a94 Fix missing loop in content stream 2018-07-05 20:56:49 +12:00
Wilson Lin 5fc5ec88d8 Fix buffer equality checker function 2018-07-05 20:56:33 +12:00
Wilson Lin ae806c9455 Error codes 2018-07-05 20:56:24 +12:00
Wilson Lin 9bdae51b01 Use streams in main.c 2018-07-05 19:55:11 +12:00
Wilson Lin e647872756 Basic tag streaming 2018-07-05 19:55:00 +12:00
Wilson Lin fefe796887 Attribute streaming 2018-07-05 19:54:30 +12:00
Wilson Lin 4a18fb3b5d Add predicates and conditional helper functions to pipe 2018-07-05 19:54:18 +12:00
Wilson Lin 978299ce46 Fix missing type casts in hbu_buffer_compare 2018-07-05 19:53:18 +12:00
Wilson Lin b56cbceb8b Remove redundant check in hbu_buffer_valid_index 2018-07-05 19:53:00 +12:00
Wilson Lin d68953cb26 Declare tag and content stream functions before defining as they depend on each other 2018-07-05 19:52:22 +12:00
Wilson Lin 26ddcc2cc6 Fix unquoted attribute rules (blacklist instead of whitelist) 2018-07-05 19:51:25 +12:00
Wilson Lin 4d5121a55d Attribute value quote rules 2018-07-05 19:50:51 +12:00
Wilson Lin 4c311819cc Use hb_char_t in rules 2018-07-05 19:50:36 +12:00
Wilson Lin 294de8a4b0 Fix nicehash include path in rules 2018-07-05 19:48:44 +12:00
Wilson Lin 3070e4af39 Use common str-int32 map declarations 2018-07-05 19:47:00 +12:00
Wilson Lin 58a39afc7c Use common Str-StrSet map declarations 2018-07-05 19:44:26 +12:00
Wilson Lin 0771faba44 Restructure and start tag stream 2018-07-05 17:00:55 +12:00
Wilson Lin e2aa3fa6f5 Start content stream 2018-07-05 17:00:39 +12:00
Wilson Lin b24b7643ef `peek_eoi`, `peek_offset`, and `require` 2018-07-05 17:00:13 +12:00
Wilson Lin c1b5259cf7 Create single rules initialiser 2018-07-05 16:58:59 +12:00
Wilson Lin 2802070624 Add `void` to parameterless functions 2018-07-05 16:58:40 +12:00
Wilson Lin 0b72e0886d Rename inline tags to formatting tags 2018-07-05 16:57:39 +12:00
Wilson Lin c8c78d5365 Add function to get underlying char array of buffer 2018-07-05 16:57:11 +12:00
Wilson Lin d3113c4047 Helper buffer comparison functions 2018-07-05 16:56:49 +12:00
Wilson Lin 3e5495297b Move pipe.c notes to notes dir 2018-07-05 16:56:26 +12:00
Wilson Lin 1b29816038 Set up basic skeleton for CLI 2018-07-04 23:26:02 +12:00
Wilson Lin d2b19de91d Create pipe 2018-07-04 23:25:45 +12:00
Wilson Lin 3c484d5c84 Create file streams 2018-07-04 23:25:38 +12:00
Wilson Lin 66c6e53eed Use common char types and defs in buffer.c 2018-07-04 23:25:11 +12:00
Wilson Lin a73b3aee5b Basic error handling 2018-07-04 23:24:32 +12:00
Wilson Lin a818e4f95a Set up common C char types and defs 2018-07-04 23:24:12 +12:00
Wilson Lin 881578349b Create buffer util 2018-07-04 00:18:16 +12:00
Wilson Lin 0626dd92ba Unquoted attribute value rules 2018-07-04 00:17:52 +12:00
Wilson Lin 33d6991eb6 Attribute name rules 2018-07-04 00:17:46 +12:00
Wilson Lin 61a9b71ea5 Tag name rules 2018-07-04 00:17:41 +12:00
Wilson Lin 47ac66dc40 Foundation rules 2018-07-04 00:17:26 +12:00
Wilson Lin 702f242a9b Restructure streams 2018-07-04 00:16:37 +12:00