SemanticMediaWiki / SemanticCite

Allows to manage citation resources using semantic annotations
https://www.semantic-mediawiki.org/wiki/Extension:Semantic_Cite
Other
24 stars 13 forks source link

Named template parameters in ResourceFormatter #24

Closed Cereil23 closed 8 years ago

Cereil23 commented 8 years ago

Semantic cite uses templates to format the citation, an example is journal|SciteAPAJournalResourceFormatter. I have constructed one using the named parameters such as {{{issue}}} which is mapped correctly using property mapping.

However, an issue is occurring when {{{issue}}} does not exist in the citation imported with the Find citable metadata special page. If the parameter exists, I get the issue number as expected in the citation. However, if there is no issue number, I get {{{issue}}} which does not look very nice in the citation.

Is there a way to solve this issue?

mwjames commented 8 years ago

However, an issue is occurring when {{{issue}}} does not exist in the citation imported with the Find citable metadata special page. If the parameter exists, I get the issue number as expected in the citation. However, if there is no issue number, I get {{{issue}}} which does not look very nice in the citation.

Hopefully, I understand the issue correctly which is about the template. Formatting via a template applies any other freedom a MW template gives you to transform content. You can see in example [0] that for example {{{volume|}}} is only displayed for when it is available by making use of the #if: parser function.

Instead of having predefined rules on how citation text is to be displayed, templates define the rules individually. If certain fields are expected but sometimes should be omitted then employing conditional parser functions such as #if: can help to shape the output.

[0] http://sandbox.semantic-mediawiki.org/w/index.php?title=Template:SciteMLACitationFormatter&action=edit

Cereil23 commented 8 years ago

Thanks a lot. You understood the issue, and this helps fix it.

I really like the Semantic Cite extension.

By the way, what did you use to generate the diagram of the architecture of Sementic Cite in the document 09-notes (Technical Notes)?

Thanks

mwjames commented 8 years ago

Thanks a lot. You understood the issue, and this helps fix it.

Your welcome.

what did you use to generate the diagram of the architecture

Made plain and simple by hand using LibreOffice Impress.