How can I use a keyword in git book in a string? - gitbook

Im documenting some code and it includes a | operator, but since the pipe charatcer is used for filters im getting this error
“Error:filter not found: quote”
The line itself is “ [somecode] | quote “
This code is being displayed in a table. I’ve tried tags <code> and ’’’but it’s not working. it still thinks i’m using an undefined filter, how can i fix this?

Related

Property assignment expected. This expression is not callable. Type {} has no call signatures. (how to solve this?)

I wanted to update a badge count in a chat room using cloud function trigger which is a nested map.
I'm updating badges in the frontend without any issue but I want the create a cloud function for this to reduce frontend workloads.
but when I tried to pass a dynamic variable as field/key, the compiler is not happy and it's giving me an error.
the expected output should be like this
Backtick doesn't work so I tried to change the backtick to double quote to be able to compile, but this was the output which is not what i want.
anyone knows how to make this work? please help.
its syntax issue, missing [ & ].
it should be { [`badgeCount.${receveid}`]: fire.....

How to write an Xpath expression containing an apostrophe in VBA Selenium

My question relates to coding selenium specifically in VBA.
I have a function that finds webelements based on text passed to it (in string variable 'toFind'). The relevent Xpath identification method I use is (where driver. is the selenium chromedriver):
mySearch = "//*[contains(text(),'" & toFind & "')]"
Set ret = driver.FindElementsByXPath(mySearch)
This works unless the toFind variable contains an apostrophe. For example if "Consultant's Forename" is passed then my expression evaluates to:
Set ret = driver.FindElementsByXPath("//*[contains(text(),'Consultant's Forename')]"), which causes an invalid selector run-time error.
I have researched elsewhere on the site and see a number of answers describing escaping from the single quotes using the backslash character. Based on this I have tried to use Set ret = driver.FindElementsByXPath("//*[contains(text(),\"Consultant's Forename\")]") instead. However, this will not compile in microsoft visual basic for applications as it reports a syntax error (code line is red). I have not tried using the driver.findElements(By.xpath method as opposed to driver.FindElementsByXPath as I assumed this would not make a difference to the handling of the XPath expression. I have tried the other suggestions of using the 'concat' function but this also seems not to be valid in VBA selenium.
I don't know if these methods are specficaly for platforms other than VBA or I am just getting my syntax wrong?
The only way I can work it at present is to ignore the existence of the apostrophe:
Set ret = driver.FindElementsByXPath("//*[contains(text(),'Consultant') and contains(text(),'s Forename')]")
Whilst this works it is an incomplete solution and any help on the correct syntax to deal with the xpath location in VBA for text containing an apostrophe would be much appreciated.

Template Literals no-useless-concat

I'm curious about the eslint warning "no-useless-concat".
From other stackoverflow questions I saw using template-literals is the preferred method of concatenating strings dynamically, in order to not get such eslint warnings.
I want to define a css-class based upon a condition (liked is a boolean):
const heartClass = `fa fa-heart${liked ? "" : "-o"}`;
While compiling (using React) I still get the following warning:
WARNING in src\components\Like.jsx
Line 6:55: Unexpected string concatenation of literals no-useless-concat
What am I doing wrong - Why do I still get the no-useless-concat warning?
Kind Regards
Andreas

Adding Metadata Attribute with white-space — Unix shell command

I'm trying to change a metadata attribute on a file, in a Node.js app, the problem is that I need to use white-space in the attribute value. I tried the following (used \ to add the white-space) but it did not work:
In the sample below, the Musical Genre should be Hip Hop.
exec('xattr -w com.apple.metadata:kMDItemMusicalGenre "Hip\ Hop" PATH-TO-FILE')
I also tried removing quotes (") or using template literals to wrap the script, but none of them worked. Would you please help me to find out how to sort this out? Thank you in advance.

ANTLR4: Use getText() in label of python

I'm currently having one issue with ANTLR4. I have previously worked with ANTLR4 and generated the classes in Java. I would then be able whenever I found a label to do: ctx.label.getText() to get the text in the label.
Now I'm trying to do the same thing in Python3, however, it is not working.
For example in this grammar when I try to access the value.
expression
: LPARENS expression RPARENS
| ...
| value=(INTEGER | FLOAT | BOOLEAN | STRING | HOLE)
;
When trying to access ctx.value.getText() it gives me the following error:
print(ctx.value.getText())
AttributeError: 'CommonToken' object has no attribute 'getText'
Since I'm pretty new in using antlr4 with python was wondering what workaround exists for this.
In case of tokens, value=TOKEN, it’s .text:
print(ctx.value.text)
In case of a parser rule, value=expression, then it is value.getText(), I believe.

Resources