Lazarus

Announcements => Third party => Topic started by: derek.john.evans on October 29, 2014, 05:05:28 pm

Title: Lazbro v0.1 (A new Lazarus only HTML Viewer)
Post by: derek.john.evans on October 29, 2014, 05:05:28 pm
For some reason, I felt like writing a new HTML viewer which is 100% Lazarus based. The result is about ~1300 lines of code, all in one unit file.

You can download the control + a demo app from here:
http://www.wascal.net/bin/lazbro0.1.zip

It handles just about everything needed for basic HTML viewing. At this stage, feel free to hack the code, since, I'm unsure what I will do with it.

Cheers
Title: Re: Lazbro v0.1 (A new Lazarus only HTML Viewer)
Post by: Edson on October 29, 2014, 06:02:02 pm
Good work. Excelent library. Simple and easy to use.
Maybe more documentation would be better
Title: Re: Lazbro v0.1 (A new Lazarus only HTML Viewer)
Post by: benohb on October 29, 2014, 06:17:59 pm
Great work  :D

Quote
Project Lazbro - Portable HTML Browser raised exception class 'External: SIGSEGV'.


debian - gtk 32 bit


 
Title: Re: Lazbro v0.1 (A new Lazarus only HTML Viewer)
Post by: qdos on October 29, 2014, 10:04:57 pm
Nice!

Any chance for CSS and webkit transformation support?
Title: Re: Lazbro v0.1 (A new Lazarus only HTML Viewer)
Post by: Leledumbo on October 30, 2014, 05:39:56 am
Nice. Have you tested how compliant it is with the standard?
Title: Re: Lazbro v0.1 (A new Lazarus only HTML Viewer)
Post by: esvignolo on October 30, 2014, 06:20:10 am
Great! Work on MacOS too, but have the same exception on debug.



Great work  :D

Quote
Project Lazbro - Portable HTML Browser raised exception class 'External: SIGSEGV'.


debian - gtk 32 bit
Title: Re: Lazbro v0.1 (A new Lazarus only HTML Viewer)
Post by: derek.john.evans on October 30, 2014, 08:22:12 am
Quote
Any chance for CSS and webkit transformation support?

CSS, yes. webkit? Unsure what that is. But, I should have <STYLE> tags working in the next release. How this works is, in the function procedure ElementStandardize(const ANode: TDOMElement);  , I copy standard attributes to custom attributes, which then map to Lazarus control properties. eg: "style:font-family" is copied to "_Font.Name" onloading which then is assigned to the property using RTTI. So, to implement a STYLE tag, I would traverse back down the DOM tree, parsing each STYLE block, and coping values to the current node.

Quote
Nice. Have you tested how compliant it is with the standard?
I'd say its not very compliant. As described above, the design is tied to control properties, and currently im using the default Lazarus controls. The first stage will be to work on the ElementStandardize(), to try to get it as close as possible. The next stage would be to use extended controls with properties which implement missing features. eg: border styles for each edge of a control.

But, the main compliant  issue ATM is SAX_HTML & DOM_HTML, which is based on DOM. (Standard FreePascal libraries). Malformed HTML is not parsed at all, so, im unsure what todo about that. Either, wait for someone to update DOM_HTML, or try to fix it myself, or write my own HTML parser, or just ignore the issue.

Anyway. Im sure this will improve over time.
Title: Re: Lazbro v0.1 (A new Lazarus only HTML Viewer)
Post by: marcov on October 30, 2014, 12:03:29 pm
The Lazarus html help (CHM, which is archived and indexed html) viewer uses a IPRO for viewing, and any improvement there would be good.

The ipro layout is uglier than of a normal browser and it is nearly completely textual layout.  Seeing if LazBro would improve layout relative to ipro would be a great (and simple) test.

(if you don't want to patch the helpviewer to test, you can simply extract one of the CHM help files and use the generated html)
Title: Re: Lazbro v0.1 (A new Lazarus only HTML Viewer)
Post by: matthius on November 11, 2014, 03:28:12 pm
Your source need to add {$mode objfpc}{$H+} after unit lazbro;

It will be added to my entirely free LGPL project Ancestromania :
http://genealogie.liberlog.fr/Family-trees (http://genealogie.liberlog.fr/Family-trees)

Thank you !
Title: Re: Lazbro v0.1 (A new Lazarus only HTML Viewer)
Post by: Zittergie on November 12, 2014, 02:55:57 pm
Works fine on MacOS.  One question.
Is it possible to only load a page until for example the last </table>?

Code: [Select]
.......
.......
</td>
</tr>
</table>
Only load until here, discard the rest

<!--
NewPP limit report
Parsed by mw1001
.......
.......


If I download the HTML I can parse the file, but then I loose the online pictures, but is it also possible to parse the stream before Lazbro parse it?
Title: Re: Lazbro v0.1 (A new Lazarus only HTML Viewer)
Post by: Zittergie on November 13, 2014, 05:05:54 pm
One more question:

Is it possible to use Lazbro in a seperate thread?

Code: [Select]
procedure TWikiInfoThread.Execute;
begin
  Form1.FLazbro.LoadFromUrl('http://en.m.wikipedia.org/wiki/U2');
end;

crashes.

using:

Code: [Select]
procedure TWikiInfoThread.ShowMe;
begin
  Form1.FLazbro.LoadFromUrl('http://en.m.wikipedia.org/wiki/U2'));
end;

procedure TWikiInfoThread.Execute;
begin
  Synchronize(@ShowMe);
end;   

works, but it hangs while loading, just like running a not threaded procedure.
Wikipedia uses a lot of linked items, and that seems to take a lot of time.
Title: Re: Lazbro v0.1 (A new Lazarus only HTML Viewer)
Post by: Dibo on November 13, 2014, 07:55:29 pm
Great work! Tested on Kubuntu 14.04 64bit (Qt widgetset)

Few issues:
1. This html loaded by LoadFromString:
Code: Pascal  [Select][+][-]
  1. const
  2.   sHTML =
  3.     '<HTML>'+
  4.     '<HEAD>'+
  5.     '<TITLE>Lazbro v0.4 - A Portable HTML Viewer for Lazarus</TITLE>'+
  6.     '</HEAD>'+
  7.     '<BODY bgcolor="#ddffaa">'+
  8.     '<table border=1>'+
  9.     '<tr><td>Test1</td></tr>'+
  10.     '<tr><td>Test2</td></tr>'+
  11.     '<tr><td>Test3</td></tr>'+
  12.     '</table>'+
  13.     '</BODY>'+
  14.     '</HTML>';  
  15.  
... raise exception in my new empty project. When copy this HTML into your demo then it is working fine  :(
Exception is rised in line 1033 with message ""100%" is invalid integer". This is my simple code:
Code: Pascal  [Select][+][-]
  1. procedure TForm1.FormCreate(Sender: TObject);
  2. begin
  3.   FBro := TLazbro.Create(Self);
  4.   FBro.Align := alClient;
  5.   FBro.Parent := TabSheetBrowser;
  6. end;  
  7.  
  8. procedure TForm1.FormShow(Sender: TObject);
  9. begin
  10.   FBro.LoadFromString(sHTML,'');
  11. end;  
  12.  

2. How to add border in <TABLE> tag?
3. Can I change content in runtime without reparsing and rendering whole HTML? For example, I would like to add new <TR> row in table. Can I find table in THTMLDocument object and add TD object at runtime?

Regards
Title: Re: Lazbro v0.1 (A new Lazarus only HTML Viewer)
Post by: Zittergie on November 14, 2014, 09:58:50 am
Hi,

&#8217;  -   &#8220;   -  &#8221;   do not render to " and '

So I have to add:
Code: [Select]
temp1:=StringReplace(temp1,'&#8217;','''',[rfReplaceAll, rfIgnoreCase]);
temp1:=StringReplace(temp1,'&#8220;','"',[rfReplaceAll, rfIgnoreCase]);
temp1:=StringReplace(temp1,'&#8221;','"',[rfReplaceAll, rfIgnoreCase]);


Any idea where these should be added to work in general ?

Thanks again for your great work and sharing it with us.
Title: Re: Lazbro v0.1 (A new Lazarus only HTML Viewer)
Post by: derek.john.evans on November 14, 2014, 03:24:37 pm
Quote
Any idea where these should be added to work in general ?

Im unsure atm. Im currently working on the next version of Lazbro, which will be a big step forward. I now have a set of HTML style controls which support more advanced styles. I'll take note of comments posted here and fix issues over the next few weeks.

Cheers.
Title: Re: Lazbro v0.1 (A new Lazarus only HTML Viewer)
Post by: Zittergie on August 07, 2015, 08:58:24 pm
Hi,
I see you are back active in the forum.  Are there any changes coming for Lazbro?

Greetz,
Zittergie
Title: Re: Lazbro v0.1 (A new Lazarus only HTML Viewer)
Post by: derek.john.evans on August 07, 2015, 09:12:38 pm
Hi,
I see you are back active in the forum.  Are there any changes coming for Lazbro?

Greetz,
Zittergie

Arr, yes. LazBro. What happen with that is, I extended it to be more HTML DOM like. Custom HTML controls, with properties that matched the HTML DOM. And, it kinda got a little crazy and moved away from my original goal, which was a simple 1 file HTML viewer. But, I did fix the layout code. So, my plan for that project is to grab any bug fixes from my stupid attempt at writing a full browser.

I think LazBro should always stay a small simple little HTML viewer.
Title: Re: Lazbro v0.1 (A new Lazarus only HTML Viewer)
Post by: JuhaManninen on August 08, 2015, 09:35:16 am
Let us know when you have something new to download. I also want to test it.
Revision control could be useful as you already have lots of code there.
Title: Re: Lazbro v0.1 (A new Lazarus only HTML Viewer)
Post by: Gustavo 'Gus' Carreno on October 28, 2021, 05:06:34 am
Hey All,

Sorry for revising such an old thread, but is this component's source available somewhere else?

I stumbled on it due to the thread: HTML Viewer (Basic viewer needed) (https://forum.lazarus.freepascal.org/index.php?topic=56910.0) and I was wondering if I could probably have a looksie at it.

Many thanks!!

Cheers,
Gus
Title: Re: Lazbro v0.1 (A new Lazarus only HTML Viewer)
Post by: ccrause on October 28, 2021, 08:45:48 am
https://sourceforge.net/projects/lazbro/
Title: Re: Lazbro v0.1 (A new Lazarus only HTML Viewer)
Post by: Gustavo 'Gus' Carreno on October 28, 2021, 08:56:30 am
Hey ccrause,

https://sourceforge.net/projects/lazbro/

Thanks !!! Really appreciate it !!

Cheers,
Gus
TinyPortal © 2005-2018