Special charecter ` in thymeleaf link - hyperlink

I am testing the special character in the link by downloading a file called !##$%^&()_+=-{}[]'`~.doc. And I found that my page can show ` in th:text, but ` in th:href is autometically converted into %60.
<ul class="list-group list-group-item-action" th:each="file: ${filesList}">
<a th:href="${'http://localhost:8080/files?fileName=' + file}">
<li class="list-group-item list-group-item-action" th:text="${file}"></li>
</a>
</ul>
Expected:
http://localhost:8080/files?fileName=!##$%^&()_+=-{}[]'`~.doc
Actual:
http://localhost:8080/files?fileName=!##$%^&()_+=-{}[]'%60~.doc
And the weird thing is when I try to test the existence of `, I got following result.
${#strings.contains(file,'`')} Result: True
${#strings.contains(file,'%60')} Result: False
How should I get the correct link to download the file?

Related

Extract all <li> with the class="myTag" but without <small>

I am struggling with the ImportXML function from Google Spreadsheet. A specific webpage has this content:
<li class="myTag">
<a href="/xyz/abc/">
Jouets
<small class="hidden">
<span>235 6453 sous-section</span>
<span>1231 765 produits</span>
<span>12155 654 images</span>
</small>
</a>
</li>
<li class="myTag">
<a href="/xyz/def/">
Livres
<small class="hidden">
<span>235 6453 sous-section</span>
<span>1231 765 produits</span>
<span>12155 654 images</span>
</small>
</a>
</li>
I want to extract all li tags with the class="myTag" but without the <small> section, in order to have this list:
Jouets
Livres
I have written this XPath expression:
=IMPORTXML(B1; '//li[#class='myTag'].ReplaceAll("<[^>]*>", "", "")')
But I have the #N/A error.
How can I extract just the first elements (Jouets, Livres) without the <small> section?
Originality of this question
Scraping data to Google Sheets from a website that uses JavaScript is about dynamic web pages which is not my case. My page is already generated in HTML content - I can already extract the full content within the <li> tag with the parameter '//li[#class='myTag']'.
My point is to exclude the <small> content which is glued.
I am looking to get this list:
Jouets
Livres
and not this one:
Jouets235 6453 sous-section1231 765 produits12155 654 images
Livres235 6453 sous-section1231 765 produits12155 654 images
From your following reply,
Currently, with this formula I have this result (just pasting the first lines): - Arts1 069 sous-thèmes15 778 articles11 949 médias ; - Astronomie et astrophysique107 sous-thèmes570 articles696 médias ; - Chimie147 sous-thèmes1 042 articles1 087 médias But I am attempting to get only: - Arts ; - Astronomie et astrophysique ; - Chimie
How about the following XPath?
Modified XPath:
//li[#class='with-counter']/a/text()
Modified formula:
=IMPORTXML("https://www.universalis.fr/classification/"; "//li[#class='with-counter']/a/text()")
Testing:

Error: link is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`

I keep getting this error mess while doing this tutorial I think I'm putting the code in right?
I'm using vs as my editor.
import React from 'react';
import { NavLink, Link } from 'react-router-dom';
const Topbar = () => {
return(
<nav className='navbar navbar-light'>
<div className='container'>
<link to='/' className='navbar-brand'>
Medium
</link>
<ul className='nav navbar-nav pull-xs-right'>
<li>
<NavLink to='/' className='nav-link'>
Home
</NavLink>
</li>
<li>
<NavLink to='/login' className='nav-link'>
Sign in
</NavLink>
</li>
<li>
<NavLink to='/register' className='nav-link'>
Sign up
</NavLink></li>
</ul>
</div>
</nav>
)
}
export default Topbar;
i cant understand why i keep catching this error mess
Error: link is a void element tag and must neither have children nor use dangerouslySetInnerHTML.
You are using link-tag instead of Link. Fix this and error should disappear.
Use capitalized Link instead of link
import Link from 'next/link'
<Link href="/"><a>Medium</a></Link>
**Use Capitalized Link Tag **
HOME

Conditionally add hide-xs attribute

In an ng-repeat I want to add a hide-xs attribute on an element based on the current scope.
How can I do that?
I basically want to do something like (this obviously don't work):
<li ng-repeat="item in items" hide-xs="{{ item.showAlways ? 'false' : 'true' }}">
{{item.title}}
</li>
Edit
I ended up doing this (as suggested by DieuNQ) but if anybody know how to do it using directive and not class I would take it
<li ng-repeat="item in items" ng-class="{'hide-xs': !item.showAlways }}">
{{item.title}}
</li>
hide-xs not works like that (it does not depend on true or false). It just add class to your tag. Try this:
In your html:
<li ng-repeat="item in items" ng-model="item.showAlways" ng-class="someClass">
...
</li>
In your controller:
$scope.item.showAlways ? $scope.someClass == '' : $scope.someClass == 'hide-xs';

Change previous-text and next-text from Pager (Angular & UI-Bootstrap)

I want to change the button texts from Pager UI-Bootstrap in Angular.
I've this array:
categories = ["Standard", "Premium"];
But this code show the variable's name and with moustache doesn't work.
<uib-pager total-items="categories.length" items-per-page=1 ng-model="page" previous-text=categories[page-2] next-text=categories[page] ></uib-pager>
This works but I would prefer use uib-pager:
<ul class="pager">
<li class="previous" ng-class="{'disabled':!categories[pag-2]}" ng-click="pag=pag-1">{{categories[pag-2]}}</li>
<li class="next" ng-class="{'disabled':!categories[pag]}" ng-click="pag=pag+1">{{categories[pag]}}</li>
</ul>

MODX Articles: Can't retrieve article image with getResources

I am running MODX Revo 2.3.2 with Articles and getResources. On my start page, I wan't to show the 4 most recent articles by calling getResources. However, it does not show the image. Tried to output it without phpThumbof, but it does not work out at all.
[[getResources?
&parents=`11`
&tpl=`articleRowTpl`
&includeTVs=`1`
&processTVs=`1`
&showHidden=`1`
&limit=`4`
]]
My articleRowTpl looks like this:
<article class="blog-item blog-full-width">
<div class="blog-thumbnail">
<img alt="" src="[[+tv.articleImage:phpthumbof=`w=750&h=200&zc=1`]]">
</div>
<div class="blog-full-width-date">
<p class="day">[[+publishedon:strtotime:date=`%d`]]</p><p class="monthyear">[[+publishedon:strtotime:date=`%b %Y`]]</p>
</div>
<div class="blog-content">
<h4 class="blog-title">[[+pagetitle]]</h4>
<p>[[+introtext:default=`[[+content:ellipsis=`400`]]`]]</p>
Mehr lesen...
</div>
</article>
There are no errors, it just does not output the image path. I double checked the placeholder and the prefix, which defaults to tv. as the documentation says.
Alright, found it. I just removed the TV-Prefix of getResources with
tvPrefix=``
and now I can access the TV with [[+articleImage]].

Resources