How to divide up?

Matthew Seaman m.seaman at infracaninophile.co.uk
Sun Jul 20 10:24:08 UTC 2008


Gary Kline wrote:
> On Sun, Jul 20, 2008 at 01:20:31PM +0530, N. Raghavendra wrote:
>> At 2008-07-19T17:23:48-07:00, Gary Kline wrote:
>>
>>> Is there an easyy way of splitting yp these tags into one-per-line?
>>> I'm not obsessive [[?, :)]], but for what I've got in mind, the tags
>>> and stuff would look better to my eyes?  ....the outcome of this
>>> will go ino a special database, not html .
>>>
>>> is there some clever perl one-liner ...
>> I suggest that instead of such ad hoc solutions, you checkout the port
>> `www/tidy'.  It provides a reasonable pretty printer for HTML.
>> However, it doesn't print every tag on a separate line.  I think its
>> behaviour in this respect is close to the style guidelines in the
>> FreeBSD Documentation Project Primer [10.1.4.2, Separating tags].
>>
>> Raghavendra.
>>
> 
> Thanks, but I've very recently become acquainted with tidy and have begun
> using it on my main index.php--thought.org's "www" page.   This page
> was an almost unreadable rat's net of by-hand coded html.   (as i move
> toward another mark-up standard.)    using your script, or mine,  based on
> Roland smith's, will be a great help.     
> 
> I knew there were ways of embedding \n's in scripts and signatures, &c,
> but until your posting, i had forgoooten exactly how.   thank you for
> the refresher!    
> 
> I'll check the FBSD Docs for `Separating Tags'; that level of obscurity is
> beyond amazing, :-)
>  

Alternatively, if your aim is to simplify the HTML, you could switch
to using CSS.

You'ld change:

<CENTER><FONT face="Times" size="3"><FONT color="#333366">Realization<BR>
... </FONT></FONT></CENTER>

To something like:

<span class="foo">Realization<br /> .... </span>

('span' here is just a handy all-purpose tag for identifying a chunk
of  stuff: the same mechanism can be applied to any HTML tag.)

Add this in the <head></head> section of the HTML:

    <link rel="stylesheet" href="style.css" type="text/css" />

and have a file style.css in you web root containing (inter alia)

.foo {
	text-align: center;
	font-family: "Times New Roman";
	font-size: "medium";
	color: #333366;
}

See http://www.w3.org/TR/CSS21/cover.html for the full story.

User of CSS has a number of advantages.  First off, it abstracts
the definition of the style into one place.  Suppose you decide that
medium sized pale blue text is passé and want it written in 24pt 
white sans-serif on a black background?  Instead of having to grep
through all of your HTML files, now you just have to edit one file.

The other advantage is more subtle.  You divide, conceptually, deciding
what a piece of text's /function/ is from deciding what it should /look 
like/.  So if the bit of text is, say, an aphorism that you're
quoting, you can just declare it to be class="aphorism" in the HTML
markup when writing that page, and then define a .aphorism { } 
section in your stylesheet, later on when it won't interrupt your train
of thought.

	Cheers,

	Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.                   7 Priory Courtyard
                                                  Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey     Ramsgate
                                                  Kent, CT11 9PW

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 258 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20080720/b46e7cc9/signature.pgp


More information about the freebsd-questions mailing list