Can I give a specific style to a tag of a html markup textfield in Jaspersoft Studio? - jasper-reports

I am having problems with lists in jaspersoft studio.
My problem is described in this question: Indentation in generated PDF using JasperReports
I tried this and it worked, but not as the way I intended. Since I don't have only Ordered Lists in the HTML that comes from my database, the whole textfield is having these styles applied. I am trying to find a way to only apply this style to the <ol> tags in the html.
Is there a way to do it? I tried with a <style> tag but it seems that jaspersoft studio ignores it.
My report is generating the below text (with the second line for normal paragraphs wrong):
I am using the version 6.5.1 of Jaspersoft Studio Community.
The Textfield tag I'm using for testing is this:
<textField isStretchWithOverflow="true">
<reportElement key="" stretchType="ElementGroupHeight" x="30" y="24" width="510" height="46" uuid="3d44a01e-0064-491d-9925-fbdb1cea1374"/>
<box topPadding="0" leftPadding="23" bottomPadding="0" rightPadding="0"/>
<textElement markup="html">
<font size="9"/>
<paragraph lineSpacing="Proportional" lineSpacingSize="1.0" firstLineIndent="-23"/>
</textElement>
<textFieldExpression><![CDATA["<style>ol {padding: 23px; text-indent: -23px;}</style><div><b>Lorem ipsum for testing what is happening. The text is starting on the wrong place in the second line. Why? Lorem ipsum for testing what is happening. The text is starting on the wrong place in the second line. Why? Lorem ipsum for testing what is happening. The text is starting on the wrong place in the second line. Why?</b></div><div style='background: green;'><ol><li><b>test</b></li><li>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque nisl dui, imperdiet nec maximus vitae, feugiat quis ligula. Sed ac ornare metus, posuere sagittis lectus. Vestibulum varius dui ut erat congue dapibus. Nunc malesuada eros et condimentum cursus. Sed semper efficitur massa. Phasellus sed odio tempus, semper neque quis, ullamcorper eros. Vestibulum luctus viverra justo, eget pellentesque nulla cursus nec. Integer tortor velit, auctor at lectus ac, fermentum accumsan dolor. Phasellus tincidunt odio sed sagittis vestibulum. Vestibulum ac enim vel ante ornare iaculis. Proin dapibus hendrerit elementum.</li><li>JUST A TEST</li></ol></div><div><b>test</b></div><div><b>test</b></div>"]]></textFieldExpression>
</textField>
Thanks.

Related

Multiline Regex replacement with Autohotkey

Can't seem to wrap my head around the proper regex!
MY GOAL
add 2 spaces to each line of a selected block of text
MY CONTEXT
some markdown tools I used need 2 spaces at the end of each line to properly manage lists, etc.
if a file is edited multiple times, I do not want to end up with lines ending with 4+ spaces
a block of text can be a line, a paragraph, the whole file content as shown in the editor
I have some kind of macro in Notepad++ that does the trick but I want to do the same with Autohotkey to be editor-independant
MY EXAMPLE
----
# 2020-03-17
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.
Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu.
In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a,
MY SNIPPET SO FAR
; CTL+SHIFT+F12
^+F12::
Clipboard = ; Empty the clipboard so that ClipWait has something to detect
SendInput, ^c ; Copy selected text
ClipWait
OutputText := ""
Loop, parse, Clipboard, `n, `r
{
OutputText .= RegExReplace(A_LoopField,"m)^(.*) *$","$1 `r`n")
}
SendRaw % OutputText
return
MY PROBLEM
Between the character ignored when looping, what I am trying to match and what I try to replace the group with, I end up with far more lines and spaces than needed.
CURRENT OUTPUT
----
# 2020-03-17
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.
Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu.
In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a,
DESIRED OUTPUT
----
# 2020-03-17
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.
Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu.
In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a,
You're getting too many lines in the output because the send command is messing up due to the carriage returns, which aren't needed in there anyway. I don't really know why that is happening, and I can't be bothered to find out why since the approach isn't good anyway.
And also your indentation is getting messed up because your text editor automatically adds indentation based on the previous line.
But anyway, sending such (long) input is never a good idea.
Make use of the clipboard and just send a ctrl+v to instantly and reliably paste in the text.
Here's an example of that along another way to add the spaces at the end:
inp := "
(
----
# 2020-03-17
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.
Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu.
In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a,
)"
Loop, Parse, inp, `n, `r
OutputText .= (A_LoopField = "" ? "" : RTrim(A_LoopField) " ") "`n"
Clipboard := OutputText
SendInput, ^v
The ternary A_LoopField = "" ? "" : RTrim(A_LoopField) " " returns true if the line was empty and then the two spaces aren't added at the end.
I think that's the behavior you were doing for.
And RTrim is used to trim any trailing spaces (or tabs) off the end, so we're sure to end up with just the two we want.
And, of course, at the end of any line we add one line feed `n.
Also, your Regex approach was just fine as well at first it just seemed off to me, but well, here's another way. And I guess this would be more efficient, though you'd have to work with seriously large inputs and/or slow hardware for that to make any meaningful difference haha.

Is it possible to crop an Element using Elm's std library? If not, is there a 3rd party lib for this?

I often run across a situation where I've constructed an Element or Form and wish to crop the view down to a given area (i.e. for scrolling within a smaller rectangle) though I haven't been able to find any methods for this within their respective modules.
Is it possible to do this using Elm's std library? If not, are there any 3rd-party libraries capable of doing this?
Otherwise, perhaps there is a better way of achieving this?
Any help or suggestions appreciated!
No scollbars (using the std library)
I can't find a way to crop but have scrollbars with the current Graphics.Element. What is possible is to crop without having scrollbars, either through a container that's smaller than it's contents or by resizing an element with size. I think the container way is more robust, as resizing an image will actually warp the image.
Here's an example:
import Graphics.Element exposing (..)
import Text
string = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ut gravida lorem. Ut turpis felis, pulvinar a semper sed, adipiscing id dolor. Pellentesque auctor nisi id magna consequat sagittis. Curabitur dapibus enim sit amet elit pharetra tincidunt feugiat nisl imperdiet. Ut convallis libero in urna ultrices accumsan. Donec sed odio eros. Donec viverra mi quis quam pulvinar at malesuada arcu rhoncus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. In rutrum accumsan ultricies. Mauris vitae nisi at sem facilisis semper ac in est."
main : Element
main =
let element =
leftAligned (Text.fromString string)
|> container 400 300 topLeft
in container 205 200 topLeft element
Scrollbars (via "3rd party" library)
If you want scrollbars, you'll probably need at least a little bit of html from elm-html. Note that the author of the library is also the author of Elm, so it's not quite 3rd party :P . You can keep it minimal by using conversions to html and from html and wrapping it in a div with style attributes that define the smaller size and the right overflow property. As long as that div has a known size, it should be easy to convert back to an Element.

Use of sections within a module group in doxygen

I seek the preferred way to structure the contents of a doxygen module group. For example I want to structure the #details text in the following module group in different sections. Especially each of the sections should appear in the bookmarks of the generated PDF (as child elements of the module group):
#defgroup lorem
#{
#brief
Lorem ipsum
#details
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum
ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu
libero, nonummy eget, consectetuer id, vulputate a, magna. Donec vehicula augue eu
neque.
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis
egestas. Mauris ut leo. Cras viverra metus rhoncus sem. Nulla et lectus vestibulum
urna fringilla ultrices. Phasellus eu tellus sit amet tortor gravida placerat.
Integer sapien est, iaculis in, pretium quis, viverra ac, nunc.
Praesent eget sem vel leo ultrices bibendum. Aenean faucibus. Morbi dolor nulla,
malesuada eu, pulvinar at, mollis ac, nulla. Curabitur auctor semper nulla.
Donec varius orci eget risus. Duis nibh mi, congue eu, accumsan eleifend,
sagittis quis, diam. Duis eget orci sit amet orci dignissim rutrum.
#}
A way could be using #section #subsection etc, but the doxygen manual says:
Warning:
This command only works inside related page documentation
and not in other documentation blocks!
Is it possible to use #section or are there other (better) ways to do this?
Edit:
The behavior using #section seems indeed odd, for example I tried something like this:
#defgroup lorem
#{
#brief
Lorem ipsum
#section sec0 Lorem ipsum
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum
ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu
libero, nonummy eget, consectetuer id, vulputate a, magna. Donec vehicula augue eu
neque.
#section sec1 Pellentesque
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis
egestas. Mauris ut leo. Cras viverra metus rhoncus sem. Nulla et lectus vestibulum
urna fringilla ultrices. Phasellus eu tellus sit amet tortor gravida placerat.
#section sec2 Integer sapien est
Integer sapien est, iaculis in, pretium quis, viverra ac, nunc.
Praesent eget sem vel leo ultrices bibendum. Aenean faucibus. Morbi dolor nulla,
malesuada eu, pulvinar at, mollis ac, nulla. Curabitur auctor semper nulla.
Donec varius orci eget risus.
Duis nibh mi, congue eu, accumsan eleifend,
sagittis quis, diam. Duis eget orci sit amet orci dignissim rutrum.
#}
The result looks fine and has in this case the following structure in the PDF:
4.1 lorem
4.1.1 Lorem ipsum
4.1.2 Pellentesque
4.1.3 Integer sapien est
Now if a add #file a #details section containing no text appears in the output I can't get rid of. It looks like this (I also tested adding another group containing a #file - same result):
4.1 lorem
4.1.1 Detailed Description
4.1.2 Lorem ipsum
4.1.3 Pellentesque
4.1.4 Integer sapien est
Then I tried to move the sections and make them subsections of the "Detailed Description" -which would be logically okay. But when I change them to #subsection 's they completely disappear. Doxygen warns in this case it has found a subsection out of section context so obviously it doesn't realize it generated this mysterious empty #details section.
Next idea was to use the Markdown support to do it. In this case sections aren't put into the PDF bookmarks so it looks okay - but in latex code they are still on same level as the #details section. And subsections in Markdown disappear as well. I've no idea what is going on, but I can't be the first person trying to structure things in a module group.
I tried your example myself and if you put the #file between your #{ ... #} like this,
/**
#defgroup lorem
#{
...
#file
#}
*/
then the standard Doxygen Layout is created.
If you move the #file outside, then your like this, then it should work.
/**
#defgroup lorem
#{
...
#}
#file
*/
However, if you really need the #file within your #defgroup lorem #{ ... #}, there are two ways to achive it.
FIRST:
/**
#defgroup file
#{
#file
#defgroup lorem
#{
...
#}
#}
*/
SECOND:
Change the standard doxygen layout.
To do this, follow the manuals description here, beginning at: Changing the layout of pages, by creating your custom DoxygenLayout.xml.
Now, edit the DoxygenLayout.xml and search for the <group> tag.
There will find <detaileddescription title=""/> tag, change it to <detaileddescription visible="no" title=""/>and the `Detailed Description" bugging you should vanish.
If you simply want to structure the sections within a group description then I'd simply use HTML and insert <h1>Section name here<\h1> etc.
Alternatively Markdown ## section marking may work.
I don't know how well these percolate to LaTex and PDF as I've never used that output route. However, I'm confident that using HTML will give more reliable results than using #section which, as the manual warns, is simply not designed for use here, but, instead, as part of the #page / #section / #subsection hierarchy for bulk prose. These command sets do not mix well in Doxygen.
Locating #file in exotic positions (as per aldr's suggestion) is prone to cause very strange results. It's simply the description block for the physical file, and is best used as just that.

Can iFrames work on iPhone/iPad?

I have read so much and still no real answer. How can I get iFrames to work on the iPhone and iPad? Especially now you can't 2 finger scroll. I just want to have an iFrame scroll or something that functions like one. I feel like this should be so simple!
Here is a sample page:
http://olbrichdesigns.com/ffff/characters/test.html
Thanks!
jenny
Mobile safari supports them but generally they're not great.
Using a DIV with overflow-y: scroll would probably be better for you
<div style="overflow-y: scroll; height: 100px;">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam at laoreet augue. Pellentesque felis arcu, convallis eu luctus vitae, imperdiet ut est. Nulla rhoncus varius odio, non facilisis felis imperdiet pellentesque. Aliquam in luctus orci. Ut convallis felis sodales diam ultricies in elementum ligula ultricies. Vivamus consequat convallis mauris, sed ullamcorper ante fermentum a. Quisque at velit eu velit venenatis faucibus id vel velit. Integer eget nisi elit. Ut blandit eros lorem, sed feugiat nunc. Sed lacus nisi, placerat sit amet blandit feugiat, accumsan ut urna. Proin risus sapien, porttitor sed euismod quis, adipiscing vitae nulla. Vestibulum at ipsum vel tortor fermentum tristique. Fusce laoreet magna vitae tellus accumsan eget adipiscing velit ullamcorper. Proin tempus volutpat fringilla. Etiam eu magna sit amet mi commodo volutpat sit amet eget lacus. Nullam euismod tellus id odio tempus id tincidunt felis mollis.
</div>
​

Can a pixbuf inserted into a GTK+ text buffer be set as "floating"?

I'm writing an application [a Pidgin plugin, actually], which inserts an image embedded into a GtkTextBuffer. Currently, I add it using:
gtk_text_buffer_insert_pixbuf(textBuffer, &iter, pixbuf);
However, this just puts the image "inline" with the text. What I'm looking for for is something similar to HTML's "float". For example, assuming my image is about twice the size of a line of text, I current get this [where X is the image]
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam gravida
XXXX
XXXX ante in massa dignissim aliquam. Nullam tempus quam luctus eros volutpat laoreet.
XXXX
XXXX sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.
Mauris semper, nunc quis gravida molestie,
leo neque imperdiet nulla, vel consectetur nisi nisl non metus. Maecenas pharetra
magna nec magna mattis faucibus convallis nibh
Ideally, I'd like to have:
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam gravida
XXXX ante in massa dignissim aliquam. Nullam tempus quam luctus eros volutpat laoreet.
XXXX
XXXX sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.
XXXX Mauris semper, nunc quis gravida molestie,
leo neque imperdiet nulla, vel consectetur nisi nisl non metus. Maecenas pharetra
magna nec magna mattis faucibus convallis nibh
Note that there are four paragraphs, where the second and third have an image in the beginning.
Is this possible?
The short answer is no; images in TextView are just treated as a character (which may be a lot bigger than a usual character). There isn't any layout engine in the HTML sense. (Layout is limited to what PangoLayout can do.)
You could probably hack something together, using an approach such as:
leave a margin the size of the image on your paragraph
add an expose event handler to paint the image to the window (see the "border windows" examples which are I think in gtk-demo or the docs somewhere, but draw to the main window not border windows)
Some amount of work, but it would probably get the job done.