|
Post by alexfish on Apr 21, 2019 19:16:56 GMT 1
Hi All
in with table formatting columns had been toying with iomanip setw(*)
also wondered if cout would print bacon strings
Playing with Columns c++ BaCon Style
BR Alex
Here we go
PRAGMA INCLUDE <iostream> PRAGMA INCLUDE <iomanip>
PRAGMA COMPILER g++ PRAGMA OPTIONS -Wno-write-strings -Wno-pointer-arith PRAGMA LDFLAGS -lcurl -lbacon++
OPTION PARSE FALSE
LOCAL lop = "hello" TYPE STRING LOCAL l,width TYPE int l= 5 width = 80 width = width/5
int t; FOR t = 1 TO 5 std::cout << lop; std::cout << std::setw(l+width/2)
NEXT
std::cout << std::setw(1) PRINT lop = "100" FOR t = 1 TO 5
std::cout << std::setw(l+width/2) std::cout << lop; NEXT PRINT std::cout << std::setw(1)
lop = "2000" FOR t = 1 TO 5
std::cout << std::setw(l+width/2) std::cout << lop; NEXT PRINT
output
hello hello hello hello hello 100 100 100 100 100 2000 2000 2000 2000 2000
|
|
|
Post by bigbass on Apr 21, 2019 20:45:57 GMT 1
Hello Alex A Very clean output of text Using html2text c++ And is very fast and light Great job!
I modified an example In golang to convert an index to Text it gave me a chance to Use golang It took me about 20 Minutes to figure out how "go html2text" worked and install it and this new golang syntax then 5 minutes to make the changes I never used golang before and just ran a few demos Before jumping into this But it seems like another Good option having code to solve the same problem using different Languges
Before I used sed with bash,perl,bacon and wanted to see the Differences In ease of use and speed
Joe
|
|
|
Post by alexfish on Apr 21, 2019 22:00:06 GMT 1
Hi Joe
Can you give a step by step install of external lib pkg like html2text go
on RPI I have standard install of
go version go version go1.3.3 linux/arm
BR Alex
|
|
|
Post by bigbass on Apr 21, 2019 23:08:33 GMT 1
Hello Alex I am using only the RPI3
go version go version go1.7.4 linux/arm
sudo apt-get install golang-1.7 sudo apt-get install golang-go
you may need this so it knows were to install export GOPATH=/home/pi/gocode
see what you have to choose from
apt-cache search golang-1.*
Joe
|
|
|
Post by alexfish on Apr 21, 2019 23:13:48 GMT 1
Hi Joe @ All
Kind of wondering what this forum looks like from a html2text go output
+ as a kind of update . this forum's table a swine esp :: they have <br /> in the data bits + <p>
anyway as an update on this side of the fence can see how I am now Rewinding the git bits into place
code at this stage gives
Home | The BAsic CONverter Forum The BAsic CONverter Forum Skip Navigation Home Help Search Goto the BaCon website
Welcome Guest. Please Login or Register .
* The BAsic CONverter Forum * Home * General * News * Documentation * Code Projects * Troubleshooting area * Bugs, features General Board Threads Posts Last Post News
//MAIN TABLE News and announcements
Moderator: Pjot 92 831 HAPPY BIRTHDAY BACON! by ptitjoz Mar 18, 2019 16:38:16 GMT 1 Documentation - 1 Viewing
Tutorials & demonstrations
Moderator: Pjot 127 1,798 golang embedded in bacon by alexfish Apr 21, 2019 0:14:36 GMT 1 Code Projects
Programs, challenges, competitions
Moderator: Pjot 202 4,184 Another attempt for a universal GUI by Pjot Apr 21, 2019 16:16:33 GMT 1 Troubleshooting area
Problems, issues, tips & tricks
Moderator: Pjot 391 2,878 drag n drop compile *.bac raspberry pi by alexfish Apr 1, 2019 18:36:31 GMT 1 Bugs, features
Report a bug, request a feature /// FOOTER HERE Moderator: Pjot 237 2,264 Hug object alert or msgbox by bigbass Apr 6, 2019 22:05:56 GMT 1 Legend New Posts No New Posts Forum Information & Statistics Threads and Posts Total Threads: 1,049 Total Posts: 11,955 Last Updated: Another attempt for a universal GUI by Pjot ( Apr 21, 2019 16:16:33 GMT 1 ) Recent Threads - Recent Posts - RSS Feed Members Total Members: 201 Newest Member: shell Most Users Online: 144 ( Aug 22, 2013 23:04:29 GMT 1 ) View today's birthdays Users Online 0 Staff, 0 Members, 5 Guests. Users Online in the Last 24 Hours 1 Staff, 3 Members , 112 Guests. vovchik , Pjot , juppel , alexfish Click here to remove banner ads from this forum. This Forum Is Hosted For FREE By ProBoards Get Your Own Free Forum ! Terms of Service | Privacy | Cookies | FTC Disclosure | Report Abuse | Report Ad | Consent
Hence need to stack the three bits and unwind the three bits
did find that the empty data section in the html MAIN TABLE throws td out of sync
like this line
Moderator: Pjot 391 2,878 drag n drop compile *.bac raspberry pi by alexfish Apr 1, 2019 18:36:31 GMT 1 Bugs, features the 'Bugs, features' should be on a new line
BR Alex
|
|
|
Post by bigbass on Apr 21, 2019 23:37:14 GMT 1
result running golang index2text I can see what you mean I will look into removing everything but plain text in the ()
tip:a pre parser to remove java script would make it easier and forget about tables it slows everything down in golang
------------------------------- The BAsic CONverter Forum ( / ) -------------------------------
Skip Navigation ( #content ) ( # )
* Home ( / ) * Help ( /help ) * Search ( /search ) * Goto the BaCon website ( http://www.basic-converter.org )
Welcome Guest. Please Login ( https://login.proboards.com/login/3081746/1 ) or Register ( https://login.proboards.com/register/3081746 ).
* The BAsic CONverter Forum ( / )
* Home ( / )
* General
( /#category-1 )
* News
( http://basic-converter.proboards.com/board/5/news ) * Documentation
( http://basic-converter.proboards.com/board/3/documentation ) * Code Projects
( http://basic-converter.proboards.com/board/2/code-projects ) * Troubleshooting area
( http://basic-converter.proboards.com/board/4/troubleshooting-area ) * Bugs, features
( http://basic-converter.proboards.com/board/1/bugs-features )
------- General
-------
Board Threads Posts Last Post News ( /board/5/news )
News and announcements
Moderator: Pjot ( /user/1 )
92 831 HAPPY BIRTHDAY BACON! ( /threads/recent/1064 ) by ptitjoz ( /user/196 ) Mar 18, 2019 16:38:16 GMT 1 Documentation ( /board/3/documentation )
Tutorials & demonstrations
Moderator: Pjot ( /user/1 )
127 1,799 golang embedded in bacon ( /threads/recent/1079 ) by bigbass ( /user/42 ) Apr 21, 2019 18:16:00 GMT 1 Code Projects ( /board/2/code-projects ) - 2 Viewing
Programs, challenges, competitions
Moderator: Pjot ( /user/1 )
202 4,190 html2text (c++) ( /threads/recent/1073 ) by alexfish ( /user/57 ) Apr 21, 2019 23:13:48 GMT 1 Troubleshooting area ( /board/4/troubleshooting-area ) - 1 Viewing
Problems, issues, tips & tricks
Moderator: Pjot ( /user/1 )
391 2,878 drag n drop compile *.bac raspberry pi ( /threads/recent/1070 ) by alexfish ( /user/57 ) Apr 1, 2019 18:36:31 GMT 1 Bugs, features ( /board/1/bugs-features ) - 1 Viewing
Report a bug, request a feature
Moderator: Pjot ( /user/1 )
237 2,264 Hug object alert or msgbox ( /threads/recent/1071 ) by bigbass ( /user/42 ) Apr 6, 2019 22:05:56 GMT 1
------ Legend ------
New Posts No New Posts
------------------------------ Forum Information & Statistics ------------------------------
Threads and Posts Total Threads: 1,049 Total Posts: 11,962 Last Updated: html2text (c++) ( /threads/recent/1073 ) by alexfish ( /user/57 ) ( Apr 21, 2019 23:13:48 GMT 1 ) Recent Threads ( /threads/recent ) - Recent Posts ( /posts/recent ) - RSS Feed ( /rss/public )
Members Total Members: 201 Newest Member: shell ( /user/218 ) Most Users Online: 144 ( Aug 22, 2013 23:04:29 GMT 1 ) View today's birthdays ( /members?view=birthdays )
Users Online 0 Staff, 1 Member, 6 Guests. bigbass ( /user/42 )
Users Online in the Last 24 Hours 1 Staff, 4 Members ( /members?dir=desc&sort=last_online&view=today ) , 117 Guests. vovchik ( /user/7 ) , alexfish ( /user/57 ) , Pjot ( /user/1 ) , juppel ( /user/217 )
Click here to remove banner ads from this forum. ( https://www.proboards.com/store/add_cart/ad_free/50000/basic-converter.proboards.com/1 ) This Forum Is Hosted For FREE By ProBoards ( https://www.proboards.com ) Get Your Own Free Forum ( https://www.proboards.com/create-free-forum ) ! Terms of Service ( https://www.proboards.com/tos ) | Privacy ( https://www.proboards.com/privacy ) | Cookies ( https://www.proboards.com/privacy#cookies ) | FTC Disclosure ( http://www.viglink.com/policies/ftc ) | Report Abuse ( https://www.proboards.com/report-abuse ) | Report Ad ( # )
|
|
|
Post by alexfish on Apr 21, 2019 23:55:40 GMT 1
Thought would check a bit of the BaCon Web Site
BaCon - BASIC to C converter
BaCon
About News Downloads Documentation Examples Extensions Links FAQ Forum
BaCon - BASIC to C converter
Easy to learn BaCon syntax is based on old-school BASIC.
Fast and powerfull You can use the power and speed of C.
About BaCon is a free BASIC to C translator for Unix-based systems, which runs on most Unix/Linux/BSD platforms, including MacOSX. It intends to be a programming aid in creating tools which can be compiled on different platforms (including 64bit environments), while trying to revive the days of the good old BASIC . BaCon can be described as a translator, a converter, a source-to-source compiler, a transcompiler or a transpiler. It also can be described as a very elaborate preprocessor to C. BaCon is implemented in generic shell script and in itself. Therefore, to start using Bacon, the target system must have either Korn Shell , or ZShell , or Bourne Again Shell (BASH) available. Furthermore, BaCon also works with a newer Kornshell implementation like the MirBSD Korn Shell . The shell script implementation can convert and compile the BaCon version of BaCon. This will deliver the binary version of BaCon which has an extremely high conversion performance. On newer systems, the average conversion rate usually lies above 10.000 lines per second. Code converted by BaCon can be compiled by GCC , the Compaq C Compiler , TCC , the clang/LLVM compiler (and possibly by other C compilers), but also by C++ compilers like g++ or clang++ .
ESP the Nav bar
About News Downloads Documentation Examples Extensions Links FAQ Forum
most html2text shows the data like
*About *News *Downloads
and so on
yet there again my dropdown menu looks like this
BR Alex
|
|
|
Post by alexfish on Apr 22, 2019 0:02:12 GMT 1
Hi Joe
looks like go version has problems with this forum / tables
yet there again not sure if I can come full circle with my version
BR Alex
|
|
|
Post by bigbass on Apr 22, 2019 0:46:04 GMT 1
Hello Alex the default used tables but it slows everything down and spams you with too many ||| pipes to get the source golang is pretty smart it has a built in downloader set up where you want the source code in the folder GOLANG if you don't do this it builds your code linked static and you can't hack at source code later #export GOPATH=$HOME/GOLANG this auto downloads the source #go get github.com/jaytaylor/html2text index2html.go you can use tables changing false to true text, err := html2text.FromString(inputHTML, html2text.Options{PrettyTables: false}) text, err := html2text.FromString(inputHTML, html2text.Options{PrettyTables: true}) the output then looks like this pastebin.com/qBza2MMB
|
|
|
Post by alexfish on Apr 22, 2019 12:46:50 GMT 1
Hi Joe
can see :: there is a problem with this forum and how the tables are composed
so can think , test go version with a known working table.
the demo output's I showed bypass a table that has problems
the cxx file posted should decode a normal table
IE
ParseHtml("table.html", & str, 140,0 );
and I get
Firstname Lastname Age Jill Smith 50 Eve Jackson 94 Month Savings January $100 February $80 Sum $180
and if a problem then the results are the same when go version = No table
now as a test ; try hxclean hxnormalize
and esp
hxtabletrans
with the this forum index.html
will show an error
IE my tests
hxtabletrans table.html
<table style="width:100%"> <tr> <th>Firstname</th> <td>Jill</td> <td>Eve</td> </tr> <tr> <th>Lastname</th> <td>Smith</td> <td>Jackson</td> </tr>
<tr> <th>Age</th> <td>50</td> <td>94</td> </tr> </table>
hxtabletrans: pro.html:12: syntax error
<table> <tr> <td class="icon"><img title="Board Statistics" alt="Board Statistics" src="//storage.proboards.com/forum/images/info/stats.png"></td> </tr> <tr> <td class="info"> <table><tbody><tr><th>Threads and Posts</th></tr><tr><td>Total Threads: 1,033 Total Posts: 11,790</td></tr><tr><td>Last Updated: <a class="js-thread__title-link thread-link thread-971 board-3" href="/threads/recent/971">fltk using fluid GUI</a> by <a title="@bigbass" class="o-user-link js-user-link user-link user-42 group-0" data-id="42" href="/user/42">bigbass</a> (<abbr data-timestamp="1552784175000" class="o-timestamp time" title="Mar 17, 2019 1:56:15 GMT 1">Mar 17, 2019 1:56:15 GMT 1</abbr>)</td></tr><tr><td><a href="/threads/recent">Recent Threads</a> - <a href="/posts/recent">Recent Posts</a> - <a href="/rss/public">RSS Feed</a></td></tr></tbody></table> </td> </tr> </table>
any how have put some heuristics in to try and solve a conundrum
this is work in progress , as where the parser2 sits;
* The BAsic CONverter Forum * Home
* General
* News
* Documentation
* Code Projects
* Troubleshooting area
* Bugs, features
General
Board Threads Posts Last Post | News "<< now need to sep this 'News shown by <th and | after" "These are fine " News and announcements
Moderator: Pjot | 9292 | 831831 | HAPPY BIRTHDAY BACON! by ptitjoz Mar 18, 2019 16:38:16 GMT 1
==========================================================================================================
Documentation
Tutorials & demonstrations
Moderator: Pjot | 127127 | 1,7991,799 | golang embedded in bacon by bigbass Apr 21, 2019 18:16:00 GMT 1
==========================================================================================================
Code Projects - 2 Viewing
Programs, challenges, competitions
Moderator: Pjot | 202202 | 4,1944,194 | html2text (c++) by bigbass Apr 22, 2019 0:46:04 GMT 1
==========================================================================================================
Troubleshooting area
Problems, issues, tips & tricks
Moderator: Pjot | 391391 | 2,8782,878 | drag n drop compile *.bac raspberry pi by alexfish Apr 1, 2019 18:36:31 GMT 1
==========================================================================================================
Bugs, features - 2 Viewing
Report a bug, request a feature
Moderator: Pjot | 237237 | 2,2642,264 | Hug object alert or msgbox by bigbass Apr 6, 2019 22:05:56 GMT 1
Legend
New Posts No New Posts
Forum Information & Statistics
"<< Now in progress of sorting these bits << GO gets into trouble here as well" " as shown by results of paste/bin" | | Threads and Posts Total Threads: 1,049 Total Posts: 11,966Total Threads: 1,049 Total Posts: 11,966 Last Updated: html2text (c++) by bigbass ( Apr 22, 2019 0:46:04 GMT 1 )) Recent Threads - Recent Posts - RSS Feed
==========================================================================================================
Members Total Members: 201Total Members: 201 Newest Member: shell Most Users Online: 144 ( Aug 22, 2013 23:04:29 GMT 1 ) View today's birthdays
==========================================================================================================
| Users Online 0 Staff, 0 Members, 6 Guests.0 Staff, 0 Members, 6 Guests.
==========================================================================================================
| Users Online in the Last 24 Hours 1 Staff, 3 Members , 123 Guests., 123 Guests. alexfish , vovchik , Pjot , bigbass
Click here to remove banner ads from this forum.
This Forum Is Hosted For FREE By ProBoards Get Your Own Free Forum !
Terms of Service | Privacy | Cookies | FTC Disclosure | Report Abuse | Report Ad | Consent
BR Alex
|
|
|
Post by vovchik on Apr 22, 2019 12:58:39 GMT 1
Dear Alex and Joe, I know this bit is working in the opposite direction, but there might be useful its in the source: discount. I will have a look at the source soon. With kind regards, vovchik
|
|
|
Post by alexfish on Apr 22, 2019 17:29:52 GMT 1
Hi All
update to version2 (enable disable heuristics for table) testing::
first post
BR Alex
|
|
|
Post by alexfish on Apr 22, 2019 20:03:31 GMT 1
Hi all
parser 3 now in progress
IE Fine Parser;tuning Functions + testing like of lists
Example of test ordered list and un ordered list
<ol><li>List item 1</li><li>List item 2</li><li>List item 3</li></ol>
1. List item 1 2. List item 2 3. List item 3
<ul><li>List item 1</li><li>List item 2</li><li>List item 3</li></ul>
* List item 1 * List item 2 * List item 3
Added Roman
<ol type = "i" start = "1"><li>Beetroot</li><li>Ginger</li><li>Potato</li><li>Radish</li></ol>
I. Beetroot II. Ginger III. Potato IV. Radish
BR Alex
|
|
|
Post by alexfish on Apr 24, 2019 14:19:44 GMT 1
Dear Alex and Joe, I know this bit is working in the opposite direction, but there might be useful its in the source: discount. I will have a look at the source soon. With kind regards, vovchik Hi Vovchik did have this in at one stage yet possible see that at some stage need to get rid of the python decoder have some wchar_t examples , they work fine in iconv until we get likes of 0x6B630 numbers in html they look like & # x 6B63;& # x 898F;& # x 8868;& # x 9054;& # x 5F0F till now :: in the now :: have just found a util in the repos called 'uni2ascii' it can also convert ascii to uni : this has the golden egg solution I was looking for yet i think All & not sure if Peter Knows about this 'uni2ascii' may find this useful. back to some bits that I am testing , esp from encodings found in the likes of youtube the standard htmltext in the repos can not decode or encode like those above 正規表達式 so here we have to covert the above string to true hex like so Hello World 0x6B630x898F0x88680x90540x5F0F then save this to a file and issue the command ascii2uni uni.txt & viola Hello World 正規表達式
5 tokens converted
BR Alex OH || can not see as inteded Please see archive for the html entities: with the # <number> an ; bits Attachments:uni.txt.bz2 (109 B)
|
|
|
Post by vovchik on Apr 24, 2019 15:05:10 GMT 1
Dear Alex, uni2ascii is tiny and works nicely on Mint and PI. Thanks for finding it. Peter might want to have a look at the source... With kind regards, vovchik
|
|