www.webdeveloper.com
Results 1 to 9 of 9

Thread: Newline character in HTML

  1. #1
    Join Date
    Jan 2011
    Location
    Munich, Germany
    Posts
    223

    Newline character in HTML

    How often in practice will you find a newline character in the middle of HTML?
    Just tested in my browser - newline characters within HTML are ignored and the output is displayed correctly.

    I am asking, because I would like to introduce a small domain specific language that works with the newline character as a trigger (outside of HTML, using the off-side-rule).

    Now, if it is regarded as perfectly normal practice to place the newline anywhere within HTML, I would probably need regular expressions to find out the boundaries of the blocks.

    My research has indicated, that especially in a TEXTAREA, a newline character is perfectly normal.


    Thanks in advance
    http://4nf.org/ - Ajaxify jQuery plugin

  2. #2
    Join Date
    Mar 2012
    Posts
    926
    I use new line characters to make the HTML code more readable, hence easier to maintain. So they are placed liberally in every web page I have written. I think that is quite normal.

  3. #3
    Join Date
    Jan 2011
    Location
    Munich, Germany
    Posts
    223
    Thanks, that's what I thought
    What's the easiest way then to detects the boundaries of HTML tags/blocks?
    http://4nf.org/ - Ajaxify jQuery plugin

  4. #4
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,270
    Quote Originally Posted by arvgta View Post
    Thanks, that's what I thought
    What's the easiest way then to detects the boundaries of HTML tags/blocks?
    Use a parser.
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  5. #5
    Join Date
    Jan 2011
    Location
    Munich, Germany
    Posts
    223
    Thanks Charles!

    I suppose, I could instead introduce the custom delimiter "\n|"
    i.e. newline + "|".

    Do you think that that would be unique, keeping in mind that the user is self-responsible anyway, as soon as (s)he includes the .js?

    How often does "\n|" occur in everyday HTML?
    http://4nf.org/ - Ajaxify jQuery plugin

  6. #6
    Join Date
    Mar 2012
    Posts
    926
    Why do you need to introduce a new line character in HTML? What is wrong with </p> </li> etc... that perform an implicit line break. Or <br> which performs an explicit one???

  7. #7
    Join Date
    Jan 2011
    Location
    Munich, Germany
    Posts
    223
    Nothing wrong with them. They will not be replaced or touched at all...

    Would like to introduce a small DSL(domain specific language) between the HTML like:

    |command1 argument1 argument2
    |command2 argument1 argument2 argument3
    |command3 etc.

    That's why I'm asking, how often you think the "\n|" will occur in practice?

    (please keep in mind, that the user of the DSL will be self-responsible anyway)

    Thanks!
    http://4nf.org/ - Ajaxify jQuery plugin

  8. #8
    Join Date
    Mar 2012
    Posts
    926
    I think that the whole idea is crackpot. I can think of a thousand reasons not to re-invent the wheel, and none in favour. Just because something is technically possible and terribly clever does not make it sensible to do. Remember, someone has to maintain your code. Even if that is you, I suspect that you will curse your own stupidity for introducing non-standard elements that do nothing more than the language does anyway!

  9. #9
    Join Date
    Jan 2011
    Location
    Munich, Germany
    Posts
    223
    Normal HTML on the page will be untouched.
    The user is self-responsible if using the DSL.
    I have responsibility between releases to make sure,
    that the release is bug-free and coherent.

    Let's keep the focus on the actual simple question -
    what about the master delimiter: "\n|" ?

    How often does it occur in normal HTML?
    http://4nf.org/ - Ajaxify jQuery plugin

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles