Trying to make annotated citation style, getting "Error generating citations and bibliography" - citations

I have a question on some csl code.
I am trying to convert the "nature" style which is available through Zotero to an annotated style which gets the annotation by citing the "Extra" field (similar to APA 7th edition annotated).
I am not familiar with coding in csl so I found out thanks to google that all I had to do is add the line
<text variable="note" display="block"/>
before </layout>
(found this info here: https://forums.zotero.org/discussion/19552/annotated-bibliography-in-mla-or-chicago-style)
I did so and now I am getting the following error when generating the style in Zotero's style editor:
Error generating citations and bibliography:
citeproc-js error: Level mismatch error: wanted bib_first but found bib_other
I already checked my code with the CSL style and locale editor (https://validator.citationstyles.org/) and it gives me no errors. Googling this error message does't give any good results. I am trying to use this style in Microsoft Word once it works.
Here are the last couple of lines of the code (if the line <text variable="note" display="block"/> is removed, then the error is gone):
<text macro="editor"/>
<text macro="volume"/>
<text variable="page"/>
<text macro="issuance"/>
<text macro="access"/>
</group>
<text variable="note" display="block"/>
</layout>
</bibliography>
</style>
I would really appreciate if anyone could help with this. Thanks!

I don't think this is in the specifications, but you can't mix second-field-align in the bibliography settings with display set on individual elements (because they're doing the same type of things, so the CSL processor doesn't know what you actually want to do).
I see you found a solution, but that'll not print the annotations on a new line. If you still want that, go back to
<text variable="note" display="block"/>
But then remove the second-field-align from bibliography, i.e. for Nature, turn it into
<bibliography et-al-min="6" et-al-use-first="1" entry-spacing="0" line-spacing="2">

Ok, I was now able to fix this by replacing the line I added with
<text variable="note" prefix=""/>
There is no error message anymore and the citations look great! I will leave this question up, in case anyone is or will be struggling with the same problem.

I haven't tested this, but I think the problem is that you only used display="block" on a single element under <layout/>. Per https://docs.citationstyles.org/en/1.0.1/specification.html#display, "The display attribute ... may be used to structure individual bibliographic entries into one or more text blocks. If used, all rendering elements should be under the control of a display attribute."
If you want the annotations to appear on a new line, I'd try introducing a new <group display="block">...</group> that encompasses the original content of <layout/> in the bibliography section, followed by <text variable="note" display="block"/>.

Related

jsf: best practice for user-dependent order of input fields [duplicate]

This question already has answers here:
How does the 'binding' attribute work in JSF? When and how should it be used?
(2 answers)
JSF doesn't support cross-field validation, is there a workaround?
(2 answers)
JSTL in JSF2 Facelets... makes sense?
(3 answers)
Closed 13 days ago.
The website I'm working on has multiple types of users: basic, advanced, pro. The form is already customized depending on user type by surround some fields with a conditional container tag like <h:panelGroup rendered="#{userType != 'basic'}">. This works well for just hiding some fields from the basic user..
Now, my customer's (horrible) new idea is to place some fields in one or another section, depending on the user type. Below is a simplified example. "Field 2" occurs in the 1st section for 'basic' users and in the 2nd section for all others. I've already evaded the "Duplicate ID" problem by assigning id "field_2a" to the second occurrence, but the value and the binding are the same.
The binding is the problem. It looks like JSF evaluates all expressions and bindings before removing stuff that is not rendered. As a result, #{formBean.field_2_inputElement} is always bound to field_2a and never to field_2. So it does not work for basic users.
I have 2 ideas to solve this, but both are ugly and I'm looking for a better option.
Duplicate the whole JSF fragment containing the form, and include the fragment matching the user type: <ui:include src="/path/to/#{userBean.userType}/form.xhtml"/> (yes, this works, I've tested it).
Downside: I'll have to make all future changes an both files synchronously.
Have separate bindings and use the matching one by checking the user type in the formBean.
Downside: It makes the code ugly.
Any ideas for a 3rd and better option?
<h3>Some section heading</h3>
<h:outputLabel id="field_1_label"
for="field_1"
value="Field 1: "/>
<h:inputText id="field_1"
value="{#formBean.field_1}"/>
<h:panelGroup rendered="#{userBean.userType == 'basic'}">
<h:outputLabel id="field_2_label"
for="field_2"
value="Field 2: "/>
<h:inputText id="field_2"
value="{#formBean.field_2}"
binding="#{formBean.field_2_inputElement}"/>
</h:panelGroup>
<h:panelGroup rendered="#{userBean.userType != 'basic'}">
<h3>Some section heading</h3>
<h:outputLabel id="field_3_label"
for="field_3"
value="Field 3: "/>
<h:inputText id="field_3"
value="{#formBean.field_3}"/>
<h:outputLabel id="field_2a_label"
for="field_2"
value="Field 2: "/>
<h:inputText id="field_2a"
value="{#formBean.field_2}"
binding="#{formBean.field_2_inputElement}"/>
</h:panelGroup>
<h3>Some section heading</h3>

Change Text Font to Bold

I have a table (sap.m.Table) and would like to change the header font to bold, but I'm unable to do that. Here is my code for one of the column definitions in my *.view.xml:
<Column xmlns="sap.m"
hAlign="Left"
width="17em"
>
<Text text="Vendor" />
</Column>
After looking at the API (sap.m.Text), I don't see a way to change the text style and I'm also new to UI5. Could someone point me to where to look for this?
sap.m.FormattedText
Another option is to use sap.m.FormattedText[api] with an inline tag <strong> within the htmlText value.
<Column ...>
<FormattedText htmlText="<strong>My Column</strong>" />
</Column>
Note
In XML, the character < needs to be escaped with <.
Browsers do not guarantee that the text within <strong> is always displayed in bold.
The <strong> element is for content that is of greater importance, while the <b> element is used to draw attention to text without indicating that it's more important. [source]
The element <b> is currently not supported by the FormattedText. On the other hand, <em> is supported to emphasize the text.
sap.m.Label
Instead of sap.m.Text, you can use sap.m.Label which supports "Bold" design.
<Column id="myColumn">
<Label labelFor="myColumn"
design="Bold"
text="..."
wrapping="true"
/>
</Column>
Additionally, enable the property wrapping (available since 1.50) in order to achieve the default behavior of sap.m.Text. Wrapping should be enabled for column headers as recommended by Fiori design guidelines:
Column Headers - Best Practices
Use controls that wrap [...]. Do not use controls that truncate.
Note: If the label is not labeling anything, please try with different controls like sap.m.FormattedText.
I found by chance that using <FormattedText> instead of <Text> creates bold headers. This works without (!) using any additional bold or strong markup in the htmlText of <FormattedText>.
So in your case you would go with:
<Column
hAlign="Left"
width="17em"
>
<FormattedText htmlText="Vendor" />
</Column>
Whether this works seems to be somewhat dependent on the SAPUI5 version and the theme in use.
It works for me on SAPUI5 1.108 with the default theme (no data-sap-ui-theme specified in index.html).
Try like in the Documentation
Create a custom CSS
Add your styleclass to the Control.

Chrome/HTML5: Input type number not respecting max attribute?

I have the following markup:
<input type="number" max="99" />
In Google Chrome (and possibly other webkit browsers), this will restrict the spinner's up arrow from going over 99, but it does not prevent the user from typing a number higher than 99. Even onblur, the invalid value is not removed/replaced or even a warning given that the value is invalid.
Am I misinterpreting how it's supposed to work, or is this a bug? I am using the latest version of Chrome (19 at the time of writing).
Edit:
To clarify, I want to know why a number greater than the specified max is allowed to be input in the first place. I realize that it gives a tooltip on form submission telling you that it's invalid, but it seems like inconsistent behavior that the spinner will not allow you to go above the max, yet you can simply type a number above the max at any time to circumvent it.
If this is desired behavior for some reason, why is that? And is there a better option to enforcing the input range without resorting to JS?
It does work but you only see an error message (tooltip) if you put a submit button and a form into your code:
<form action="#" method="get">
<input type="number" max="99" />
<input type="submit" value="Submit!" />
</form>
jsFiddle
​
It's an old question, but I didn't find any relevant answers for this question anywhere.
this behaviour is still around in chrome (version 61).
I have found a little trick that can be used in some situation.
it's relevant for those who use data-binding libraries like aurelia, angular etc.. I tested only on aurelia - but that should work also for others.
the trick relies on the fact that input of type range enforce the min/max constraints.
we simply create another input (of type range) that is bounded to the same value as the regular input, and we hide it via css.
when the user inputs something that is greater than the max value, it will snap back to the max value.
here's a demo in aurelia: https://gist.run/?id=86fc278d3837718be4691acd5625aaad

Umbraco 4.6 - macros not rendering

I posted this on the Umbraco forum but to no avail, and wondered if the community at large might be able to offer some advice. We are upgrading our site from 4.0.3 to 4.6. I can't deploy it though as the macros aren't rendering - the error states the following about 30 times:
UmbracoPage Aliases must be unique, and element with alias 'data' has already been loaded!
And also says:
System.Web.HttpException: Multiple controls with the same ID 'ctl00$ctl00$ContentPlaceHolderDefault$ctl28' were found. Trace requires that controls have unique IDs.
I tried deleting the contents of my data file but this didn't help.. I also have 22 duplicate 'homepage' templates that Umbraco won't delete (possibly an issue for another post - or it could be related!).
The error message tells you the issue basically:
"Multiple controls with the same ID..." or in potentially no ID
You most likely have two Macros (of same type/alias) on the page and you are not specifying an ID for them.
Example:
<umbraco:Macro Alias="TestMacro" runat="server" />
<umbraco:Macro Alias="TestMacro" runat="server" />
If you want to render the same macro twice on the same page.
Then you must give them a unique ID (see below):
<umbraco:Macro ID="macro1" Alias="TestMacro" runat="server" />
<umbraco:Macro ID="macro2" Alias="TestMacro" runat="server" />

How to generate MS Visio diagram automatically? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I have some sort of a table describing a graph of dependencies. Is there any easy way to convert it into a MS Visio diagram?
Like a .CSV format for Excel...
If it is not possible with MS Visio, then is there any software which draws a diagram from a list of graph dependencies?
Thank you.
graphviz is pretty much geared for this sort of thing. I assume you're on Windows since you asked about Visio, so here are the Windows binaries for it.
If your using a newer version of Visio (2003+) you should use the Reverse engineer tool for databases to start your diagram. It will suck all the db tables and relationships into shapes that you can then modify.
Here is a link that will walk you thru the feature: http://office.microsoft.com/en-us/visio/HA101154851033.aspx
I wrote a PowerShell module called VisioPS that may help you (See the downloads section here:
* The VisioPS module is part of my VisioAutomation library on CodePlex)
After installing VisioPS, you an launch an instance of PowerShell and do this:
Import-Module VisioPS
New-VisioApplication
New-VisioDocument
$dg = Import-VisioDirectedGraph c:\foo.xml
Invoke-VisioDraw $dg
The Direct Graph is a simple XML document like this
<directedgraph>
<page>
<renderoptions
usedynamicconnectors="true"
scalingfactor="20"
/>
<shapes>
<shape id="n1" label="FOO1" stencil="server_u.vss" master="Server" url="http://microsoft.com" />
<shape id="n2" label="FOO2" stencil="server_u.vss" master="Email Server" url="http://contoso.com"/>
<shape id="n3" label="FOO3" stencil="server_u.vss" master="Proxy Server" url="\\isotope\public" />
<shape id="n4" label="FOO4" stencil="server_u.vss" master="Web Server">
<customprop name="prop1" value="value1"/>
<customprop name="prop2" value="value2"/>
</shape>
<shape id="n5" label="FOO4" stencil="server_u.vss" master="Application Server" />
</shapes>
<connectors>
<connector id="c1" from="n1" to="n2" label="LABEL1" />
<connector id="c2" from="n2" to="n3" label="LABEL2" color="#ff0000" weight="2" />
<connector id="c3" from="n3" to="n4" label="LABEL1" color="#44ff00" />
<connector id="c4" from="n4" to="n5" label="" color="#0000ff" weight="5"/>
<connector id="c5" from="n4" to="n1" label="" />
<connector id="c6" from="n4" to="n3" label="" weight="10"/>
</connectors>
</page>
</directedgraph>
VisioPS uses MSAGL to perform the layout for the nodes
You could easily take your table of dependencies and create the XML needed
If you look closer at the code in my library, you can also directly create the objects necessary to do the rendering without having to go through the XML at all.
Visio Professional edition will import from a spreadsheet or database, but it does not appear possible to have Visio automatically draw connectors between shapes.
Not sure if that helps, but ARIS Express (http://www.ariscommunity.com/aris-express) has a feature called smart design. You enter your data as a spreadsheet and it automatically generates the diagram. Works for process models, but also for data models or organisational charts.
Graphvis is a plugin to import .gv files in dot format. It will draw the connectors and shapes can be customized, and there are a few initial layout options.
Omnigraffle can be an alternative. In Omnigraffle you won't be able to import a csv, but you will be able to insert items as a list and sort them very easily creating dependencies between elements. Then, there is a function call "Dynamic Diagram" that sorts the diagram automatically. (You can modify the type of diagram and length of connectors)