Tool to convert HTML to DAT
DynamoBen
Posts: 366
I'm interested in a tool/script to convert HTML to something that is DAT friendly. I've been embedding my HTML code in Spin, to do this I have to break all the lines apart by hand and replace all the quotes with quote symbols. This would be less painful if I could just run a script against the HTML code and it would spit out a new file with everything reformatted and then I can copy/paste into the DAT block.
Comments
Thanks. I'm thinking this will be helpful for those like myself who have simple pages in code, or those that want to put it on EEProm.
You beat me to it. I've almost got a web-based app done.
-Phil
-Phil
index.html:
html2dat.pl:
-Phil
I see you're replacing multiple consecutive spaces with a single space. I avoided doing that, in case there were any <pre> sections in the HTML. (I didn't feel like parsing the HTML to that level of detail to make the distinction, either. ) I do, however, eliminate all tabs.
Ben,
Just as a heads-up, the DAT section is not the best place to store HTML in the Spinneret. Text blocks in DAT chew up enormous amounts of hub memory. It would be better to keep the HTML out of your program proper and save it on an SD card.
-Phil
do you mean by using a bigger eeprom and putting the dat where the prop normaly doesnt reach , And only call the date when it,s beeing posted.
how,s the best way to do this ?
would like to do that to get rid of some of my html code thats now taking alot of space .and i am not using a sd card. with it wiznet
any helpfulll links ?
UPDATE , o sorry i missread you saying SD card,
is it posssible to do it the eeprom way i was mentioning if you know ?
That would be true if I was using the spinneret. I'm doing a webpage for configuration on a design that doesn't have an SD card, I will probably store the webpages in EEProm.
The output file is in the same directory as the source. The output file name is the source file ending with .txt.
I took Phil's advice and removed tabs not white space but I left the ReplaceWhiteSpace method in the source code if someone wants to use it.
Next up will be writting a routine to program this to EEProm.
BTW I'm wondering if EEProm is the right way to go for storing webpages, I'm concerned that I may run out of space. Is there another better method for storing webpages that I should consider?
It depends on the project. Many browser type projects can be realized with a single page. Lightweight AJAX requests execute from the client are used to update the HTML.
Another approach is to use a real web server where the web server gets data (sensors and such) from HTTP GET/POST requests to the Wiznet device. To the web server the Wiznet is just a client request away like a database requests. The Wiznet device becomes a service...
I'm creating some basic device configuration pages. While I could combine all of it into a single page visually it gets kind of unwieldy. I think a separate webserver would be overkill for this application.
I suppose I could do SD (via SPI and share with Wiznet) I was just hoping there was something between EEProm and SD.
How much configuration data do you need? How large are the HTML pages? How many pages are required?
The configuration data itself will be in EEProm, I'm talking about the webpages. I'm thinking 4-5 webpages, as far as size I will have to write a program to calculate how much space each would take up.
You don't need to write a program to check files size, just build the HTML and take a look at the file properties. That is, if you want browser based configuration . You could also use telnet or a custom UPD app to setup the configuration.
Not following you on this one, mind explaining a little further?
File properties includes white-space in the total (in windows). But for reference one page is 13.6KB.
Going browser based for this project.
In my opinion, 13.6k for a configuration file is a bit on the large side. Especially if you are trying to fit the pages in the upper 32k of a 64k EEPROM.
Maybe, it would be better to place the configuration files on an SD card.
Thanks now I'm following you.
I supposed I could add a second EEProm just for webpage storage, on the other hand an SD card gains me the ability to do images. Engineering is always filled with choices.