I am trying to work on a simple workflow to sort out my publications csv to a list in my jekyll-based website.
This is my references.csv extracted from referencing software Mendeley and converted from bib to csv using online converter. I want to place this in my _data folder and make a list of publications in the page on jekyll website hosted on github. The sampe data is shown below:
"Item type","Authors","Title","Journal","Publication year","Volume","Issue","Pages","Publisher","Date published","ISSN","URLs","DOI","PMID","Abstract","Keywords"
"Book","Wilden H","PCI design handbook: Precast and prestressed concrete","","2017","","","","Precast/Prestressed Concrete Institute Wakefield, MA, USA","2017","","","","","",""
"Journal Article","Nanni A,Di Ludovico M,Parretti R","Shear strengthening of a PC bridge girder with NSM CFRP rectangular bars","Advances in Structural Engineering","2004","7","4","297-309","SAGE PublicationsSage UK: London, England","2004-11","1369-4332","https://journals.sagepub.com/doi/10.1260/1369433041653570;http://dx.doi.org/10.1260/1369433041653570","10.1260/1369433041653570","","trimmed down abstract","keyword 1"
"Journal Article","Di B,Wang J,Li H,Zheng J,Zheng Y,Song G","Investigation of Bonding Behavior of FRP and Steel Bars in Self-Compacting Concrete Structures Using Acoustic Emission Method","Sensors 2019, Vol. 19, Page 159","2019","19","1","159","Multidisciplinary Digital Publishing Institute","2019-01","1424-8220","http://dx.doi.org/10.3390/S19010159;https://www.ncbi.nlm.nih.gov/pubmed/30621189","10.3390/S19010159","30621189","To extend ","FRP,acoustic emission,bonding,compacting concrete,out test,pull,self"
"Journal Article","Crivelli D,Bland S","Structural health monitoring via acoustic emission","Reinforced Plastics","2016","60","6","390-392","Elsevier Ltd","2016-11","0034-3617","http://dx.doi.org/10.1016/j.repl.2015.05.004","10.1016/j.repl.2015.05.004","","Reinforced Plastics spoke to Dr Davide Crivelli from the Politecnico di Milano about new methods for detecting damage in composites.",""
"Journal Article","Tonelli D,Luchetta M,Rossi F,Migliorino P,Zonta D","Structural health monitoring based on acoustic emissions: Validation on a prestressed concrete bridge tested to failure","Sensors (Switzerland)","2020","20","24","1-20","Multidisciplinary Digital Publishing Institute","2020-12","1424-8220","http://dx.doi.org/10.3390/s20247272;https://www.ncbi.nlm.nih.gov/pubmed/33352961","10.3390/s20247272","33352961","very small abstract","AE"
Now, I want to make the list from these data as a citation data without getting into complexities of _includes. I want to keep it simple in a separate "Publications" page.
For example, I used the following code
{% assign cards = site.data.references | sort: 'Publication_year' | 'reverse' %}
{% for card in cards %}
<ul>
<li>{{ card.Publication year }} {{ card.Title }} {{ card.Publication }} </li>
<ul> {{ card.Authors }} {{ card.Authors }} </ul>
</ul>
{% endfor %}
In the code, when I use the heading in csv as "Year" and then sort using sort: 'Year' | 'reverse' %,it works. Maybe, there is a different way to write it for "two-worded" headings, as I think the card.Publication year won't work. i have spent a lot of time on this and I think I need to just use the code once and then just work with the csv file only.
The output I intend to only pick up the Journal Article from the Item type and prepare a list with the following information with items shown in the following:
[Publication year][title][Journal]
[Authors]
Also, I tried italisizing the text in one of the items, it should work like {{ __card.Publication year__ }} but it does not. I also read somewhere that the csv encoding doesn't allow to extract the first column due to some BOM or UTF-8 something encoding. But I want to filter using the item type.
ps I have tried to compromise with another simplified code with headings same as this, but the google scholar exported csv has ; as delimiters and while using card.Authors does not work to call the data.
I apologize I am not at all familiar with this and I am struggling with using this syntax. However, I foresee that if the code works, it will make my life easier. I would really appreciate your help. I apologize for any lack of proper jargon while explaining the problem.
Thank you in advance.
I tried to display the data from csv data file on the website but some values are missing. I cannot figure out the solution
You're on the right track but you are incorrectly referencing the CSV file column. Since "Publication year" is a two-worded heading, you need to reference it using underscores instead of spaces.
Try changing this line:
{% assign cards = site.data.references | sort: 'Publication_year' | 'reverse' %}
You can use sort_by instead of sort and provide 'Publication_year' as an argument.
{% assign cards = site.data.references | sort_by: 'Publication_year' | reverse %}
When you reference the column in the for loop, you should also use underscores:
<li>{{ card.Publication_year }} {{ card.Title }} {{ card.Journal }} </li>
I am struggling to include values into my alerting template
(Using Grafana 9.03 with classic condition alerting)
Query
Alert Evaluation
I tried to use {{ $values.B0 }} which works but only displaying the value. I want to use the Tag "Limit" for example "ImportStatNSC4903"
I did some more tries with:
{{ $values.B0.Limit }}
{{ $values.B0.labels }}
{{ $labels }}
Any ideas what I am doing wrong?
I am struggling to include values into my alerting template. I want a summery that tells me clearly why this alert was triggered
For example:
Limit ImportStatNSC4903 is outside the defined Boundaries
For example I know of
{{block class="Magento\Cms\Block\Block" block_id="block_identifier"}}
But where can I find documentation on all available features of this template language?
What other arguments can I use for {{ block }} etc.
The official Magento 2 documentation doesn't specify this. But, I think you can typically access all public fields of the base block class. If you are on a dev environment, their might be an error output even, if you use a wrong attribute. That error output probably shows, which attributes you are allowed to use.
The class responsible for parsing the {{ }} directives in
CMS Blocks and Pages is \Magento\Cms\Model\Template\Filter
which extends \Magento\Email\Model\Template\Filter.
In the latter the following directives are implemented:
block
layout
view
media
store
trans
var
protocol
config
customvar
css
inlinecss
widget
The last one is provided by the Widget module.
You can find some more info in this section the official Magento docs
I want to add classes to existing classes with twig, when invoking the form_widget()-function, so I'd like to merge them. But when I use
{{ form_widget(form.field1), {'attr': {'class': 'foo'}} }}
on an object that already has some classes attached to it by the controller, it doesn't add the class(es), but replaces them. According to the documantation this would
render a widget, but add a "foo" class to it
But the formulation isn't clear about, if the classes are really "added" or if they are replaced.
It seems that I would need to have a way to access the existing attributes/classes and merge them together with the ones I want to add. How can I accomplish this?
You might use form.field1.vars.attr.class and something like str1 ~ str2 to merge the already given classes and your new ones.
Putting it all together you get:
{{ form_widget(form.field1), {'attr': {'class': form.field1.vars.attr.class ~ foo'}} }}
this works and solves your problem. Some background:
According to the symfony documentation form.field1.vars.attr is a key based array, with a class-key.
So you can access all existing classes in this way.
How can I explicitly print CSRF field instead of using {{ form_rest(form) }}?
I need this because I'm going to hide/show some fields based on conditions, however {{ form_rest(form) }} is going to print all of the remaining fields (which is what I'd like to avoid).
It can be done this way:
{{ form_widget(form._token) }}
Also you might want to consider adding fields conditionally in your form type instead of making that kind of decisions in a template.