Closed byzheng closed 2 years ago
This is by design! See note 3 in https://kookma.github.io/TW-Refnotes/#demo%2Fref-macro
Narrative is only working for single quotation
If you send extra parameters than this is a limitation and not related to narrative!
Hi @marxsal
If you remember to parse the references in-text (<<ref title>>
) you have wrote the ($:/plugins/kookma/refnotes/macros/bibtex/regexprefs.js)
The showrefs ($:/plugins/kookma/refnotes/macros/apa/showrefs
) uses the find-refs ($:/plugins/kookma/refnotes/macros/bibtex/find-refs
) to find all instances of <<ref title>>
.
Now in the update 1.8, Refnotes uses ref macro with three parameters (<<ref title type page>>
see $:/plugins/kookma/refnotes/macros/apa/ref
) The problem is find-refs works fine with one parameter but with two or three parameters, it returns wrong results e.g does not distinguish the correct number of input parameters. Strangely, if you wrap the first parameter in single quote or double brackets, it works fine
I would appreciate to have a look.
Do you have an example from your demo site where it doesn't work? For instance, this does work:
<<ref rostami-2022 n p16 >>
Mark, See example in https://kookma.github.io/TW-Refnotes/#demo%2Fref-macro
You also create a new tiddler with below text:
<<ref "rostami-2022" n 'p. 16'>>
<<showrefs>>
This does not work, but, the below form will work.
<<ref 'rostami-2022' n 'p. 16'>>
<<showrefs>>
Try testing this.
\define find-refs(tid)
<$vars regexp="(?g)<<ref .+?>>"
regexp2='<<ref "*(.*?)"*>>'
regexp3="^'(.*?)'"
regexp4="\[\[(.*?)\]\]"
regexp5="^(.*?)\s"
>
<$list filter="[[$tid$]regexprefs:text<regexp>]">
<$list filter="[all[current]regexprefs<regexp2>]">
<$list filter="""
[all[current]regexprefs<regexp3>]
:else[all[current]regexprefs<regexp4>]
:else[all[current]regexprefs<regexp5>]
:else[all[current]]
""" variable=p >
<<pwrapper>>
</$list>
</$list>
</$list>
</$vars>
\end
\define pwrapper()
[[[[$(p)$]]]]
\end
This still does not work
<<ref "rostami-2022" n 'p. 16'>>
<<showrefs>>
The issue is with double quotes ("
), with single quote everything works fine
Do we know for sure it ever worked with double quotes?
Try:
\define find-refs(tid)
<$vars regexp="(?g)<<ref .+?>>"
regexp2='<<ref\s+(.*?)>>'
regexp3='^"(.*?)"'
regexp4="^'(.*?)'"
regexp5="\[\[(.*?)\]\]"
regexp6="^(.*?)\s"
>
<$list filter="[[$tid$]regexprefs:text<regexp>]">
<$list filter="[all[current]regexprefs<regexp2>]">
<$list filter="""
[all[current]regexprefs<regexp3>]
:else[all[current]regexprefs<regexp4>]
:else[all[current]regexprefs<regexp5>]
:else[all[current]regexprefs<regexp6>]
:else[all[current]]
""" variable=p >
<<pwrapper>>
</$list>
</$list>
</$list>
</$vars>
\end
\define pwrapper()
[[[[$(p)$]]]]
\end
This last one works. Despite the complexity of code, I tested all combinations of double quotes / single quotes and double bracket / quotes and all works.
<<ref [[rostami-2022]] n 'p. 16'>>
<<ref [[rostami-2022]] n "p. 16">>
<<ref 'rostami-2022' 'n' 'p. 16'>>
<<ref 'rostami-2022' "n" 'pp. 123-345'>>
<<ref "rostami-2022" "n" "pp. 123-345">>
<<ref "rostami-2022" n "pp. 123-345">>
<<ref "rostami-2022" n 'pp. 123-345'>>
<<showrefs>>
I use this code in Refnotes 1.8.1, and will push a new update shortly.
Fixed in 1.8.1
In the tiddler
Then in the reference list, I get this error
Narrative is only working for single quotation