so i am trying to fetch news from an API, everything is working fine so far, except that i got some issues with the format.
From the API the News are in JSON format, i already got them visible on the page and it looks alright, except for <ul> and <li> items
When using a list, the dots will be over the text, since its closing the tags right after. I have been googling for a while and i haven't found a proper solution, using list-style didn't help.
Here is the preg_replace i use for the list items:
/*[list]*/
$tmpText = preg_replace('#\[list\](.*)\[/list\]#isU', '<ul>$1</ul>', $tmpText);
/*[*]*/
$tmpText = preg_replace('#\[[*]](.*)#isU', '<li>$1</li>', $tmpText);
And this is the output on the page i get with this:
<ul>
<li></li> Halloween content implementation
<li></li> Barber implementation and polishing
<li></li> Additional work on modular vehicles
<li></li> Finishing touches on the ATM interface
<li></li> Implementation of halloween gestures
<li></li> Final preparations for permadeath testing
<li></li> Creation and implementation of new admin commands
<li></li> Additional work on the farming system
<li></li> Bugfixing
</ul>
I am not really sure how to fix this, or how i would get the text between the tags, since its input is always different, i would appreciate some tips
Never mind I just solved my own issue, I had a huge brain fart here.
This is the solution I thought about
/*[list]*/
$tmpText = preg_replace('#\[list\](.*)\[/list\]#isU', '<ul>$1</li></ul>', $tmpText);
/*[*]*/
$tmpText = preg_replace('#\[[*]](.*)#isU', '<li>$1', $tmpText);
Related
So I am just learning to HTML , as I wanted to become a web developer.
I used the <pre> tag for the proper alignment in my code.
But the alignment seems to come little fuzzy.
But the output of 3 and 4 i.e Reason to live and Happiness are not properly align with respect to the above quotes.
<p>For me you are:</p>
<pre>
1.Love
2.Life
3.Reason to Live
4.Happiness
</pre>
I've tested your code and it seems to line up fine, you could always put the content in a list like the below:
<ol>
<li>Love</li>
<li>Life</li>
<li>Reason to Live</li>
<li>Happiness</li>
</ol>
If this isn't what you need, please could you show us how it appears for you?
I have tested your code, it works fine
You can share how it appears in your machine.
I'm trying to write a Regex that searches the source code of a series of webpages in a CSV file. I'm using the following to do the match:
$linkContent = $web.DownloadString($linkToBeConverted)
$object = [regex]::Matches($linkContent, $regex)
I'm trying to search in a list with class="menu" to see if it has links somewhere in it. Unfortunately, I seem to be matching way more than I need. I want a way to stop the match when I hit a certain string. Specifically div class="test" as per the example below.
This is my regular expression now:
(?sm)<ul class="menu">.*?(<a href="h).*?(<\/ul>)
The following is the source code I'm trying to search in. This SHOULD NOT be a match if my regular expression was correct. However, because there is a link somewhere between and the second list (which is not defined as class="menu") I get a match. Is there any way I can write this regular expression so that it stops when div class="test" is found? As a result of the template, div class="test" should always be in the code right after the menu list.
<ul class="menu">
<li>
<p>Yes there are paragraph tags and random stuff in these lists...</p>
</li>
<li>
<div><span>Example</span>
</div>It's pretty random
</li>
<li>Nothing here!</li>
</ul>
<div class="test">
<p><a href="http://match.html"></p>
<ul>
<li>Unfortunately this will cause a match since there's another list</li>
</ul>
Thank you so so much for your help in advance! I've been working on this all morning and I'm completely lost. If there's a way to do this in PowerShell I'm open to that as well.
The OneNote API is not returning supported tags in some lists.
It seems to be an issue with complex bulleted lists; we just see OutlineGroupNode is not supported in the returned markup.
The docs give some guidelines on how to write out tags to lists, but there's no mention of the API not returning any supported tags in certain situations.
Please see the below example, what rules is this list breaking?
What constitutes an OutlineGroupNode?
Some clarity over what pre-existing list/tag content is supported would be appreciated please.
Thanks
The resulting markup is:
<snip>
<!-- OutlineGroupNode is not supported --><br>
<ul>
<li>
<p lang="en-GB" style="margin-top:0pt;margin-bottom:0pt">
Top level no tag</p>
<ul>
<li style="list-style-type:circle"><span lang="en-GB"
data-tag="to-do">Sub level with tag</span></li>
<li style="list-style-type:circle"><span lang="en-GB">Sub
level no tag</span></li>
</ul>
</li>
<li style="list-style: none"><br></li>
</ul>
</snip>
4 days later it now works; no code changes on my part.
The complex list is returned correctly. No HTML comment in the markup mentioning OutlineGroupNode.
I can only assume that something has changed under the API hood.
i am trying writing some useful snippets for me,i had already written some basics one in my element.sublime-snippet,but i found in emmet-sublime they have some snippet which multiply the elements.
eg : ul>li*3
Result:
<ul>
<li></li>
<li></li>
<li></li>
</ul>
how can i apply logics in my simple snippet xml code.
I've been watching some 'codecasts' on CSSDeck.com, and I frequently see people typing things like this: ul>li*7>a to create a large amount of HTML very quickly. That code would generate this:
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
As seen on: http://cssdeck.com/labs/creating-sweet-3d-pagination
What plugin is this?
It used to be called Zen Coding, but is now called Emmet.
There are plugins for most editors, including Sublime Text 2 (which I'd recommend if you aren't already sorted for one!)
For Sublime Text if you are using Package Control, it's a simple package install emmet away.