Jump to content
Server Maintenance This Week. ×

Wrapping opening and closing html tags around a list using regex


This topic is 4096 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi,

 

New customer of 360Works, first posting. (Sorry if it is in the wrong forum).

 

I think I have a fairly simple regex problem which, for some reason, is just not clicking with me. I have every conceivable regex-plugin, resource, buddy, magic, you can think of. And my brain is refusing to continue the thought process no matter how hard I try to encourage it.  I even have code samples of other regex flavors that supposedly work but when I plug them into 360Works Scribe it stops working.

 

I need to take a text file (typically Word format but could come in an email) that clients give me and I need to convert to HTML as part of online courses I produce. Got everything working, everything except one last item: the opening and closing </ul> or <ol> tag(s) is where I choke.

 

Here's a sample:

 

Take a list of items:

 

· Forest

· Trees

· Cannot

· See

 

 And convert it to html coding:

 

<ul>

<li>Forest</li>

<li>Trees</li>

<li>Cannot</li>

<li>See</li>

</ul>

 

Sometimes there are nested <ul> or <ol> lists.  If it makes a difference, I paste the Word or text file into FMP, convert it to HTML, then strip out all the tags except the CSS and special function HTML tags I need for formatting. And, in theory, when all is done I hit a button and the newly generated eLearning CSS/HTML course page is transferred to Moodle servers and becomes part of an online course. Reducing what used to be hand coded 15 minutes to just seconds and almost zero errors.  Except the list issue is throwing a wrench into everything. . At this point I've scraped all of my regex attempts and am open to any and all help.  Thanks!

Link to comment
Share on other sites

Are you hand pasting this into FileMaker?? Is this code sample part of something bigger or do you just want to solve your 'problem' for this bit of text??

 

What 360works products are you using here??

Link to comment
Share on other sites

  • 2 weeks later...

I'm using FMP 11, Scribe (paid version), and have ScriptMaster 4 (currently the free version).  Text is either imported into FMP 11, entered by hand if someone is typing directly into a field, or copied and pasted if the content arrives in an email.

 

I would like to solve this permanently so that I can auto generate ordered and unordered lists, by themselves or nested within other lists to generate something that looks like below. If I leave the list "open" it will cause problems if I have nested lists.  So the real problem is how do I close any list that is open, beginning with the first nested sublist?

 

Example:

  1. An item here
  2. Another item here but nested items below
  • nested item
  • another nested item
  1. Another item**

 

(** As a side note:  the HTML editor this forum is using doesn't continue the main bullet numbering -- should be "3" -- after a sub bullet list, nor does it properly indent sub lists)

Link to comment
Share on other sites

Ryan 
 
here is one (zipped FMP12) approach to show the principle, by splitting up the outer values and their inner related values (if any) then combining them into a string with a known concatenator to then use a bit of groovy magic to split the lines and spit out the tagged text....
 
In the example you can add (or delete) outer records, and add (or delete) child (inner) records. There are two global fields which determine if you wish UL or OL for both sets of lists and then press the magic button and out pops the pre-formulated block....
Not doing anything fancy with sort order other than ID (creation) ordering....
Needs ScriptMaster (latest) to run.....
 
Let me know if you find this a helpful pointer...

 

 

 

 
 

TagTest.fmp12.zip

Link to comment
Share on other sites

This topic is 4096 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.