Preserving spacing and whitespace

Discussion in 'HTML' started by burchill, Sep 6, 2004.

  1. burchill

    burchill Guest

    I am writing a program that will convert guitar tablature text files
    into html files.

    The biggest stumbling block is that html doesn't preserve spacing of a
    txt file. Is there a tag that will preserve the spacing of the text
    inside it ?

    Any help appreciated.

    --
    Eps
    burchill, Sep 6, 2004
    #1
    1. Advertising

  2. burchill

    Els Guest

    burchill wrote:

    > I am writing a program that will convert guitar tablature
    > text files into html files.
    >
    > The biggest stumbling block is that html doesn't preserve
    > spacing of a txt file. Is there a tag that will preserve
    > the spacing of the text inside it ?


    <pre></pre>

    --
    Els
    http://locusmeus.com/
    Sonhos vem. Sonhos vão. O resto é imperfeito.
    - Renato Russo -
    Els, Sep 6, 2004
    #2
    1. Advertising

  3. burchill <> wrote:

    > The biggest stumbling block is that html doesn't preserve spacing of a
    > txt file. Is there a tag that will preserve the spacing of the text
    > inside it ?


    No, but you could try CSS or even SVG.

    The Doormouse

    --
    The Doormouse cannot be reached by e-mail without her permission.
    The Doormouse, Sep 6, 2004
    #3
  4. burchill

    Deryck Guest

    "burchill" <> wrote in message
    news:...
    > I am writing a program that will convert guitar tablature text files
    > into html files.
    >
    > The biggest stumbling block is that html doesn't preserve spacing of a
    > txt file. Is there a tag that will preserve the spacing of the text
    > inside it ?
    >


    http://www.codetoad.com/html/text/pre_tag.asp

    The example is even about guitars. :)

    Deryck
    Deryck, Sep 6, 2004
    #4
  5. "Deryck" <> wrote:

    > http://www.codetoad.com/html/text/pre_tag.asp
    >
    > The example is even about guitars. :)


    Huh? The example is

    <pre>

    text file stuff here
    complete with line breaks and things.

    </pre>

    and the page has little useful content - it has a very sloppy description
    of the "HTML <PRE> tag", followed by user comments that range from mostly
    pointless to absurd (including the use of invalid markup).

    However, <pre> element _might_ be a solution, but it's best to learn to
    use it from some nice tutorial or reference.

    Moreover, this might even be a case for using Ruby markup. But I know
    virtually nothing about guitars, so I can't really tell.

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
    Jukka K. Korpela, Sep 6, 2004
    #5
  6. On Mon, 06 Sep 2004 12:48:09 +0000, The Doormouse wrote:

    > No, but you could try CSS or even SVG.
    >
    > The Doormouse


    I'm sorry, Doormouse, but that advice doesn't even make sense, *or*
    answser the question. SVG to preserve spacing in a text file??

    I realize that at this point I appear to be merely pestering you for no
    reason other than your lackluster response to my post in another, similar,
    newsgroup.

    But at this time I'd like to see you refrain from giving advice or
    answering questions until you at least have a bit more correct
    information. Your posts are often not correct, or just shy of
    being quite correct. And you come close to trolling more often than not.

    okay, later, have a nice day.

    --
    Jeffrey Silverman

    ** Drop "PANTS" to reply by email
    Jeffrey Silverman, Sep 6, 2004
    #6
  7. burchill

    Neal Guest

    On Mon, 6 Sep 2004 16:12:11 +0000 (UTC), Jukka K. Korpela
    <> wrote:

    > "Deryck" <> wrote:
    >
    >> http://www.codetoad.com/html/text/pre_tag.asp
    >>
    >> The example is even about guitars. :)

    >
    > Huh? The example is
    >
    > <pre>
    >
    > text file stuff here
    > complete with line breaks and things.
    >
    > </pre>
    >
    > and the page has little useful content - it has a very sloppy description
    > of the "HTML <PRE> tag", followed by user comments that range from mostly
    > pointless to absurd (including the use of invalid markup).
    >
    > However, <pre> element _might_ be a solution, but it's best to learn to
    > use it from some nice tutorial or reference.


    I'm sure Jukka would have provided
    http://www.w3.org/TR/html401/struct/text.html#edef-PRE had he had enough
    time. Good thing I do.
    Neal, Sep 6, 2004
    #7
  8. burchill

    Deryck Guest

    "Jukka K. Korpela" <> wrote in message
    news:Xns955CC35904251jkorpelacstutfi@193.229.0.31...
    > "Deryck" <> wrote:
    >
    > > http://www.codetoad.com/html/text/pre_tag.asp
    > >
    > > The example is even about guitars. :)

    >
    > Huh? The example is
    >
    > <pre>
    >
    > text file stuff here
    > complete with line breaks and things.
    >
    > </pre>
    >

    Oh very well....the example is introduced to the reader as a solution to a
    problem that involves a guitar tab in text format - which is pretty much
    what the OP was trying to solve.

    " Say you have a text file - perhaps you're a guitarist and you've got a
    guitar tab in text format, or perhaps you have a text-based email document
    you want to put quickly online. Do you have to go through all the bother of
    adding <BR> and spacing it all out correctly?
    "

    Forgive me for not being more precise in my text that followed the link that
    would solve the OP's problem.

    Cheers

    Deryck
    Deryck, Sep 6, 2004
    #8
  9. burchill

    Toby Inkster Guest

    Jukka K. Korpela wrote:

    > Moreover, this might even be a case for using Ruby markup. But I know
    > virtually nothing about guitars, so I can't really tell.


    IIRC, Ruby only allows three lines of concurrant text. Guitar tabs need at
    least 6 (one for each string, then perhaps a line for lyrics and maybe one
    for chords)

    <pre> is what the OP wants.

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me ~ http://tobyinkster.co.uk/contact
    Now Playing ~ ./bruce_springsteen/gratest_hits/18_this_hard_land.ogg
    Toby Inkster, Sep 6, 2004
    #9
  10. burchill

    burchill Guest

    Toby Inkster wrote:
    > Jukka K. Korpela wrote:
    >
    >
    >>Moreover, this might even be a case for using Ruby markup. But I know
    >>virtually nothing about guitars, so I can't really tell.

    >
    >
    > IIRC, Ruby only allows three lines of concurrant text. Guitar tabs need at
    > least 6 (one for each string, then perhaps a line for lyrics and maybe one
    > for chords)
    >
    > <pre> is what the OP wants.
    >


    Thanks all, PRE does indeed seem to work.

    --
    Eps
    burchill, Sep 6, 2004
    #10
  11. Jeffrey Silverman <> wrote:

    > On Mon, 06 Sep 2004 12:48:09 +0000, The Doormouse wrote:
    >
    >> No, but you could try CSS or even SVG.
    >>
    >> The Doormouse

    >
    > I'm sorry, Doormouse, but that advice doesn't even make sense, *or*
    > answser the question. SVG to preserve spacing in a text file??


    I know, it looks confusing, but:

    Illustrator can output SVG, which is ideal for line art (in other words,
    your music sheets, text and notation) and -

    If I was going to display music sheets on the internet, my first thought
    would be to lay out the design in Illustrator. Cut and paste the original
    file direct into Illy. From Illy, I could output a SVG graphic of the
    musical sheet. Illy can also output HTML instead - or GIF files, or both.
    Whatever. Or, make a PDF using Illy. The PDF will certainly keep the
    spacing.

    Now you have three options for maintaining the spacing from just one
    original using a simple cut and paste operation. Plus, the results will
    be visually superior to <pre>, although <pre> will work.

    > But at this time I'd like to see you refrain from giving advice or
    > answering questions until you at least have a bit more correct
    > information.


    Please review my response above. I have delivered three graphical
    solutions for turning a text document into perfect output.

    > Your posts are often not correct, or just shy of
    > being quite correct.


    My posts are often not what you expect. :)

    Use <pre> if you want, but it's so crude ...

    The Doormouse

    --
    The Doormouse cannot be reached by e-mail without her permission.
    The Doormouse, Sep 7, 2004
    #11
  12. Another solution is to generate the SVG dynamically. Since SVG is really
    just XML, a good programmer might be able to do this.

    SVG requires a plugin to use, though.

    Almost everyone can view PDF's.

    The Doormouse

    --
    The Doormouse cannot be reached by e-mail without her permission.
    The Doormouse, Sep 7, 2004
    #12
  13. burchill

    rf Guest

    The Doormouse wrote:

    > Another solution is to generate the SVG dynamically. Since SVG is really
    > just XML, a good programmer might be able to do this.


    Have you ever *looked* at a guitar tab? Most people who write them use
    notepad or a similar text editor. They are strictly monospaced ascii files.
    There is no "music" as such in them, no staffs, no clefs, no notes, no
    rests. There *are* bars though. They are designed specifically to represent
    music in ascii, sort of like ascii art. As such they print very nicely. How
    does SVG adapt to printing?

    > SVG requires a plugin to use, though.


    Yes.

    > Almost everyone can view PDF's.


    Not without the plug in, which is required to view PDFs.

    *Everyone* can view <pre> elements. Even people with text browsers.

    --
    Cheers
    Richard.
    rf, Sep 7, 2004
    #13
  14. "rf" <rf@.invalid> wrote:

    > Have you ever *looked* at a guitar tab?


    Once, "Puff The Magic Dragon" on two sheets, bought at a music store. It's
    a very sad song, one of my favorites.

    All I have ever seen is store-bought sheet music, and made the reasonable
    assumption that he would be generating something similar in HTML using the
    text file as a guide.

    After a 30-second search on the internet I found what hand-typed guitar
    tabs look like. The tabulature that I saw was spaced using "-" signs.

    Now I see what you guys are trying to suggest as a solution and why you are
    all so incredulous at my suggestions. I would like to make "art", like
    professional sheet music. You all just want something that resembles the
    text file format.

    My suggestion would be prettier, yours are more functional.

    *shrug*

    FWIW, Harmonica notation is its own beast, too. Haven't touched one in
    years.

    The Doormouse

    --
    The Doormouse cannot be reached by e-mail without her permission.
    The Doormouse, Sep 7, 2004
    #14
  15. burchill

    Neal Guest

    On Tue, 07 Sep 2004 03:04:32 GMT, The Doormouse <> wrote:


    > My suggestion would be prettier, yours are more functional.


    And functional is well in the spirit of semantic HTML, where the
    presentation is separate from the content. Aside from the ASCII-style
    tabs, the best way to do it is images.

    As a professional musician, I wish there was a really convenient way to
    display notation in HTML. Sadly, that's likely not to be possible in my
    lifetime, unless all musicians can get a Finale-like plugin to view a
    notated page.
    Neal, Sep 7, 2004
    #15
  16. burchill

    rf Guest

    The Doormouse wrote:
    > "rf" <rf@.invalid> wrote:
    >
    > > Have you ever *looked* at a guitar tab?

    >
    > After a 30-second search on the internet I found what hand-typed guitar
    > tabs look like. The tabulature that I saw was spaced using "-" signs.
    >
    > Now I see what you guys are trying to suggest as a solution and why you

    are
    > all so incredulous at my suggestions. I would like to make "art", like
    > professional sheet music. You all just want something that resembles the
    > text file format.


    Yep. That's the idea.

    It looks odd the first time you see one, nothing like "real" music. However,
    after a bit of practice it is as easy to read as real music. Easier in some
    ways. Those numbers in a vertical column "look" like chords more than a real
    music chord does. It is virtually a "picture" of the guitar music in three
    dimensions: across the frets; up the neck; and time. Real music is only two
    dimensional: the notes of the chromatic scale: and time.

    It's useless for anything other than guitar though (or other such stringed
    instruments).

    --
    Cheers
    Richard.
    rf, Sep 7, 2004
    #16
  17. burchill

    WebcastMaker Guest

    In article <Xns955CCC3ED36A6doormouseattnet@68.12.19.6>,
    says...
    > FWIW, Harmonica notation is its own beast, too. Haven't touched one in
    > years.


    Cross-harp. The only way to play harmonica. No training needed, but
    you instantly sound like a pro...
    --
    WebcastMaker
    Webcasting for free
    http://www.webentations.com
    WebcastMaker, Sep 7, 2004
    #17
  18. On Mon, 06 Sep 2004 23:48:08 +0000, The Doormouse wrote:

    > I know, it looks confusing, but:
    >
    > Illustrator can output SVG, which is ideal for line art (in other words,
    > your music sheets, text and notation) and -
    >
    > If I was going to display music sheets on the internet, my first thought
    > would be to lay out the design in Illustrator. Cut and paste the original
    > file direct into Illy. From Illy, I could output a SVG graphic of the
    > musical sheet. Illy can also output HTML instead - or GIF files, or both.
    > Whatever. Or, make a PDF using Illy. The PDF will certainly keep the
    > spacing.
    >
    > Now you have three options for maintaining the spacing from just one
    > original using a simple cut and paste operation. Plus, the results will
    > be visually superior to <pre>, although <pre> will work.


    While I agree that SVG is a potentially good format, it has even less
    general support than, say, PNG.

    Why are you so big on SVG? You are contradicting yourself. No, really,
    you are. SVG is promising, but so was VRML (at least, acc. to the
    proponents of VRML). Where is VRML?

    Also, can Illustrator *import* SVG? It seems to me that for SVG to become
    truly feasible as a vector format, then the premier vector illustration
    program, Adobe Illustrator (which I happen to think kicks ass and is the
    *only* reason I keep a Windows partition around) ought to be able to
    *read* SVG files. Admittedly, last time I checked was Illustrator 9,
    which, AFAIK, could not read SVG files. How about 10? Or that new one,
    whatever it is called -- QP? XL? DM? I dunno, some set of letters, I think.

    Although truthfully, if I were going to create sheet music for the Web, I
    would never use Illustrator! I would use a sheet music creation tool of
    which there are several, and which also export PDF format sheet music.

    Allright, later...

    --
    Jeffrey D. Silverman | **
    Website | http://www.newtnotes.com

    (** Drop "pants" to reply by email)
    Jeffrey Silverman, Sep 7, 2004
    #18
  19. Jeffrey Silverman <> wrote:

    > While I agree that SVG is a potentially good format, it has even less
    > general support than, say, PNG.
    >
    > Why are you so big on SVG? You are contradicting yourself. No,
    > really, you are.


    *sigh*

    > SVG is promising, but so was VRML (at least, acc. to
    > the proponents of VRML). Where is VRML?


    My biggest objection to PNG is that you can get very similar
    functionality from more common, 100% universal formats. The only vector
    based alternative to SVG is SWF (Flash). I would have suggested SWF,
    except that it also requires a plugin. More people may have that plugin,
    so SWF would work, too.

    So you see, you perceived a contradiction because I did not support PNG -
    but the circumstances are different. If you know of a plugin-free, vector
    based format that is not SWF nor SVG, and is 100% universal like JPEG or
    GIF, then please share.

    I am "big on SVG" because it is XML-based and open source. You could/can
    script SVG on the fly. Its usage will only grow. Adobe supplies the best
    free SVG plugin for the most common browser (IE6).

    I am not sure if Javascript could be used to make an SVG graphic that
    displayed the guitar tabs based on text input, but it might.

    > Also, can Illustrator *import* SVG?


    Yes, but not all SVG files.
    See the Illy CS feature description.

    > Although truthfully, if I were going to create sheet music for the
    > Web, I would never use Illustrator! I would use a sheet music creation
    > tool of which there are several, and which also export PDF format
    > sheet music.


    Soemtiems trying to find a free tool is more trouble than it is worth. If
    you had Illy, and could not find soemthing cheap ... Illy looks good for
    the task.

    The Doormouse

    --
    The Doormouse cannot be reached by e-mail without her permission.
    The Doormouse, Sep 8, 2004
    #19
  20. On Tue, 07 Sep 2004 23:25:32 +0000, The Doormouse wrote:

    > My biggest objection to PNG is that you can get very similar functionality
    > from more common, 100% universal formats. The only vector based
    > alternative to SVG is SWF (Flash). I would have suggested SWF, except that
    > it also requires a plugin. More people may have that plugin, so SWF would
    > work, too.


    Not to reopen this can-of-worms thread again, but your perceived support
    for PNG format is wrong. PNG is *widely* supported!!

    http://www.libpng.org/pub/png/pngapps.html

    You can use PNG images for all images on all websites and most surfers
    will not know the difference! The *only* not-widely-supported feature is
    alpha transparency.

    <snip!>

    > Yes, but not all SVG files.
    > See the Illy CS feature description.
    >
    >> Although truthfully, if I were going to create sheet music for the Web,
    >> I would never use Illustrator! I would use a sheet music creation tool
    >> of which there are several, and which also export PDF format sheet
    >> music.

    >
    > Soemtiems trying to find a free tool is more trouble than it is worth. If
    > you had Illy, and could not find soemthing cheap ... Illy looks good for
    > the task.


    I never said "free" tool. I said "sheet music creation tool". Illustrator
    is a very poor choice for laying out sheet music!

    --
    Jeffrey D. Silverman | **
    Website | http://www.newtnotes.com

    (** Drop "pants" to reply by email)
    Jeffrey Silverman, Sep 8, 2004
    #20
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Oli Filth
    Replies:
    9
    Views:
    3,325
    Uncle Pirate
    Jan 17, 2005
  2. TTroy
    Replies:
    16
    Views:
    788
    Peter Nilsson
    Jan 31, 2005
  3. Replies:
    4
    Views:
    521
  4. Michal Kwiatkowski

    Python AST preserving whitespace and comments

    Michal Kwiatkowski, Aug 28, 2008, in forum: Python
    Replies:
    1
    Views:
    1,170
    Terry Reedy
    Aug 28, 2008
  5. Replies:
    10
    Views:
    741
    Eric Brunel
    Dec 16, 2008
Loading...

Share This Page