Best syntax for bold <li> "Headings"

A

Andrew

Hi,

Can I have some suggestions for the most syntactically correct way to
make a bold heading within a list item? The page I am working on is:

http://people.aapt.net.au/~adjlstrong/homer.html

I have used the following but I have a few qualms:
<ul>
<li><strong>heading</strong>list info</li>
</ul>

BTW making this page has been the only time I have missed Dreamweaver:
doing long nested lists by hand is a little soul-destroying :)

Thanks for any advice!

Andrew
 
B

Blinky the Shark

Andrew said:
Hi,

Can I have some suggestions for the most syntactically correct way to
make a bold heading within a list item? The page I am working on is:

http://people.aapt.net.au/~adjlstrong/homer.html

I have used the following but I have a few qualms:
<ul>
<li><strong>heading</strong>list info</li>
</ul>

I'll listen in; I do it the same way you do.

Intersting page. I did some courses on ancient Greece in college, and
recently read a couple of books on ancient Greece (and Egypt and Rome)
as a refresher. Thanks for the link. :)

OT: So where did the Achilles/Patroclus perhaps-legend come from, and
why is that the only point you claim without support?
(e-mail address removed) if you want to go email.

Your "Converting to Linux" (which I use) link is borked.
 
K

K A Nuttall

Andrew said:
Can I have some suggestions for the most syntactically correct
way to make a bold heading within a list item?

I use a heading tag, outside the list. I assumed this was the
semantically correct way to do it, even though it makes the styling a
bit awkward.
 
N

Neredbojias

OT: So where did the Achilles/Patroclus perhaps-legend come from, and
why is that the only point you claim without support?

When whomever it was got shot in the foot, he yelled out, "Achy heel! Achy
heel!" and they nicknamed him accordingly...
 
A

Andrew

I'll listen in; I do it the same way you do.

Seems to be the general consensus, from another reply here and a general
search via Google.
Intersting page. I did some courses on ancient Greece in college, and
recently read a couple of books on ancient Greece (and Egypt and Rome)
as a refresher. Thanks for the link. :)

OT: So where did the Achilles/Patroclus perhaps-legend come from, and
why is that the only point you claim without support?
(e-mail address removed) if you want to go email.

Achilles / Patroclus I have not yet filled in. I aim to speak a little
about Achilles / Patroclus + Gilgamesh / Enkidu + Frodo / Sam.
Your "Converting to Linux" (which I use) link is borked.

Still underway. This small site is a tearing down and rebuild of an older
site so it a little messy; hence the free web space, no domain name etc.
I will be writing about Xubuntu 6.10 Edgy Eft

Thanks for your trouble!

Andrew
 
A

Andy Dingley

I use a heading tag, outside the list.

Hard to say, without seeing the code, but doesn't this mean that you've
marked up the whole list (many elements) as _one_ heading?

Is a list element a "heading" anyway? Headings "head" something, they
mark the location of the content itself. A list (such as a chapter
list) isn't a list of "headings", it's a list of references to headings
that exist somewhere else. They're obviously related, they might
contain the same text, it's reasonable to style their presentation
similarly, but semantically they aren't the actual headings.

So I'd apply a class to the <ul> and then use CSS to make them look the
same. I wouldn't apply HTML heading markup to the list of references
though.
 
B

Ben C

Hi,

Can I have some suggestions for the most syntactically correct way to
make a bold heading within a list item? The page I am working on is:

http://people.aapt.net.au/~adjlstrong/homer.html

I have used the following but I have a few qualms:
<ul>
<li><strong>heading</strong>list info</li>
</ul>

Is the qualm that you'd like the heading to be marked as <h1> or
something similar?

What you're doing is described in the CSS 2.1 spec as a "run-in header".

Few browsers support display:run-in, but that doesn't matter, you could
just make your heading <h1> and set ul h1 to display:inline and
font-weight:bolder, maybe using some classes if that selector's too
general.
 
A

Andrew

Is the qualm that you'd like the heading to be marked as <h1> or
something similar?

What you're doing is described in the CSS 2.1 spec as a "run-in header".

Few browsers support display:run-in, but that doesn't matter, you could
just make your heading <h1> and set ul h1 to display:inline and
font-weight:bolder, maybe using some classes if that selector's too
general.

Hi Ben,

Thank you for that. Your idea is so clear I am disappointed that I did
not think of it myself. Now that I can see that it can be done quite
easily with a styled heading element I just have to decide if the
gymnastics of doing it this way outweigh the ease of simply using <strong> :)

Thanks again,

Andrew
 
J

Jonathan N. Little

Andrew said:
Hi,

Can I have some suggestions for the most syntactically correct way to
make a bold heading within a list item? The page I am working on is:

http://people.aapt.net.au/~adjlstrong/homer.html

I have used the following but I have a few qualms:
<ul>
<li><strong>heading</strong>list info</li>
</ul>

Well if it is a heading, why is it not a heading? If you want to change
how it looks, jut change the style to suit!


LI H3 { display: inline; }


<ol>
<li><h3>Paris kills Achilles.</h3> According to the urban [...]
<ol>
<li>&quot;Be careful now; for I might be made into [...]</li>
BTW making this page has been the only time I have missed Dreamweaver:
doing long nested lists by hand is a little soul-destroying :)

Don't know, I just template and good old cut'n paste or play search and
replace games!
 
K

K A Nuttall

Andy said:
Hard to say, without seeing the code, but doesn't this mean that
you've marked up the whole list (many elements) as _one_ heading?

I'm not sure if you're confusing me with the OP. If not, what I meant
was that, when I create a heading for a list, I do not make it part of
the list at all. I create a separate heading, before the list.

Like this:

<h2>Sub heading for list</h2>
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
 
D

dorayme

Andrew said:
BTW making this page has been the only time I have missed Dreamweaver:
doing long nested lists by hand is a little soul-destroying :)

What sort of editor do you have? Have you got GREP pattern
facilities in it? You can make patterns and semi automate much of
this stuff. For example, I made a simple pattern replacement:

^ to be replaced by <li>

meaning the start of any line in the selected number of lines
gets an opening list item marker.

$ to </li>

closes. You can combine the two, save the pattern and use it
repeatedly for all lists. You type or cut and paste your text. It
is a natural to put each item on a separate line. You apply the
Search and Replace and tidy up afterwards for anything. The <ul>
is not worth worrying about. You type that in. Often a good text
editro will have a command key set to close (in this case, to put
in the </ul>)
 
A

Andrew

On Sat, 27 Jan 2007 07:54:27 +1100, dorayme wrote:

snip >>>>>>
What sort of editor do you have? Have you got GREP pattern
facilities in it? You can make patterns and semi automate much of
this stuff. For example, I made a simple pattern replacement:

snip >>>>>

Hi dorayme,

I use Bluefish and until you mentioned it I was not aware that grep was
built into it (Open Advanced ...). Having found it I guess I now need to
learn to use it :)

Andrew
 
D

dorayme

Andrew said:
On Sat, 27 Jan 2007 07:54:27 +1100, dorayme wrote:

snip >>>>>>

snip >>>>>

Hi dorayme,

I use Bluefish and until you mentioned it I was not aware that grep was
built into it (Open Advanced ...). Having found it I guess I now need to
learn to use it :)

Andrew

Just one more thought, without GREP you can do a lot too with
plain S&R. If there is a full stop at the end of each list item
and they are one sentence jobs. You can target the stop and say
to replace "." with ".</li> over some selected text. No matter
about occasional two sentence list item, you can clean up later,
the bulk of a long list can be done this way quicker then typing
or even cutting and pasting the "</li>" after each item.

Lots of other ways to skin this cat. Some editors can insert a
"<li></li>" at a key command, you then type in between.

Or better still, make yourself up a little template:

<ul>
<li></li>
<li></li>
<li></li>
</ul>

Make it longish and simply paste this in, further cut and paste
more pairs to suit your list and type in the midst. The key to
time saving is to think to do this beforehand.
 
J

Joe (GKF)

or even cutting and pasting the "</li>" after each item.

I like to use S&R to put </li><li> at the end of each item. Saves me
having to put <li> at the beginning. Often I just [ctrl]+v my way down
the list
 
T

Toby Inkster

Joe said:
I like to use S&R to put </li><li> at the end of each item. Saves me
having to put <li> at the beginning. Often I just [ctrl]+v my way down
the list

FWIW, the '</li>' tag is optional in HTML, so if you're not using XHTML,
creating a list in a reasonably featureful text editor is as simple as
selecting an area, doing a regular expression search and replace
equivalent to 's/^/<li>/g' and then topping and tailing it with
'<ul>...</ul>' or '<ol>...</ol>'.

Even if you're using XHTML, you just need to use a slightly more
complicated search and replace: s/^(.+)$/<li>\1<\/li>/g
 
J

Jonathan N. Little

freemont said:
I don't understand the backslash-one in this. What does it do?

Takes the "stuff" matching in the first part with the "()" and puts it
in the second part at the "\1", but I think in Perl "$1" is preferred
 
F

freemont

Takes the "stuff" matching in the first part with the "()" and puts it
in the second part at the "\1", but I think in Perl "$1" is preferred

Gotcha. Yes, $1 makes more sense to me. Thank you.
 
T

Toby Inkster

Jonathan said:
Takes the "stuff" matching in the first part with the "()" and puts it
in the second part at the "\1", but I think in Perl "$1" is preferred

Some regexp engines use $1, others use \1. My text editor uses the
backslash syntax.

Perl supports both, but treats them slightly differently. For example:

#!/usr/bin/perl
print "Type a sentance> ";
$_ = <>; # Read a line.
s/^(.+)\s+(.*)/$2 $1/; # Swap around first 2 words.
s/^(.+)\s+(.*)/\2 \1/; # Swap them back.
if (/^(.+)\s+/) # If the sentance starts with a word
{ $first = $1; } # Put it in $first.
if (/^(.+)\s+/) # Try this again...
{ $first = \1; } # Doesn't do what you expect!

That is, $-style backreferences become available to the rest of your
program until they get overwritten; \-style ones are only available
within the original regular expression.

PHP allows \1 and $1 and also, in line with PHP's string interpolation
synatx, ${1} and {$1}. They are all treated as equivalent, but the
curly braces ones are useful for distinguishing between ambiguous
cases. For example: '${12}' versus '${1}2; the former is backreference
twelve followed by nothing; the latter is backreference one followed by
the literal string '2'.

sed uses \1 to \9. The $-syntax is not recognised, and backreferences \10
and higher are not supported.
 
A

Andy Dingley

what I meant was that, when I create a heading for a list, I do not make it part of
the list at all. I create a separate heading, before the list.

That's what I thought you meant. A perfectly fine way to put a heading
onto the overall list. I think the OP was after a way of treating
individual elements of the list as "headings". This is a different
requirement, so the implementation ends up different.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top