473,771 Members | 2,406 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Blank lines and paragraph break in html

Hi there,

I have a quick question. In my html document, I want to make a new
paragraph whenever I have a blank line in the html source. Using <p>
and </pevery time is kind of cumbersome (I want to do it the LaTeX
way). Is it possible at all?

Thanks for your time,
Yogi

May 11 '07 #1
15 19874
Yogi wrote:
I have a quick question. In my html document, I want to make a new
paragraph whenever I have a blank line in the html source. Using <p>
and </pevery time is kind of cumbersome (I want to do it the LaTeX
way). Is it possible at all?
<pis the semantically correct way to mark up a paragraph. You
shouldn't want to change that.

You can style it however you like with CSS.

p { margin-bottom: 4em; }

Play with the numbers.

Sorry, what is the LaTeX way?

--
-bts
-Motorcycles defy gravity; cars just suck
May 11 '07 #2
Yogi wrote:
Hi there,

I have a quick question. In my html document, I want to make a new
paragraph whenever I have a blank line in the html source. Using <p>
and </pevery time is kind of cumbersome (I want to do it the LaTeX
way). Is it possible at all?

Thanks for your time,
Yogi
HTML stands for HyperText Markup Language. To be HTML, it must have the
markups (e.g., <p>).

In most cases, the end-tag </pis optional. I use the end-tag only
when I have declared a style for <p(e.g., via a class attribute) that
I don't want to continue into content where I don't want to declare a
new paragraph.

--

David E. Ross
<http://www.rossde.com/>.

Don't ask "Why is there road rage?" Instead, ask
"Why NOT Road Rage?" or "Why Is There No Such
Thing as Fast Enough?"
<http://www.rossde.com/roadrage.html>
May 11 '07 #3
Yogi wrote:
>
I have a quick question. In my html document, I want to make a new
paragraph whenever I have a blank line in the html source. Using <p>
and </pevery time is kind of cumbersome (I want to do it the LaTeX
way). Is it possible at all?
You can try making your content as a text file, with <preand </pre>
deliminating it, and hope for the best. I'm not sure what HTML markup
you'll be able to use inside the <preelement, but I'll leave that
discovery to you.

I must say, though, that it's a weird request. Marking up paragraphs as
paragraphs in documents is part of Web publishing. HTML is the means to
do that. Throwing out a three-byte tag because it's too long is jsut
bizarre to me. But then, I am not a follower of the LaTeX Way.

--
John
May 11 '07 #4
"Beauregard T. Shagnasty" <a.*********@ex ample.invalidwr ites:
Yogi wrote:
>I have a quick question. In my html document, I want to make a new
paragraph whenever I have a blank line in the html source. Using <p>
and </pevery time is kind of cumbersome (I want to do it the LaTeX
way). Is it possible at all?

<pis the semantically correct way to mark up a paragraph. You
shouldn't want to change that.

You can style it however you like with CSS.

p { margin-bottom: 4em; }

Play with the numbers.

Sorry, what is the LaTeX way?
The LaTeX way is for blank lines in source to denote paragraph breaks.
If it looks like a paragraph in source, it's a paragraph in the output.

sherm--

--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
May 11 '07 #5
Yogi <yo************ *@gmail.comwrit es:
I have a quick question. In my html document, I want to make a new
paragraph whenever I have a blank line in the html source. Using <p>
and </pevery time is kind of cumbersome (I want to do it the LaTeX
way). Is it possible at all?
You might have a look at Markdown:

<http://en.wikipedia.or g/wiki/Markdown>
<http://daringfireball. net/projects/markdown/syntax>

Browsers don't understand Markdown, but many CMS systems and editors do,
and can automagically translate it into HTML.

sherm--

--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
May 11 '07 #6
On 11 May, 03:31, Yogi <yogeshwersha.. .@gmail.comwrot e:
I have a quick question. In my html document, I want to make a new
paragraph whenever I have a blank line in the html source.
Just regex pairs of adjacent linebreaks into <p>.

s/\n(\s*\n\s*)+/\n<p>/

You can ignore the </pin HTML (but don't use XHTML).

Remember that in HTML a <pmarks the _start_ of a paragraph, not a
"paragraph break". The difference is subtle, but significant. I don't
know how TeX regards this.

Don't confuse this with <br>. That's a linebreak, which is an inline
thing not paras, and it also is a "break" marker, not a "start"
marker.

If you don't like the rendered whitespace you get, fix that with CSS,
not by changing the underlying HTML

If you really care, run the converted HTML through Tidy afterwards.
May 11 '07 #7
On 2007-05-11, Andy Dingley wrote:
On 11 May, 03:31, Yogi <yogeshwersha.. .@gmail.comwrot e:
>I have a quick question. In my html document, I want to make a new
paragraph whenever I have a blank line in the html source.

Just regex pairs of adjacent linebreaks into <p>.

s/\n(\s*\n\s*)+/\n<p>/
That will not work. Text utilities read a line at a time, and a
line cannot contain a newline.

With awk:

awk '
/./ && empty { empty = 0; printf "<p>" }
!/./ { empty = 1 }
{print}
'

--
Chris F.A. Johnson <http://cfaj.freeshell. org>
========= Do not reply to the From: address; use Reply-To: ========
Author:
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
May 12 '07 #8
"Chris F.A. Johnson" <cf********@gma il.comwrites:
On 2007-05-11, Andy Dingley wrote:
>On 11 May, 03:31, Yogi <yogeshwersha.. .@gmail.comwrot e:
>>I have a quick question. In my html document, I want to make a new
paragraph whenever I have a blank line in the html source.

Just regex pairs of adjacent linebreaks into <p>.

s/\n(\s*\n\s*)+/\n<p>/

That will not work. Text utilities read a line at a time
s/Text utilities/Awk/

I hate to break it to you, but Awk is not the only text utility in
the world. It may still have that old one-line-at-a-time limit, but
the rest of the world moved past that years ago.

If you use something reasonably modern - Perl, Ruby, Python, Java,
any of a variety of regex-aware editors, etc. - the above will work
just fine.

sherm--

--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
May 12 '07 #9
On 2007-05-12, Sherm Pendley wrote:
"Chris F.A. Johnson" <cf********@gma il.comwrites:
>On 2007-05-11, Andy Dingley wrote:
>>On 11 May, 03:31, Yogi <yogeshwersha.. .@gmail.comwrot e:

I have a quick question. In my html document, I want to make a new
paragraph whenever I have a blank line in the html source.

Just regex pairs of adjacent linebreaks into <p>.

s/\n(\s*\n\s*)+/\n<p>/

That will not work. Text utilities read a line at a time

s/Text utilities/Awk/
And sed and other text utilities.
I hate to break it to you, but Awk is not the only text utility in
the world. It may still have that old one-line-at-a-time limit, but
the rest of the world moved past that years ago.

If you use something reasonably modern - Perl, Ruby, Python, Java,
any of a variety of regex-aware editors, etc. - the above will work
just fine.
Those are overkill for a simple task that can be done easily in sed
or awk.

--
Chris F.A. Johnson <http://cfaj.freeshell. org>
========= Do not reply to the From: address; use Reply-To: ========
Author:
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
May 12 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1367
by: Row | last post by:
HI, I would first like to say its been about 3 years since looking at java im very rusty! I have to write a post it notes type applet which will function online. (reading from a flat text file) My main problem is: getting each paragraph into my vector array - so that each paragraph sits in a new array element. Eg: when i referance array elemant 2 it will give me paragraph which is in that element and not all paragraphs in the text file...
6
4296
by: Ruben | last post by:
Hello. I am trying to read a small text file using the readline statement. I can only read the first 2 records from the file. It stops at the blank lines or at lines with only spaces. I have a while statement checking for an empty string "" which I understand represents an EOF in Python. The text file has some blank lines with spaces and other with blanks. Thanks a lot.
6
5540
by: Melissa | last post by:
Does anyone have a generic procedure for adding blank lines to reports like Sales details, PO details and/or Orders details. The procedure would need to count the number of line items, determine the remaining page to fill and print blank lines with the same number of fields as the line items. In addition, if there were a long list of line items that carried over to a second and possibly more pages, to print blank lines at the last page. The...
1
1805
by: satya.mahesh | last post by:
Hi All, I am working on a problem which "eliminates blank lines in export (between headings and when a heading is empty)". I want a macro which will do this job for me. For e.g: Heading1 Heading2
4
2877
by: Andreas Bauer | last post by:
Hi, I have to audit some c# code. I know in the options I can adjust how the code should be formatted while entering it. But is there any way to apply afterwards a code template to the classes to adjust their appearance (except ctrl-k ctrl-f)? Foremost how to clear unnecessary blank lines, e.g reduce 4 blank lines to one. I don´t want to change every class manually. Thanks in advance for any hint.
0
1112
by: jstendor | last post by:
I have an XML file that contains Invoices. In most cases there is a page break for cleints and I need to fill the remaining lines on the page with blanks and place a Page N of T at the bottom. I have logic that counts each line as I create them for the output and when I am ready for a page break, I use (55 - LineCount) to give me the number of blank lines I need to generate. The problem I have is I want to loop/iterate to the end...
5
1851
by: bigpaco | last post by:
I am trying to use looping to indent paragraphs in a file. So I need to insert blanks at the beginning of each paragraph, to do so I will need to know where the paragraph starts and it says that there is a blank before each paragraph. I need to know how do I tell the program to find those blank lines. Please help! Thanks
4
1376
by: sskk | last post by:
how can i split by blank lines? split(\r\n\r\n,$arr) like this?
0
9619
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10260
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10102
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8933
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6712
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2850
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.