paragraph

jQuery get text node siblings at deepest level

前提是你 提交于 2019-12-11 18:36:27
问题 I have div s that may consist of text like this: <div> <p> <span>My text <br /> Some more text</span> </p> </div> Or like this <div> <p> Here's a chunk of text </p> </div> Or any other combination, but the final level will have text that may or may not be separated by <br /> . (Is a span that contains a br a single node? Or is it two siblings at the same level?) In the first case, the text from the deepest children I want is: My text Some more text In the second: Here's a chunk of text My

How to initialize Paragraph Inlines

ⅰ亾dé卋堺 提交于 2019-12-11 10:48:23
问题 How can I initialize paragraph Inline with new InlineCollection? I defined InlineCollection and added Run elements with string to it. I tried to initialize this way ParagraphComponent.Inlines = _inlineCollection; However, I get error message that ParagraphComponent.Inline is readonly. 回答1: From the Remarks section of the Inlines property page on MSDN: Use the InlineCollection returned by this property to enumerate or manipulate the contents of a Paragraph element. So you could do this:

\subparagraph{} equivalent in html

廉价感情. 提交于 2019-12-10 22:03:57
问题 I have my habits with LaTeX, then in HTML I don’t know which element can replace the LaTeX’s \subparagraph{} command. <br /> isn’t a good idea because it is the equivalent of the blank line in LaTeX. I can create a special class “subparagraph” but before I want to know if HTML didn’t have a similar element. The \subparagrahp{} LaTeX’s command is something between the paragraph and the HTML’s <br /> element. Overapi didn’t tell me more :/ Someone have any idea please? 回答1: You could use a div

print first paragraph in python

懵懂的女人 提交于 2019-12-09 17:41:00
问题 I have a book in a text file and I need to print first paragraph of each section. I thought that if I found a text between \n\n and \n I can find my answer. Here is my codes and it didn't work. Can you tell me that where am I wrong ? lines = [line.rstrip('\n') for line in open('G:\\aa.txt')] check = -1 first = 0 last = 0 for i in range(len(lines)): if lines[i] == "": if lines[i+1]=="": check = 1 first = i +2 if i+2< len(lines): if lines[i+2] == "" and check == 1: last = i+2 while (first <

how to bold words within a paragraph in HTML/CSS?

谁说胖子不能爱 提交于 2019-12-09 02:15:12
问题 I am a beginner in web programming and have some very simple questions. I'm trying to bold several words in one paragraph but I don't know how to do that using HTML/CSS. I've figured out how to bold entire paragraphs, but not individual words yet. How can I bold one word, like "bold" in my example? This bolds an entire paragraph: <html> <head> <style type="text/css"> p.n1 { font:15px bold 30px Georgia,serif; } </style> </head> <body> <p class="n1">I am in bold. </p> </body> </html> 回答1: <p>

How to compare two paragraphs of text?

丶灬走出姿态 提交于 2019-12-08 19:57:15
问题 I need to remove duplicated paragraphs in a text with many paragraphs. I use functions from the class java.security.MessageDigest to calculate each paragraph's MD5 hash value, and then add these hash value into a Set . If add() 'ed successfully, it means the latest paragraph is a duplicate one. Is there any risk of this way? Except String.equals() , is there any other way to do it? 回答1: Before hashing you could normalize the paragraphs e.g. Removing punctuation, conversion to lower case and

Force paragraph to use the maximum height available

我的未来我决定 提交于 2019-12-07 10:34:47
问题 I have a series of divs which contain a small paragraph of text. I would like to make all the divs of the same height and vary the width as required to fit the paragraph. If I was to do this in the vertical direction I would just set the width of the div. But if I set the height the paragraph turns into one line making the box as wide as possible. How to I force the paragraph to have as many lines as the height will allow then increase in width as required I have tried using min-height:100px

iText - Adding external image using Chunk

半腔热情 提交于 2019-12-07 07:32:42
问题 I am new to iText and faced with a real interesting case about adding external images to a paragraph. Here is the thing: Document document = new Document(); PdfWriter.getInstance(document, new FileOutputStream("out2.pdf")); document.open(); Paragraph p = new Paragraph(); Image img = Image.getInstance("blablabla.jpg"); img.setAlignment(Image.LEFT| Image.TEXTWRAP); // Notice the image added to the Paragraph through a Chunk p.add(new Chunk(img2, 0, 0, true)); document.add(p); Paragraph p2 = new

How do I surround all text pieces with paragraph tags?

吃可爱长大的小学妹 提交于 2019-12-07 03:52:30
问题 I want to put paragraph tags around any text items. It should therefore avoid tables and other elements. How do I do that? I guess it somehow can be made with preg_replace? 回答1: Here are a couple of functions that should help you to do what you want to do: // nl2p // This function will convert newlines to HTML paragraphs // without paying attention to HTML tags. Feed it a raw string and it will // simply return that string sectioned into HTML paragraphs function nl2p($str) { $arr=explode("\n"

Force paragraph to use the maximum height available

末鹿安然 提交于 2019-12-05 12:15:32
I have a series of divs which contain a small paragraph of text. I would like to make all the divs of the same height and vary the width as required to fit the paragraph. If I was to do this in the vertical direction I would just set the width of the div. But if I set the height the paragraph turns into one line making the box as wide as possible. How to I force the paragraph to have as many lines as the height will allow then increase in width as required I have tried using min-height:100px for the paragraphs but the left over height is filled with white space and the text is still on one