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 2312
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.goo glegroups.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******** *************@g 14g2000cwa.goog legroups.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.goo glegroups.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 this be done using style sheets?
--
- Yours truly, Pete Collinson
|
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;
padding: 2% }
..sideleft { float: left;
background-color: #fff;
|
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 value, usually as a <code>String</code>, or if
an integral value as an <code>Integer</code>.
<li>year as an <code>Integer</code>
<li>month number as an <code>Integer</code>
|
by: markarichman |
last post by:
Why is Firefox complaining with this error:
------------------------------------------------------------
missing ) after argument list
setTimeout('breakOut',5000);
------------------------------------------------------------
Here is the HTML that I'm producing:
|
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 url="~/index.aspx" title="Home" location="top">
<siteMapNode url="~/about_us/index.aspx" title="About Us" location="top" >
<siteMapNode url="~/about_us/mediaroom.aspx" title="Media Room" />
<siteMapNode url="~/about_us/awards.aspx" title="Awards" />...
| |
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>
<head>
<title>Untitled</title>
<style type="text/css">
* {margin: 0px; padding: 0px; border: 0px; border: 1px solid
|
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 uses unfamiliar terms and syntax. Intermediate and advanced Perl coders should find this article useful. The object of the article is to inform the reader, it is not about how to code Perl or how to write good Perl code, but to teach the Schwartzian...
|
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 items, in the menu;
- of each form "field" (label + input), in the form;
- of each paging button, in the pager;
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |