asciidoctor: how to reference attribute from link macro - asciidoctor

How can I reference a custom attribute when using the link macro?
I have "my_attribute" set to (eg) "http://example.com"
This does not work - produces <a href="{my_attribute}"...
link:{my_attribute}[Example Link,window="_blank"].
This does not work - {my_attribute} is expanded but the entire link macro is not expanded:
[subs="attributes,macros"]
----
link:{my_attribute}[Example Link,window="_blank"].
----
Is there a way to do this?

Strangely, reversing the order of subs fixed this!
[subs="macros,attributes"]
----
link:{my_attribute}[Example Link,window="_blank"].
----
well, there you go

Related

How to pass cypress environment variable from cucumber feature file?

I want to pass cypress environment variables from cucumber feature file. But while running scripts in cypress runner getting 404 NOT FOUND error.
Any Ideas please?
Versions used:
"cypress": "^9.5.4",
"cypress-cucumber-preprocessor": "^4.3.1"
Below, I show you how to use any variable within a feature file. You only have to replace the variable in the example (which is assetName) by your environment variable.
Feature: Business critical scenarios
Verify the proper operation of most critial scearnios
Scenario Outline: Add a asset successfully
Given I go to the Add Asset tab
When Validate page title and url
And I type the valid name <assetName> in the asset input box
Then I press send button
And Validate the asset <assetName> is added successfully
Examples:
| assetName |
| "ABCD0000000026" |
Notes:
In my example the variable within the section Examples and below the field assetName, it's in quotes because the expected variable in my test file and linked with those steps, it's a string. If you are using int you must skip the quotes.
If you add more values below ABCD0000000026, your test will run as many times as values you add, like a loop

Checking status/event of icon - Selenium, Python 3.9

With covid and online schooling, it's hard to keep up with my kid keeping up! I'm only a little familiar with Python and less familiar with webstuff and selenium, but I wanted to try to make it easier to check on whether he's finishing his assignments each day by writing a script that (1) goes to the class webpages, (2) looks for the 'Overdue' text in the outer HTML, and (3) does something (e.g., print 'There is an overdue assignment') if the find method succeeds.
I've completed 1 successfully and know how to do part 3, but can't figure out part 2.
I found what I think is the relevant part on the pages with the inspect element:
<i class="icon-minimize" aria-label="This assignment is overdue" title="This assignment is overdue"></i>
And I've tried the following code variations:
overDue = driver.find_element_by_tag_name("This assignment is overdue")
overDue = driver.find_element_by_name("This assignment is overdue")
And I've tried to copy the CSS Selector and use
overDue = driver.find_element_by_class_name("i.icon-minimize:nth-child(1)")
I also tried XPath, but I forget now exactly what my code was. Something like:
overDue = driver.find_element_by_xpath(//*[., text()="This assignment is overdue"])
But all of these return a NoSuchElement exception. Is there something wrong with my syntax or am I using the wrong methods?
Thanks.
overDue = driver.find_element_by_xpath('//*[#title="This assignment is overdue"]')
its title , use #title to validate the value of title attribute
xpath syntax is
//tagname[#attribute="attributevalue"]
so tag_name is i
driver.find_element_by_tag_name("i")
there is no name attribute so you cannot use
driver.find_element_by_name
class is 'icon-minimize' you should not mention tag there:
driver.find_element_by_class_name("icon-minimize")

How to create theos custom variables?

I would like to create custom variable for theos. In example ##DATECREATED## to print current date for my tweak deceptions (I'm soooo bored to edit it manually :D)
Like ##FULLPROJECTNAME## prints out tweak name in control and Makefile...
Edit: I did it with adding this to my nic.pl:
use DateTime;
$NIC->variable("DATECREATED") = DateTime->now->strftime('%d/%m/%Y');
Is it possible to do it without editing original nic.pl?
Thanks for suggestions!
I have found a solution for it!
I had to put this code inside control.pl in my theos template:
use DateTime;
NIC->variable("DATECREATED") = DateTime->now->strftime('%d/%m/%Y');

Writing an impex to change the HMC Login attribute to enabled for all employees

I have the current problem that many of my employees in Hybris have the HMC login attribute set to inherit from group, which means that they can't log in to the HMC. This was due to that I used an impex script that set new users to this a while ago. I try now to write an impex script that updates all employees to have HMC access instead. I found the <ignore> tag to be interesting on the Wiki which states that "There is a special value that makes the ImpEx skip the entry and leave the item value at the one it currently is." (https://wiki.hybris.com/display/release4/ImpEx+Syntax). So when I am trying to use the following script:
UPDATE Employee;UID[unique=true];password;description;name;groups(uid);sessionLanguage(isocode);sessionCurrency(isocode);hmcLoginDisabled[default=false]
;<ignore>;<ignore>;<ignore>;<ignore>;<ignore>;<ignore>;<ignore>
I think it should ignore all current values and set hmcLoginDisabled to false. But HAC gives me the following output:
UPDATE Employee;UID[unique=true];password;description;name;groups(uid);sessionLanguage(isocode);sessionCurrency(isocode);hmcLoginDisabled[default=false]
,,no existing item found for update;<ignore>;<ignore>;<ignore>;<ignore>;<ignore>;<ignore>;<ignore>
27.03.2014 15:26:38: ERROR: line 3 at main script: Can not resolve any more lines ... Aborting further passes (at pass 2). Finally could not import 1 lines!
27.03.2014 15:26:38: ERROR: line 3 at main script: Can not resolve any more lines ... Aborting further passes (at pass 2). Finally could not import 1 lines!
Anyone that has any idea on how to write an impex script to solve this?
Just considered Nevins post and came up with this final solution that actually worked:
UPDATE Employee[batchmode=true];itemtype(code)[unique=true];hmcLoginDisabled[default=false]
;Employee
You can just leave the fields blank if you don't want to update the value.

modx ditto filtering

I have this line of code:
[[Ditto? &depth=3 &tpl=#FILEweb_assets/chunks/x/x.html &parents=3 &filter=template,7|endDate,[+now+],3]]
The above line displays all items which using template 7. Now I want to make a change so that it will display all items with template 7 and 10. What should I do??
thanks
According to the documentation you can simply add another clause as follows
[[Ditto? &depth=3 &tpl=#FILEweb_assets/chunks/x/x.html &parents=3 &filter=template,7|template,10|endDate,[+now+],3]]
Ditto provides parameter &where, which accept a valid MySQL WHERE statement. I guess it should help.
&filter=endDate,[+now+],3
&where=`template!=7 AND template!=10`

Resources