-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow for decorating rendered text using a VariableWrapper
- Loading branch information
1 parent
34f4315
commit e474383
Showing
11 changed files
with
255 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
citeproc-java/src/main/java/de/undercouch/citeproc/VariableWrapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright 2016 Michel Kraemer | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package de.undercouch.citeproc; | ||
|
||
/** | ||
* Decorates individual items in citations and bibliographies | ||
* @author Michel Kraemer | ||
*/ | ||
public interface VariableWrapper { | ||
/** | ||
* This method will be called by the citation processor when an item in a | ||
* citation or bibliography is about to be rendered. The method may change | ||
* the way the item is rendered, for example, by prepending or appending | ||
* strings, or by completely replacing the item. The default implementation | ||
* of this method always returns <code>prePunct + str + postPunct</code>. | ||
* @param params a number of parameters that specify the context in which | ||
* rendering happens, the citation item that is currently being rendered, | ||
* and additional information. | ||
* @param prePunct the text that precedes the item to render | ||
* @param str the item to render | ||
* @param postPunct the text that follows the item to render | ||
* @return the string to be rendered | ||
*/ | ||
String wrap(VariableWrapperParams params, String prePunct, String str, String postPunct); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"name": "Context", | ||
"pkg": "de.undercouch.citeproc", | ||
"description": "A context in which rendering happens", | ||
|
||
"types": [ | ||
"citation", | ||
"bibliography" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{ | ||
"name": "VariableWrapperParams", | ||
"pkg": "de.undercouch.citeproc", | ||
"description": "Parameters for a {@link de.undercouch.citeproc.VariableWrapper}", | ||
|
||
"additionalImports": [ | ||
"de.undercouch.citeproc.csl.CSLItemData" | ||
], | ||
|
||
"props": [ | ||
{ | ||
"type": "CSLItemData", | ||
"name": "itemData" | ||
}, | ||
{ | ||
"type": "String[]", | ||
"name": "variableNames" | ||
}, | ||
{ | ||
"type": "Context", | ||
"name": "context" | ||
}, | ||
{ | ||
"type": "String", | ||
"name": "xclass" | ||
}, | ||
{ | ||
"type": "String", | ||
"name": "position" | ||
}, | ||
{ | ||
"type": "Integer", | ||
"name": "note-number" | ||
}, | ||
{ | ||
"type": "Integer", | ||
"name": "first-reference-note-number" | ||
}, | ||
{ | ||
"type": "Integer", | ||
"name": "citation-number" | ||
}, | ||
{ | ||
"type": "Integer", | ||
"name": "index" | ||
}, | ||
{ | ||
"type": "String", | ||
"name": "mode" | ||
} | ||
] | ||
} |