Re: Attaching a CSS style sheet to a new HTML doc.

2011-03-14 Thread Charlie Garrison

Good morning,

On 14/03/11 at 5:37 AM -0700, RobS  wrote:

I suppose the only absolutely absolute path would be the full 
URL of the css file which, as I understand it, would not be a 
good thing to do for something as oft requested as a css file.


I haven't been following this thread, so I'm not sure what the 
understanding about "not be a good thing to do" comes from. 
There are three common methods of specifying a URL within an 
HTML page (whether that in  links or  anchors, or elsewhere).


Three examples are:

  mysite.css   (or ./mysite.css)
  /mysite.css
  http://mysite.com/mysite.css

The first two are relative URLs, the second commonly referred to 
root-relative URL. The third is absolute. All three are fine to 
use, but each should be used as appropriate.


For simple HTML pages, the first two are probably 'best' to use, 
and the second would be appropriate in most cases.


The first is most useful for sections of a site which might get 
moved; eg a blog which might get moved from root of the site to 
a /blog directory. If the blog refers to (eg) blog.css, then 
using a root-relative link will be fine as /blog.css when the 
blog exists at the root of the site. When the blog gets moved 
then that link will break. If the link was specified as 
relative, ./blog.css then it will continue to work when the blog 
is moved to /blog, with one condition. The blog doesn't contain 
any pages in sub-directories. Eg. the link would break when used 
from /blog/admin.


In that case root-relative links are better, eg. the link 
/blog/blog.css would work from any page on the site.


Since many sites use some sort of dynamic content with a theme 
(eg. many php sites) the root-relative links are best since it 
doesn't matter where the theme is used in the site, the links 
will still work.


The absolute URL links are needed when referring to content on a 
different site (or using http vs https, etc). As a general rule; 
don't use absolute URLs, except when it's obvious they are needed.


So...

If you're content may later get moved to different location 
within the site, use relative URLs.
If you're site is theme-driven dynamic content, use 
root-relative URLs.

If you're site refers to content from another site, use absolute URLs.

It's fine to mix & match the different types as needed. All of 
them are fine to use, the browser will always resolve the URLs 
to absolute before making any HTTP requests, and modern browsers 
will always check their local cache before making a request.


I hope that makes sense and helps you understand which style to 
use; I'm still on my first cuppa so apologies if I rambled on a 
bit.  :-)



Charlie

--
   Ꮚ Charlie Garrison ♊ 

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
〠  http://www.ietf.org/rfc/rfc1855.txt

--
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.

To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at

If you have a feature request or would like to report a problem, 
please email "supp...@barebones.com" rather than posting to the group.

Follow @bbedit on Twitter: 


Re: Range operations?

2011-03-14 Thread Simdude
Thanks again Steve. Actually, I wanted to perform an operation within
a selection to mimic what vi can do by specifying a range. i.e. do a
search and replace but only in a certain range. While it appears you
can't directly do this in BBedit, your tip will allow me to first
create a selection region, and then I can operation on that region.

thanks!

On Mar 13, 10:39 am, Steve Samuels  wrote:
> Mark, your original question was how to select  all text from the
> cursor up to the _line_ that
> contains specified text. Here are solutions.
>
> Exclude the line from the selection: (?s).+?(?=((?-s)^.*HELLO.*$))
> Include the line in the selection:   (?s).+?((?-s)^.*HELLO.*$)
>
> These will fail if the current line contains the text.
>
> Steve
>
> On Mar 10, 5:39 pm, Steve Samuels  wrote:
>
> > You are welcome, Mark. To give you a head start, with manual
> > references:
>
> > "(?s)" extends the search over line endings (p. 188)
>
> > ".+?HELLO" searches text up through the first occurrence of HELLO (non-
> > greedy matching, p. 177)
>
> > "(?=HELLO)" says to search up to "HELLO" but not include "HELLO" in
> > the found text (positive lookahead, pp. 187,190).
>
> > Parentheses around "HELLO" are a stylistic choice and don't affect
> > this search, though they might be important in other, more complicated
> > searches.
>
> > Steve
>
> > On Mar 10, 2:49 pm, Simdude  wrote:
>
> > > Wow. Thanks Steve. I have to give this a try as soon as I get home.
> > > And I guess it's time to dig into the BBedit docs some more!
>
> > > On Mar 10, 2:35 pm, Steve Samuels  wrote:
>
> > > > Searching for  "(?s).+?(HELLO)" will select all text from the cursor
> > > > up through the first "HELLO" and "(?s).+?(?=HELLO)" will select all
> > > > text up to first "HELLO">.
>
> > > > Steve
>
> > > > On Mar 10, 8:35 am, Simdude  wrote:
>
> > > > > Thanks Chris. I did know about the selection operations but when you
> > > > > have to do this repeatedly in a file, it's not as efficient. Scripting
> > > > > is probably a better option but I'll have to improve my Applescript
> > > > > skills to be able to do this faster.
>
> > > > > For any Barebones guys, adding something like to to a future BBedit
> > > > > would be a killer feature. With the help of some books, I've used vi
> > > > > to rearrange sections of large documents by using commands like this
> > > > > to find and move sections.  The problem is while you can do this with
> > > > > a single line in vi, it can take 30 minutes to figure out what to type
> > > > > in that line!
>
> > > > > Mark
>
> > > > > On Mar 9, 5:26 pm, Christopher Stone 
> > > > > wrote:
>
> > > > > > On Mar 09, 2011, at 10:28, Simdude wrote:> Is there a way in BBedit 
> > > > > > to operate on ranges of data? For example, when I use vi, if I want 
> > > > > > to do a search and replace on all text from my current cursor to 
> > > > > > the line that contains "HELLO", I would do this:
>
> > > > > > > :.,/HELLO/ s/this/that/g
>
> > > > > > > Can BBedit do this sort of range stuff?
>
> > > > > > __
>
> > > > > > Hey Mark,
>
> > > > > > Not directly.  But you can script that kind of search, or you can 
> > > > > > find/replace in the current selection.  So you could find + 'extend 
> > > > > > selection' to select your range and then find/replace *within* the 
> > > > > > range.
>
> > > > > > --
> > > > > > Best Regards,
> > > > > > Chris

-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at

If you have a feature request or would like to report a problem, 
please email "supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 


Re: Attaching a CSS style sheet to a new HTML doc.

2011-03-14 Thread RobS
Absolutely! I was confused by the relative looseness of English. Relative to 
a file in a particular folder, the paths I gave would be absolutely correct 
while actually being relative paths as defined in the regs.

I suppose the only absolutely absolute path would be the full URL of the css 
file which, as I understand it, would not be a good thing to do for 
something as oft requested as a css file.

Rob

-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at

If you have a feature request or would like to report a problem, 
please email "supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: