Hi all,
I have a question which I have no ideal of the answer...I am currently
working on a web application and at some time, I have a string
representing a short text. This could be a simple example :
"This is my list :\n\r-list item 1\n\r-list item 2\n\r-list item
3\n\r\n\rThis was a great list."
Let's say this outputs like that :
-------------------------------------------
This is my list :
-list item 1
-list item 2
-list item 3
This was a great list.
-------------------------------------------
Would it be simple with regular expression to transform the list formed
of hyphens("-") to an HTML unordered list? I mean that the preceding
example would rather output as :
-------------------------------------------
This is my list :
<ul><li>list item 1</li>
<li>list item 2</li>
<li>list item 3</li></ul>
This was a great list.
-------------------------------------------
I have some experience with regular expression but have not a clue on
how to do this...I also see some problems as if the string starts with
an hyphen, as it would also need to transform correctly, event if it
doesn't have the /n/r before the hyphen("-").
e.g. "-list item 1/n/r- list item 2" should output as :
-------------------------------------------
<ul><li>list item 1</li>
<li>list item 2</li><ul>
-------------------------------------------
And what about if there are two lists separated by some carriage
returns?...As you can see, I really don't know where to start with this
problem. :/
Thanks in advance,
ibiza 5 2187
Do you have a finite list of ways that this information could be formatted?
For instance, do you allow spaces before and after the dash (-) or maybe
returns between each list item? In other words, is the information that you
receive predictable?
If it is predictable, I would just go through the list one line at a time
and output it into a new string with the appropriate markup.
"ibiza" <la******@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com... Hi all,
I have a question which I have no ideal of the answer...I am currently working on a web application and at some time, I have a string representing a short text. This could be a simple example :
"This is my list :\n\r-list item 1\n\r-list item 2\n\r-list item 3\n\r\n\rThis was a great list."
Let's say this outputs like that : ------------------------------------------- This is my list : -list item 1 -list item 2 -list item 3
This was a great list. -------------------------------------------
Would it be simple with regular expression to transform the list formed of hyphens("-") to an HTML unordered list? I mean that the preceding example would rather output as : ------------------------------------------- This is my list : <ul><li>list item 1</li> <li>list item 2</li> <li>list item 3</li></ul>
This was a great list. -------------------------------------------
I have some experience with regular expression but have not a clue on how to do this...I also see some problems as if the string starts with an hyphen, as it would also need to transform correctly, event if it doesn't have the /n/r before the hyphen("-"). e.g. "-list item 1/n/r- list item 2" should output as : ------------------------------------------- <ul><li>list item 1</li> <li>list item 2</li><ul> -------------------------------------------
And what about if there are two lists separated by some carriage returns?...As you can see, I really don't know where to start with this problem. :/
Thanks in advance,
ibiza
well, if I give this possibility to the users, I'd appreciate they
respect some format :)
e.g. always a carriage return then a "-". As soon as this is
encountered, this means a list to the application. If he decides to add
spaces after the "-", I guess they should be rendered maybe? And if he
decides to input two carriage returns in a row, this would mean the end
of the list and a new paragraph.
As for going line per line, the problem for me is the beginning and the
end of the list. I mean, how can I find where it does begin and
end?...could you give me some help with this?
thanks a lot for your reply!
ibiza,
If it's formatting user data entered into a text box. Check out freetextbox: http://www.freetextbox.com
It's a WYSIWIG editor that would let your users create the list themselves
without having to know html markup. You can enable and disable any buttons
in the editor you'd like.
--
Sincerely,
S. Justin Gengo, MCP
Web Developer / Programmer www.aboutfortunate.com
"Out of chaos comes order."
Nietzsche
"ibiza" <la******@gmail.com> wrote in message
news:11*********************@g14g2000cwa.googlegro ups.com... well, if I give this possibility to the users, I'd appreciate they respect some format :) e.g. always a carriage return then a "-". As soon as this is encountered, this means a list to the application. If he decides to add spaces after the "-", I guess they should be rendered maybe? And if he decides to input two carriage returns in a row, this would mean the end of the list and a new paragraph.
As for going line per line, the problem for me is the beginning and the end of the list. I mean, how can I find where it does begin and end?...could you give me some help with this?
thanks a lot for your reply!
thanks for the tip :)
but unfortunately, there is a licensing cost (it's for my work so I
guess they ought to buy it if I'd use it) and it's too much for what I
need...regex should be well enough for my problem, but I have
difficulties with the correct one to use :\
Ibiza,
No, you don't have to pay a dime unless you need to use the "Pro" features
or want the source code.
A quote from the licensing section of the creator's site:
Free License (free!)
You may download FreeTextBox 3.0 and include it in all your projects
including those you host and those you redistrubute. Pro features of
FreeTextBox 3.0 will be disabled.
--
Sincerely,
S. Justin Gengo, MCP
Web Developer / Programmer www.aboutfortunate.com
"Out of chaos comes order."
Nietzsche
"ibiza" <la******@gmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com... thanks for the tip :)
but unfortunately, there is a licensing cost (it's for my work so I guess they ought to buy it if I'd use it) and it's too much for what I need...regex should be well enough for my problem, but I have difficulties with the correct one to use :\ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Peter Collinson |
last post by:
Hi...
Is there any way to style a List Item a different color and size than
the <LI> in an Ordered List?
I'd like a red super-script number and a dark blue text in a page's
footnotes. And...
|
by: David Ross |
last post by:
I sometimes place a sidebar on a Web page, using the following:
..sideright { float: right;
background-color: #fff;
width: 40%;
font-size: 90%;
text-align: justify;
margin-left: 1em;...
|
by: Jim Cobban |
last post by:
I cannot get Netscape 4.79 to properly display the ordered list in the
following fragment.
<P>Get a specific portion of the date.
Depending upon the value of index:
<ol start=0>
<li>complete...
|
by: markarichman |
last post by:
Why is Firefox complaining with this error:
------------------------------------------------------------
missing ) after argument list
setTimeout('breakOut',5000);...
|
by: -D- |
last post by:
I'm trying to write my xsl to display an unordered list fromt the xml file
where location is equal to top:
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode...
|
by: simplico |
last post by:
I'm creating an unordered list that fits in a defined width on the left
side of the page. It works fine in FF but IE is another story.
Here is a watered-down version of the code:
<html>...
|
by: User |
last post by:
Hi,
Is it possible to transform Ordered/Unordered list into navigation dropdown
menus?
Is this effect achieved by CSS? or via Javascript?
PLease advise
Thanks.
|
by: KevinADC |
last post by:
If you are entirely unfamiliar with using Perl to sort data, read the "Sorting Data with Perl - Part One and Two" articles before reading this article. Beginning Perl coders may find this article...
|
by: shapper |
last post by:
Hello,
I am creating 3 "elements" to display on a web site: a menu, a form
and a pager to a table.
In three cases I am using a list where each list item serves as a
container of:
- the menu...
|
by: Naresh1 |
last post by:
What is WebLogic Admin Training?
WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
|
by: antdb |
last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine
In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
|
by: Oralloy |
last post by:
Hello Folks,
I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA.
My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
|
by: Carina712 |
last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
|
by: BLUEPANDA |
last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
|
by: Ricardo de Mila |
last post by:
Dear people, good afternoon...
I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control.
Than I need to discover what...
|
by: Johno34 |
last post by:
I have this click event on my form. It speaks to a Datasheet Subform
Private Sub Command260_Click()
Dim r As DAO.Recordset
Set r = Form_frmABCD.Form.RecordsetClone
r.MoveFirst
Do
If...
|
by: ezappsrUS |
last post by:
Hi,
I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
|
by: jack2019x |
last post by:
hello, Is there code or static lib for hook swapchain present?
I wanna hook dxgi swapchain present for dx11 and dx9.
| |