From: BenT on 22 Mar 2010 03:40 I have a web page HTML coding problem which I'm trying to use Mathematica's file and string functions to solve for me. I've created a text file, in DOS of 695 file names which I've "imported" (via the "Lines" option) and need to manipulate each into HTML table data code like the following: For example, given a file name of "Aaron Robarts Wolfe.pdf", I then need to (while processing each filename such as with the For[] function, loaded already into a 695 element array, convert it to the following HTML code: <tr><td><a href="Portraits Aaron Robarts Wolfe.pdf">Wolfe, Aaron Robarts</td></tr> The output coding of the names however must be sorted as if they were in a Last, First Middle (if any) order which I'll cut/paste into the "master" HTML documents for the web page concerned. It would be very nice to include "letter" separators into the coding (as opposed to me having to cut/paste each letter category into the master docuement, The coding for each letter should be like this: <tr><th><a name="A"></a>A</th></tr> The "name" tags have already been defined in the master document. Any help would be greatly appreciated!
From: David Bailey on 28 Mar 2010 05:07 BenT wrote: > I have a web page HTML coding problem which I'm trying to use Mathematica's > file and string functions to solve for me. > > I've created a text file, in DOS of 695 file names which I've > "imported" (via the "Lines" option) and need to manipulate each into > HTML table data code like the following: > > For example, given a file name of "Aaron Robarts Wolfe.pdf", I then > need to (while processing each filename such as with the For[] > function, loaded already into a 695 element array, convert it to the > following HTML code: > > <tr><td><a href="Portraits Aaron Robarts Wolfe.pdf">Wolfe, Aaron > Robarts</td></tr> > > The output coding of the names however must be sorted as if they were > in a Last, First Middle (if any) order which I'll cut/paste into the > "master" HTML documents for the web page concerned. > > It would be very nice to include "letter" separators into the coding > (as opposed to me having to cut/paste each letter category into the > master docuement, The coding for each letter should be like this: > > <tr><th><a name="A"></a>A</th></tr> > > The "name" tags have already been defined in the master document. > > Any help would be greatly appreciated! > I think you need to be more specific as to what you need help with. I mean, given a file full of file names (BTW, I assume that you mean a text file, rather than a DOS file), it is easy to read that as strings with ReadList. It is also easy to use StringJoin (<>) to prepare lines of HTML, etc. So tell us exactly what it is that you can't do - preferably with some of your code, and someone will surely help. David Bailey http://www.dbaileyconsultancy.co.uk
|
Pages: 1 Prev: Managing packages in the workbench Next: number representation |