set/parse html field

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

set/parse html field

Will
For each work subsection, the summary and bullets are stored in a single "html" field.

What's the best way to set the data there?

When the resume is constructed, I can set it to be:

<ul>
Summary
    <li>bullet1</li>
    <li>bullet2</li>
</ul>

I can assume the data will be clean.

I need a simple way to parse this string to get the "Summary" and "bullet1" and "bullet2".

And ideally, to give me an array of the bullets so that I can iterate through them?
Reply | Threaded
Open this post in threaded view
|

Re: set/parse html field

fschmidt
Administrator
If you put this HTML, you will see that it is rendered wrong with "Summary" indented.

To see the correct format, just go into the super-resume editor and edit a text area (like the summary) and enter this (in tinymce).  Then you can look at the generated HTML.  It will look like this:
<p>Summary</p>
<ul>
	<li>bullet1</li>
	<li>bullet2</li>
</ul>
If you want to add an attribute to make parsing easier, that's fine.  Something like:
<p for="ul">Summary</p>
<ul>
	<li>bullet1</li>
	<li>bullet2</li>
</ul>
When you are setting properly, let me know and I will give you sample parsing code.
Reply | Threaded
Open this post in threaded view
|

Re: set/parse html field

Will
Yes, I can follow whatever format is needed.

I think you can give me the parser now. I need it to get the summary and bullet from the "html" field to set the data at the client side...
Reply | Threaded
Open this post in threaded view
|

Re: set/parse html field

fschmidt
Administrator
You can run this locally.

ul.luan
Reply | Threaded
Open this post in threaded view
|

Re: set/parse html field

Will
I don't understand this part,

    type(obj)=="table"

What does this mean?
Reply | Threaded
Open this post in threaded view
|

Re: set/parse html field

Will
Also, I don't understand

   obj in iter

"ojb" isn't defined anywhere?
Reply | Threaded
Open this post in threaded view
|

Re: set/parse html field

Will
I understood type(obj)=="table" now.
Reply | Threaded
Open this post in threaded view
|

Re: set/parse html field

fschmidt
Administrator
In reply to this post by Will
Will wrote
I don't understand this part,

    type(obj)=="table"

What does this mean?
http://www.luan.ws/manual.html#Luan.type
Reply | Threaded
Open this post in threaded view
|

Re: set/parse html field

fschmidt
Administrator
In reply to this post by Will
Will wrote
Also, I don't understand

   obj in iter

"ojb" isn't defined anywhere?
http://www.luan.ws/manual.html#for
Reply | Threaded
Open this post in threaded view
|

Re: set/parse html field

Will
I tried to incorporate ul.luan into ai.js.luan, but is getting random errors, I think it's probably a  syntax thing of luan that I didn't get right?

Can you take a look?

Go to: http://test.airesumebuilder.com/ai.js?call=workSubList&r=3477531

Internel Server Error

Expected table element or '}' (line 211, pos 2) in site:/ai.js.luan
        local html = parse_html(text)
        ^
Reply | Threaded
Open this post in threaded view
|

Re: set/parse html field

fschmidt
Administrator
You are using javascript syntax in luan.  Luan doesn't use curly braces for blocks.