WIKINDX API 6.10.2

CITE

Table of Contents

Functions

exportSettings()  : mixed
Setters and getters for various export preferences (e.g. from word processor)
doCitations()  : array<string|int, mixed>
Compile and add the citations to the text
mapTemplate()  : array<string|int, mixed>
Map a template to the raw values and produce a basic citation for inserting into the text
checkResourceTypeTemplate()  : array<string|int, mixed>
Some resource types have specific templates for in-text citations
forceAmbiguousTemplate()  : array<string|int, mixed>
Force the use of ambiguous templates overriding other templates other than subsequentCreatorTemplate
checkSubsequentCreatorTemplate()  : array<string|int, mixed>
Confirm (or not) that a subsequentCreatorTemplate designation is correct.
citationPosition()  : array<string|int, mixed>
Find required position of citation in sentence. Not all requests are possible so drop through three levels . . . Be careful! 0 => "Unchanged" 1 => "After previous creator name(s)" 2 => "After previous quotation" 3 => "Before end of sentence" 4 => "After end of sentence" 5 => "Before next soft punctuation" 6 => "After next soft punctuation"
checkConsecutiveCitations()  : array<string|int, mixed>
For multiple citations that are repositioned after soft or hard punctuation, mark them as consecutive citations.
checkFollowCreatorTemplate()  : array<string|int, mixed>
Confirm (or not) that a followCreatorTemplate designation is correct (in-text citations).
checkConsecutiveCreatorTemplate()  : array<string|int, mixed>
Confirm (or not) that a consecutiveCreatorTemplate designation is correct (in-text citations).
formatCitation()  : array<string|int, mixed>
Format the citation
hyperlinkCitation()  : void
Hyperlink the citation text
citationWrapping()  : array<string|int, mixed>
Format citation with wrapping characters taking account of consecutive citation runs and their delimiting characters
trueFootnoteWrapping()  : string
Wrapping of true footnotes in the text — only used for endInc, endSameId, and endSameIdOrdered
formatSentence()  : string
Format the sentence with each citation obeying required positions.
positionCitationInSentence()  : array<string|int, mixed>
Position citations in the sentence.
doPageSplit()  : void
Check if a citation page should indeed be split and deal with dependencies.
mapTemplateTidyYears()  : array<string|int, mixed>
Do some pre-processing of various year fields in the template
formatPages()  : void
Format pages.
formatCreators()  : void
Format creator name lists (authors, editors, etc.)
replacementYears()  : array<string|int, mixed>
Add replacement years fields to templates
copyYearAlternates()  : void
Copy any alternates relating to pre and post fields from the 'year' field to 'year1' and 'year2' fields
parseIndependent()  : void
Parse independent strings of new templates
compileTemplates()  : array<string|int, mixed>
Compile in-text and endote-style citation templates
addAmbiguity()  : void
Add any ambiguity letter to year field. Only for in-text citations
formatYear()  : void
Format years for citations
secondYearField()  : array<string|int, mixed>
Conditionally add second year field for formatting citations (e.g. revision year, reprint year etc.)—depends on resource type
splitIntoSentences()  : arrray
Split text into sentences.
parseSentences()  : array<string|int, mixed>
Parse the sentences array for citations and make some initial decisions
findSubsequentTemplates()  : void
Decide if the template for this citation should be the subsequentCreatorTemplate or similar for endnote styles.
findFollowCreatorTemplate()  : array<string|int, mixed>
Find cases for followCreatorTemplate and mark position after creator's name.
getCPattern()  : array<string|int, mixed>
Create the preg pattern for finding a citation's creator names in the same sentence.
tidySentences()  : array<string|int, mixed>
end-of-sentence characters have been captured in $split's array elements. These must be appended to the previous part sentence.
quotationCitationIndex()  : array<string|int, mixed>
Add the citation index to relevant quotations.
tidySentencesEndQuote()  : array<string|int, mixed>
Ensure hard punctuation just before a quotation end marker is treated as marking the end of a complete sentence.
findSpecialQuotes()  : string
Find special quotes such as dialogue and nested quotes—mark them and protect contents of nested quotes
findDialogueQuotes()  : string
Find dialogue quotes and mark them.
findNestedQuotes()  : string
Find and mark nested quotations.
findQuotes()  : string
Mark quotations and protect their content (in case the content has hard punctuation).
blockQuote1()  : string
Mark blockquotes.
blockQuote2()  : string
Format blockquotes and ensure tailend bits are part of it.
blockQuoteSort()  : string
Sort the blockQuote array by length so that the preg_replace works as expected
findEllipses()  : string
Mark ellipses and protect their content (in case the content has hard punctuation).
findTitle()  : array<string|int, mixed>
Find and note existence of title and short title in sentences
tidyInputText()  : string
Preliminary tidying of input text.
reconstituteBlockquote()  : string
Reconsitute blockquote
reconstituteQuote()  : string
Reconsitute quotation
reconstituteQuoteCallback()  : string
Reconsitute quotation callback
reconstituteText()  : string
Return sentence temporary markup to original
debugPrint()  : void
Print an array prettily for debugging purposes

Functions

exportSettings()

Setters and getters for various export preferences (e.g. from word processor)

exportSettings(string $method[, mixed $extra = FALSE ]) : mixed
Parameters
$method : string
$extra : mixed = FALSE

Default = FALSE

doCitations()

Compile and add the citations to the text

doCitations(array<string|int, mixed> $sentences, array<string|int, mixed> $orderedResIds, array<string|int, mixed> $styleInfo, array<string|int, mixed> $styleCitation, array<string|int, mixed> $templates, array<string|int, mixed> $replaceInTextCitationTemplates, array<string|int, mixed> $flags, string $hyperlinkBase) : array<string|int, mixed>
Parameters
$sentences : array<string|int, mixed>
$orderedResIds : array<string|int, mixed>
$styleInfo : array<string|int, mixed>
$styleCitation : array<string|int, mixed>
$templates : array<string|int, mixed>
$replaceInTextCitationTemplates : array<string|int, mixed>
$flags : array<string|int, mixed>
$hyperlinkBase : string
Return values
array<string|int, mixed>

mapTemplate()

Map a template to the raw values and produce a basic citation for inserting into the text

mapTemplate(array<string|int, mixed> &$citation, int $cIndex, string $sentence, array<string|int, mixed> $templates, array<string|int, mixed> $styleCitation, string $citeLocalisation, array<string|int, mixed> $item) : array<string|int, mixed>
Parameters
$citation : array<string|int, mixed>
$cIndex : int
$sentence : string
$templates : array<string|int, mixed>
$styleCitation : array<string|int, mixed>
$citeLocalisation : string
$item : array<string|int, mixed>
Return values
array<string|int, mixed>

checkResourceTypeTemplate()

Some resource types have specific templates for in-text citations

checkResourceTypeTemplate(array<string|int, mixed> $citations, array<string|int, mixed> $replaceTemplates, array<string|int, mixed> $templates) : array<string|int, mixed>
Parameters
$citations : array<string|int, mixed>
$replaceTemplates : array<string|int, mixed>
$templates : array<string|int, mixed>
Return values
array<string|int, mixed>

forceAmbiguousTemplate()

Force the use of ambiguous templates overriding other templates other than subsequentCreatorTemplate

forceAmbiguousTemplate(array<string|int, mixed> $citations) : array<string|int, mixed>
Parameters
$citations : array<string|int, mixed>
Return values
array<string|int, mixed>

checkSubsequentCreatorTemplate()

Confirm (or not) that a subsequentCreatorTemplate designation is correct.

checkSubsequentCreatorTemplate(array<string|int, mixed> $styleCitation, mixed $sentence) : array<string|int, mixed>

$styleCitation['subsequentCreatorRange'] == 0 // Entire text $styleCitation['subsequentCreatorRange'] == 1 // Paragraph $styleCitation['subsequentCreatorRange'] == 2 // Section

Parameters
$styleCitation : array<string|int, mixed>
$sentence : mixed
Return values
array<string|int, mixed>

citationPosition()

Find required position of citation in sentence. Not all requests are possible so drop through three levels . . . Be careful! 0 => "Unchanged" 1 => "After previous creator name(s)" 2 => "After previous quotation" 3 => "Before end of sentence" 4 => "After end of sentence" 5 => "Before next soft punctuation" 6 => "After next soft punctuation"

citationPosition(array<string|int, mixed> $styleCitation, string $citeLocalisation, array<string|int, mixed> $citations, string &$sentence) : array<string|int, mixed>

NB positions 0, 3 and 4 are final destinations that if provided, preclude all later options

Parameters
$styleCitation : array<string|int, mixed>
$citeLocalisation : string
$citations : array<string|int, mixed>
$sentence : string
Return values
array<string|int, mixed>

checkConsecutiveCitations()

For multiple citations that are repositioned after soft or hard punctuation, mark them as consecutive citations.

checkConsecutiveCitations(array<string|int, mixed> $sentence, int $citationStyle) : array<string|int, mixed>
Parameters
$sentence : array<string|int, mixed>
$citationStyle : int
Return values
array<string|int, mixed>

checkFollowCreatorTemplate()

Confirm (or not) that a followCreatorTemplate designation is correct (in-text citations).

checkFollowCreatorTemplate(array<string|int, mixed> $styleCitation, array<string|int, mixed> $citations) : array<string|int, mixed>
Parameters
$styleCitation : array<string|int, mixed>
$citations : array<string|int, mixed>
Return values
array<string|int, mixed>

checkConsecutiveCreatorTemplate()

Confirm (or not) that a consecutiveCreatorTemplate designation is correct (in-text citations).

checkConsecutiveCreatorTemplate(array<string|int, mixed> $citations) : array<string|int, mixed>
Parameters
$citations : array<string|int, mixed>
Return values
array<string|int, mixed>

formatCitation()

Format the citation

formatCitation(array<string|int, mixed> $citation, int $cIndex, array<string|int, mixed> $styleCitation, mixed $itemArray, array<string|int, mixed> $flags, string $hyperlinkBase) : array<string|int, mixed>
Parameters
$citation : array<string|int, mixed>
$cIndex : int
$styleCitation : array<string|int, mixed>
$itemArray : mixed
$flags : array<string|int, mixed>
$hyperlinkBase : string
Return values
array<string|int, mixed>

hyperlinkCitation()

Hyperlink the citation text

hyperlinkCitation(mixed &$citeText, int $id, string $hyperlinkBase) : void
Parameters
$citeText : mixed
$id : int
$hyperlinkBase : string

citationWrapping()

Format citation with wrapping characters taking account of consecutive citation runs and their delimiting characters

citationWrapping(array<string|int, mixed> $styleCitation, array<string|int, mixed> $citation, string $citeText, string $pageSplit, string $output) : array<string|int, mixed>
Parameters
$styleCitation : array<string|int, mixed>
$citation : array<string|int, mixed>
$citeText : string
$pageSplit : string
$output : string
Return values
array<string|int, mixed>

trueFootnoteWrapping()

Wrapping of true footnotes in the text — only used for endInc, endSameId, and endSameIdOrdered

trueFootnoteWrapping(array<string|int, mixed> $styleCitation, array<string|int, mixed> $citation, string $citeText, array<string|int, mixed> $flags) : string
Parameters
$styleCitation : array<string|int, mixed>
$citation : array<string|int, mixed>
$citeText : string
$flags : array<string|int, mixed>
Return values
string

formatSentence()

Format the sentence with each citation obeying required positions.

formatSentence(array<string|int, mixed> $citation, int $cIndex, string $sentence, array<string|int, mixed> $styleCitation, string $citeLocalisation, mixed $citeText, bool $pageSplit, bool $isConsecutive, array<string|int, mixed> $flags) : string
Parameters
$citation : array<string|int, mixed>
$cIndex : int
$sentence : string
$styleCitation : array<string|int, mixed>
$citeLocalisation : string
$citeText : mixed
$pageSplit : bool
$isConsecutive : bool
$flags : array<string|int, mixed>
Return values
string

positionCitationInSentence()

Position citations in the sentence.

positionCitationInSentence(string $sentence, array<string|int, mixed> $citeTexts, array<string|int, mixed> $patterns, array<string|int, mixed> $hardPuncs, string $space) : array<string|int, mixed>

The array $hardPuncs contains bools. If TRUE, the $hardPunc pattern is part of the search pattern. This encodes whatever the hard punctuation was and thus might include concluding space characters. If we don't want a space before the citation, these space characters must be placed after the citation. The matching array element from $citeTexts must be an array. If the elements of this array are integers, they refer to elements of the callback's $matches array

Parameters
$sentence : string
$citeTexts : array<string|int, mixed>
$patterns : array<string|int, mixed>
$hardPuncs : array<string|int, mixed>
$space : string
Return values
array<string|int, mixed>

doPageSplit()

Check if a citation page should indeed be split and deal with dependencies.

doPageSplit(array<string|int, mixed> &$styleCitation, array<string|int, mixed> &$citation, string &$pre, string &$post) : void

Splitting only occurs if the cited creator's name(s) is in the sentence.

Deal with DEPENDENT_ON_PREVIOUS_FIELD for characters dependent on previous field's existence and DEPENDENT_ON_NEXT_FIELD for characters dependent on the next field's existence

Parameters
$styleCitation : array<string|int, mixed>
$citation : array<string|int, mixed>
$pre : string
$post : string

mapTemplateTidyYears()

Do some pre-processing of various year fields in the template

mapTemplateTidyYears(array<string|int, mixed> $template, array<string|int, mixed> $item) : array<string|int, mixed>
Parameters
$template : array<string|int, mixed>
$item : array<string|int, mixed>
Return values
array<string|int, mixed>

formatPages()

Format pages.

formatPages(array<string|int, mixed> $styleCitation, string $pages, array<string|int, mixed> &$item[, bool $footnotes = FALSE ][, string $field = 'pages' ]) : void

If $footnotes is TRUE, these are pages for short footnotes

Parameters
$styleCitation : array<string|int, mixed>
$pages : string
$item : array<string|int, mixed>
$footnotes : bool = FALSE

Default FALSE

$field : string = 'pages'

Default 'pages'

formatCreators()

Format creator name lists (authors, editors, etc.)

formatCreators(array<string|int, mixed> $creators, array<string|int, mixed> $styleCitation, string $citeLocalisation, array<string|int, mixed> &$item, array<string|int, mixed> $resIds, int $resId) : void
Parameters
$creators : array<string|int, mixed>

Multi-associative array of creator names e.g. this array might be of the primary authors:

array([0] => array(['surname'] => 'Grimshaw', ['firstname'] => Mark, ['initials'] => 'N', ['prefix'] => ),
[1] => array(['surname'] => 'Witt', ['firstname'] => Jan, ['initials'] => , ['prefix'] => 'de'))
$styleCitation : array<string|int, mixed>
$citeLocalisation : string
$item : array<string|int, mixed>
$resIds : array<string|int, mixed>
$resId : int

replacementYears()

Add replacement years fields to templates

replacementYears(string $template, array<string|int, mixed> $style, STYLEMAP $styleMap) : array<string|int, mixed>
Parameters
$template : string
$style : array<string|int, mixed>
$styleMap : STYLEMAP
Return values
array<string|int, mixed>

copyYearAlternates()

Copy any alternates relating to pre and post fields from the 'year' field to 'year1' and 'year2' fields

copyYearAlternates(string $yearField, array<string|int, mixed> &$newTemplate) : void
Parameters
$yearField : string
$newTemplate : array<string|int, mixed>

parseIndependent()

Parse independent strings of new templates

parseIndependent(array<string|int, mixed> &$template) : void
Parameters
$template : array<string|int, mixed>

compileTemplates()

Compile in-text and endote-style citation templates

compileTemplates(array<string|int, mixed> $template, array<string|int, mixed> $citationFields, array<string|int, mixed> $years[, bool $freeStanding = FALSE ]) : array<string|int, mixed>
Parameters
$template : array<string|int, mixed>
$citationFields : array<string|int, mixed>
$years : array<string|int, mixed>
$freeStanding : bool = FALSE

Default FALSE

Return values
array<string|int, mixed>

addAmbiguity()

Add any ambiguity letter to year field. Only for in-text citations

addAmbiguity(array<string|int, mixed> $styleCitation, array<string|int, mixed> &$item, array<string|int, mixed> $citation) : void
Parameters
$styleCitation : array<string|int, mixed>
$item : array<string|int, mixed>
$citation : array<string|int, mixed>

formatYear()

Format years for citations

formatYear(array<string|int, mixed> $styleCitation, array<string|int, mixed> &$item, array<string|int, mixed> $resource) : void
Parameters
$styleCitation : array<string|int, mixed>
$item : array<string|int, mixed>
$resource : array<string|int, mixed>

secondYearField()

Conditionally add second year field for formatting citations (e.g. revision year, reprint year etc.)—depends on resource type

secondYearField(mixed $types, string|array<string|int, mixed> $citationYearsTemplate, array<string|int, mixed> $row) : array<string|int, mixed>
Parameters
$types : mixed
$citationYearsTemplate : string|array<string|int, mixed>
$row : array<string|int, mixed>
Return values
array<string|int, mixed>

splitIntoSentences()

Split text into sentences.

splitIntoSentences(string $citeLocalisation, string $text) : arrray

Must discount abbreviations ending in an end-of-sentence character and such characters deep within quotation marks

Parameters
$citeLocalisation : string
$text : string
Return values
arrray

Array of ordered sentences.

parseSentences()

Parse the sentences array for citations and make some initial decisions

parseSentences(string $citeLocalisation, array<string|int, mixed> $styleCitation, array<string|int, mixed> $input) : array<string|int, mixed>
Parameters
$citeLocalisation : string
$styleCitation : array<string|int, mixed>
$input : array<string|int, mixed>
Return values
array<string|int, mixed>

findSubsequentTemplates()

Decide if the template for this citation should be the subsequentCreatorTemplate or similar for endnote styles.

findSubsequentTemplates(array<string|int, mixed> $styleCitation, string $sentence, null &$templateField, array<string|int, mixed> $resIds, int $resId, int $resIdsIndex, string $currentPages, string $previousPages) : void

We don't have all information yet to make further decisions (e.g., creator's name).

Parameters
$styleCitation : array<string|int, mixed>
$sentence : string
$templateField : null
$resIds : array<string|int, mixed>
$resId : int
$resIdsIndex : int
$currentPages : string
$previousPages : string

findFollowCreatorTemplate()

Find cases for followCreatorTemplate and mark position after creator's name.

findFollowCreatorTemplate(string $citeLocalisation, array<string|int, mixed> $styleCitation, array<string|int, mixed> $sentenceArray, int $citationKey, array<string|int, mixed> $previousCPatterns) : array<string|int, mixed>

If an author has already been found by a previous citation in the sentence, do not mark the position for this citation. We check by comparing this $cPattern with previous ones in this sentence.

Parameters
$citeLocalisation : string
$styleCitation : array<string|int, mixed>
$sentenceArray : array<string|int, mixed>
$citationKey : int
$previousCPatterns : array<string|int, mixed>
Return values
array<string|int, mixed>

getCPattern()

Create the preg pattern for finding a citation's creator names in the same sentence.

getCPattern(array<string|int, mixed> $creators, string $citeLocalisation, string $cInitialPunc, string $spaceRaw, string $space) : array<string|int, mixed>
Parameters
$creators : array<string|int, mixed>
$citeLocalisation : string
$cInitialPunc : string
$spaceRaw : string
$space : string
Return values
array<string|int, mixed>

[$cPattern, $puncTrim]

tidySentences()

end-of-sentence characters have been captured in $split's array elements. These must be appended to the previous part sentence.

tidySentences(string $citeLocalisation, array<string|int, mixed> $split, array<string|int, mixed> $puncs) : array<string|int, mixed>
Parameters
$citeLocalisation : string
$split : array<string|int, mixed>
$puncs : array<string|int, mixed>
Return values
array<string|int, mixed>

quotationCitationIndex()

Add the citation index to relevant quotations.

quotationCitationIndex(string $citeLocalisation, array<string|int, mixed> $sentences) : array<string|int, mixed>
Parameters
$citeLocalisation : string
$sentences : array<string|int, mixed>
Return values
array<string|int, mixed>

tidySentencesEndQuote()

Ensure hard punctuation just before a quotation end marker is treated as marking the end of a complete sentence.

tidySentencesEndQuote(string $citeLocalisation, array<string|int, mixed> $sentences, array<string|int, mixed> $quotes, array<string|int, mixed> $puncs) : array<string|int, mixed>
Parameters
$citeLocalisation : string
$sentences : array<string|int, mixed>
$quotes : array<string|int, mixed>
$puncs : array<string|int, mixed>
Return values
array<string|int, mixed>

findSpecialQuotes()

Find special quotes such as dialogue and nested quotes—mark them and protect contents of nested quotes

findSpecialQuotes(string $text, array<string|int, mixed> $quotes, array<string|int, mixed> $apostrophes, string $space) : string
Parameters
$text : string
$quotes : array<string|int, mixed>
$apostrophes : array<string|int, mixed>
$space : string
Return values
string

findDialogueQuotes()

Find dialogue quotes and mark them.

findDialogueQuotes(mixed $para, string $qStart, string $qEnd, string $apos1, string $apos2) : string

First use the split paragraphs in attempt to find dialogue quotes (odd numbers of quotation marks in each paragraph indicate dialogue). Need to ensure we don't count quote characters that function as apostrophe or possessive. Need mark only the start and continuation of such a pattern leaving quote marks in between. The pattern might be:

Here begins "some dialogue." Mark said “Stéphane!"

// paragraph with odd number of marks. The last marks the start.

“What?” said Stéphane. “Go away. . .

// paragraph with odd number of marks.

“OK” said Mark.

// First subsequent paragraph with even number of marks.

Could also be:

Here begins "some dialogue." Mark said “Stéphane!

// paragraph with odd number of marks. The last marks the start.

“What?” said Stéphane. “Go away. . .

// paragraph with odd number of marks.

“OK.”

// First subsequent paragraph with even number of marks. . . . and other variations . . .

Parameters
$para : mixed
$qStart : string
$qEnd : string
$apos1 : string
$apos2 : string
Return values
string

findNestedQuotes()

Find and mark nested quotations.

findNestedQuotes(string $text, string $qStart, string $qEnd, string $quoteProtection, string $apos2, string $space) : string
Parameters
$text : string
$qStart : string
$qEnd : string
$quoteProtection : string
$apos2 : string
$space : string
Return values
string

findQuotes()

Mark quotations and protect their content (in case the content has hard punctuation).

findQuotes(string $text, string $citeLocalisation, string $space) : string

We also find the number of qords in long quotations and mark the text as blockquote if required. If doing this, we also need to ensure that any punctuation immediately following is part of the blockquote plus any citation or footnote.

Parameters
$text : string
$citeLocalisation : string
$space : string
Return values
string

blockQuote1()

Mark blockquotes.

blockQuote1(array<string|int, mixed> $matches) : string

This is only used when exporting a document (e.g., from the word processor)

Parameters
$matches : array<string|int, mixed>

return string

Return values
string

blockQuote2()

Format blockquotes and ensure tailend bits are part of it.

blockQuote2(string $text, string $citeLocalisation, string $space) : string

This is only used when exporting a document (e.g., from the word processor) We use

because of the indent options available to the user

Parameters
$text : string
$citeLocalisation : string
$space : string

return string

Return values
string

blockQuoteSort()

Sort the blockQuote array by length so that the preg_replace works as expected

blockQuoteSort(string $a, string $b) : string
Parameters
$a : string
$b : string
Return values
string

findEllipses()

Mark ellipses and protect their content (in case the content has hard punctuation).

findEllipses(string $text, string $citeLocalisation, string $space) : string
Parameters
$text : string
$citeLocalisation : string
$space : string
Return values
string

findTitle()

Find and note existence of title and short title in sentences

findTitle(array<string|int, mixed> $sentences) : array<string|int, mixed>
Parameters
$sentences : array<string|int, mixed>
Return values
array<string|int, mixed>

tidyInputText()

Preliminary tidying of input text.

tidyInputText(string $text, string $citeLocalisation, string $space) : string

Text from TinyMce can be a complete mess . . . For example: "[cite]201:101[/cite]. Here is an initial citation [cite]100:252-253[/cite] that has page numbers. Yet another quote from the same source with a different page number is: "Bløh, bløh, bløh"[cite]46:65-66[/cite].

Here's a new paragraph with a subsequent citation [cite]46:71[/cite]. And again [cite]46:99[/cite]. Here, [cite]101[/cite], is a work by one author who also, [cite]101[/cite], in the 44th. year, wrote this ambiguous tome stating: "yet more blah, blah, blah" [cite]100:133[/cite]. Again, a citation with multiple authors, a publication year, and a page number: "We were 'worked' like slaves" says [cite]111:41[/cite], and another with no creator [cite]99[/cite]. Try this: "A quotation. Here we go again. Third part of quotation ?" A "quotation . . . with ellipses !" So . . . here. . . . and....there... again… ? Finally. . . . it's working!

A web citation: [cite]357[/cite].

Another paragraph with a citation that has no creators[cite]1172[/cite]. "But I'll be back."

New paragraph.

I say "blah blah" [cite]515[/cite][cite]535[/cite] something.

A sentence with a citation [cite]515[/cite] and then another [cite]535[/cite] that follows.

Problems here include:

  1. No paragraph start at beginning of sentence (but there could be).
  2. Use of

    for a new paragraph mixed with use of

    ...

User input practices can vary. For example, variable number of spaces (or none) before the [cite] tag. These must be removed as the citation style dictates if there should be a space before citations or not.

Note that tinyMCE appears to do its own tidying up—not always successfully! For example, resource metadata that, in the editor's HTML view, looks like:

I say "blah blah"[cite]515[/cite][cite]535[/cite] something.

A sentence with a citation[cite]515[/cite] and then another[cite]535[/cite] that follows.

might be returned by tinyMCE as:

I say "blah blah"[cite]515[/cite][cite]535[/cite] something.

A sentence with a citation[cite]515[/cite] and then another[cite]535[/cite] that follows.

There is a missing paragraph end at the end of the first sentence—this must be dealt with.

The sentences and paragraphs need to be normalized before starting the citation parsing in such a way that the resultant text does not differ (too much) from the original but that the citation parsing can do its job. The above example should end up as:

"

[cite]201:101[/cite]. Here is an initial citation[cite]100:252-253[/cite] that has page numbers. Yet another quote from the same source with a different page number is: "Bløh, bløh, bløh"[cite]46:65-66[/cite].

Here's a new paragraph with a subsequent citation[cite]46:71[/cite]. And again[cite]46:99[/cite]. Here,[cite]101[/cite], is a work by one author who also,[cite]101[/cite], in the 44th. year, wrote this ambiguous tome stating: "yet more blah, blah, blah"[cite]100:133[/cite]. Again, a citation with multiple authors, a publication year, and a page number: "We were 'worked' like slaves" says[cite]111:41[/cite], and another with no creator[cite]99[/cite]. Try this: "A quotation. Here we go again. Third part of quotation ?" A "quotation . . . with ellipses !" So . . . here. . . . and....there... again… ? Finally. . . . it's working!

A web citation:[cite]357[/cite].

Another paragraph with a citation that has no creators[cite]1172[/cite]. "But I'll be back."

New paragraph.

I say "blah blah"[cite]515[/cite][cite]535[/cite] something.

A sentence with a citation[cite]515[/cite] and then another[cite]535[/cite] that follows.

before then replacing paragraph tags and passing onto the citation parser.

Parameters
$text : string
$citeLocalisation : string
$space : string
Return values
string

reconstituteBlockquote()

Reconsitute blockquote

reconstituteBlockquote(string $newText, array<string|int, mixed> $quotes) : string
Parameters
$newText : string
$quotes : array<string|int, mixed>
Return values
string

reconstituteQuote()

Reconsitute quotation

reconstituteQuote(string $newText, array<string|int, mixed> $quotes[, bool $keepQuoteMarks = TRUE ]) : string
Parameters
$newText : string
$quotes : array<string|int, mixed>
$keepQuoteMarks : bool = TRUE

Default = TRUE

Return values
string

reconstituteQuoteCallback()

Reconsitute quotation callback

reconstituteQuoteCallback(array<string|int, mixed> $matches, string $qStart, string $qEnd, bool $keepQuoteMarks) : string
Parameters
$matches : array<string|int, mixed>
$qStart : string
$qEnd : string
$keepQuoteMarks : bool
Return values
string

reconstituteText()

Return sentence temporary markup to original

reconstituteText(string $newText, string $citeLocalisation, array<string|int, mixed> $flags, array<string|int, mixed> $quotes) : string
Parameters
$newText : string
$citeLocalisation : string
$flags : array<string|int, mixed>
$quotes : array<string|int, mixed>
Return values
string

debugPrint()

Print an array prettily for debugging purposes

debugPrint(array<string|int, mixed> $array) : void
Parameters
$array : array<string|int, mixed>

        
On this page

Search results