sam-fans - fans of the sam editor
 help / color / mirror / Atom feed
* formatting HTML tables in ascii
@ 1999-08-31 15:47 James A. Robinson
  0 siblings, 0 replies; 2+ messages in thread
From: James A. Robinson @ 1999-08-31 15:47 UTC (permalink / raw)
  To: sam Fans

I'm trying to format an HTML table using sam's regexp commands. What
I wanted was a single line for each row, with each column seperated by
a tab.  I can handle single-line columns in a row like

a a a
      b b b b b
                c c c c c
d d d d d
          e e e e e e e e
                          f f

without a problem using

    , y/\n[A-Za-z0-9]/ x/\n/ d
    , x/  +/ c/	/

But how do I craft a regexp to handle a blob of a multicolumn lines?

01F6 
                  1
                      LATIN CAPITAL LETTER HWAIR 
                                                    97-May-29
                                                    Accepted 
                                                                 98-Oct-22
                                                                  Stage 6
01F7 
                  1
                      LATIN CAPITAL LETTER WYNN 
                                                    97-May-29
                                                    Accepted 
                                                                 98-Oct-22
                                                                  Stage 6

I can match the blobs with

    , x/^[A-Za-z0-9]+ *\n( +([A-Za-z0-9\- ]+)+\n)+/

But is there any way to craft a regxp that, in the above example, replaces
'HWAIR\n' with 'HWAIR\t' but replaces '97-May-29\n' with '97-May-29 '
(a column sep vs a line join)?

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
James A. Robinson                       jim.robinson@stanford.edu
Stanford University HighWire Press      http://highwire.stanford.edu/
650-723-7294 (W) 650-725-9335 (F)   


^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: formatting HTML tables in ascii
@ 1999-09-01  8:07 Nigel Roles
  0 siblings, 0 replies; 2+ messages in thread
From: Nigel Roles @ 1999-09-01  8:07 UTC (permalink / raw)
  To: 'Jim.Robinson@Stanford.Edu', sam Fans

My HTML might be a bit weak, but this will swap all the \n's in the
blob to \t's.

,x/^[A-Za-z0-9]+ *(\n +([A-Za-z0-9\- ]+)+)+/x/\n/c/	/

-----Original Message-----
From: James A. Robinson [mailto:Jim.Robinson@Stanford.Edu]
Sent: Tuesday, August 31, 1999 4:47 PM
To: sam Fans
Subject: formatting HTML tables in ascii


I'm trying to format an HTML table using sam's regexp commands. What
I wanted was a single line for each row, with each column seperated by
a tab.  I can handle single-line columns in a row like

a a a
      b b b b b
                c c c c c
d d d d d
          e e e e e e e e
                          f f

without a problem using

    , y/\n[A-Za-z0-9]/ x/\n/ d
    , x/  +/ c/	/

But how do I craft a regexp to handle a blob of a multicolumn lines?

01F6 
                  1
                      LATIN CAPITAL LETTER HWAIR 
                                                    97-May-29
                                                    Accepted 
                                                                 98-Oct-22
                                                                  Stage 6
01F7 
                  1
                      LATIN CAPITAL LETTER WYNN 
                                                    97-May-29
                                                    Accepted 
                                                                 98-Oct-22
                                                                  Stage 6

I can match the blobs with

    , x/^[A-Za-z0-9]+ *\n( +([A-Za-z0-9\- ]+)+\n)+/

But is there any way to craft a regxp that, in the above example, replaces
'HWAIR\n' with 'HWAIR\t' but replaces '97-May-29\n' with '97-May-29 '
(a column sep vs a line join)?

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
James A. Robinson                       jim.robinson@stanford.edu
Stanford University HighWire Press      http://highwire.stanford.edu/
650-723-7294 (W) 650-725-9335 (F)   


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1999-09-02  8:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-08-31 15:47 formatting HTML tables in ascii James A. Robinson
1999-09-01  8:07 Nigel Roles

sam-fans - fans of the sam editor

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/sam-fans

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 sam-fans sam-fans/ http://inbox.vuxu.org/sam-fans \
		sam-fans@hawkwind.utcs.toronto.edu
	public-inbox-index sam-fans

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.sam-fans


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git