Review Request 121094: KCoreAddons: add KTextToHTML class for plaintext -> HTML conversion

Aaron J. Seigo aseigo at kde.org
Mon Dec 1 08:51:08 UTC 2014


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/121094/#review71147
-----------------------------------------------------------



src/lib/text/ktexttohtml_p.h
<https://git.reviewboard.kde.org/r/121094/#comment49706>

    this does not seem to be used by the unit tests, so does not need to be exported?



src/lib/text/ktexttohtml_p.h
<https://git.reviewboard.kde.org/r/121094/#comment49707>

    would it be possible to just pull this file directly into the unit test that uses it rather than export the symbol?
    
    every user of the library pays a startup cost for ever exported symbol, and it also increases the interface surface of the library even if these classes are theoretically "private"


- Aaron J. Seigo


On Nov. 18, 2014, 1:37 p.m., Daniel Vrátil wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/121094/
> -----------------------------------------------------------
> 
> (Updated Nov. 18, 2014, 1:37 p.m.)
> 
> 
> Review request for KDE Frameworks and Michael Pyne.
> 
> 
> Repository: kcoreaddons
> 
> 
> Description
> -------
> 
> This class comes from KPimUtils::LinkLocator from kdepimlibs.git. This class takes plaintext string, and converts it to HTML while perserving spacing, converting URLs and email addresses into <a href...> links and interpreting highligting markup (*bold*, _underline_, /italic/) and wrapping it to corresponding HTML tags. It can also convert text emoticons into <img> smileys.
> 
> The last - emoticons conversion - depends on KEmoticons, which we can't use directly from KCoreAddons, so I moved the actual KEmoticons code into FrameworkIntegration plugin. There is a dummy implementation provided by default in KCoreAddons that is loaded when the FrameworkIntegration plugin is not available, or when the application is only a QCoreApplication (since KEmoticons require QGuiApplication, so we must not load the plugin). The dummy implementation does nothing and returns the original string unaltered.
> 
> The reason for moving the class from KPimUtils is that KPimUtils is going to die, and while we could make this internal to KDE PIM, I think this is a rather useful code, that can be used by many applications that need to deal with 3rd party text data and want to provide user-friendly clickable links.
> 
> If you compare this with the original KPimUtils::LinkLocator you find, that I removed all public API except for the convertToHTML method. This is because the remaining methods (getUrl, getEmailAddress) depend on the actual state of the LinkLocator object, but LinkLocator provides no API for step-by-step parsing, so they were actually useless for public use. For that reason I decided to only publish the convertToHTML method, and hide the remaining methods as internal methods of the KTextToHTMLHelper (useful for unit-testing).
> 
> This patch also contains a unit-test from KPimUtils.
> 
> 
> Diffs
> -----
> 
>   autotests/CMakeLists.txt d5a5feb 
>   autotests/ktexttohtmltest.h PRE-CREATION 
>   autotests/ktexttohtmltest.cpp PRE-CREATION 
>   src/lib/CMakeLists.txt 1dc5627 
>   src/lib/text/ktexttohtml.h PRE-CREATION 
>   src/lib/text/ktexttohtml.cpp PRE-CREATION 
>   src/lib/text/ktexttohtml_p.h PRE-CREATION 
>   src/lib/text/ktexttohtmlemoticonsinterface.h PRE-CREATION 
> 
> Diff: https://git.reviewboard.kde.org/r/121094/diff/
> 
> 
> Testing
> -------
> 
> Unit test passes
> 
> 
> Thanks,
> 
> Daniel Vrátil
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20141201/0d71d7aa/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list