diff --git a/README.md b/README.md index 77c53d0..3fedca2 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Cheerio-tableparser parse HTML tables, group them by columns, with colspan and r | | | 4b | 5b | | | 2b |-----------| | 1a | | | 5c | - | |-----------| 4c |---- | + | |-----------| 4c |-----| | | | 3d | | 5d | | | 2d |-----------------| | | | 3e | 4e | 5e | @@ -39,7 +39,7 @@ $ = cheerio.load(" \
"); cheerioTableparser($); -var data = $("#complex").parsetable(true, true, false); +var data = $("#complex").parsetable(true, true, true); //data = > //[ [ 'A', '1a', '1a', '1a', '1a', '1a' ], // [ 'B', '2a', '2b', '2b', '2d', '2d' ], @@ -174,6 +174,17 @@ var data = $("#html").parsetable(false, false, false); //data = > //[ [ 'A', '
1a
' ], // [ 'B', '
2a
' ] ] + +//To make jquery object from string use $('
' + data[0][0]+ '
'); +//additional "div" needed if data[0][0] is not valid html string. + +//Example: +var strong = $('
' + data[0][0] + '
').find('strong').text(); +//strong = > 'A' + +var tableText = $('
' + data[0][1] + '
').find('.table-text').text(); +//tableText = > '1a' + ``` #### Return data as Text diff --git a/package.json b/package.json index 0e09a45..1bacc5b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cheerio-tableparser", - "version": "1.0.0", + "version": "1.0.1", "description": "The tables parser plugin for cheerio", "main": "index.js", "keywords": [