Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[frus] Restore link from page image view to document #237

Open
joewiz opened this issue Jun 10, 2016 · 2 comments
Open

[frus] Restore link from page image view to document #237

joewiz opened this issue Jun 10, 2016 · 2 comments

Comments

@joewiz
Copy link
Member

joewiz commented Jun 10, 2016

On the old hsg, page image views had a sidebar that provided a link to the possible document(s) that the page contains. For example, page 510 of frus1952-54v07p1 (visible at https://history.state.gov/historicaldocuments/frus1952-54v07p1/pg_510) contains the end of document 213 and the beginning of document 214. The sidebar:

screen shot 2016-06-10 at 5 33 10 pm

The new site lacks this sidebar. The code we used to look up the possible documents belonging to a page number reference was:

declare function docs:sideright-documents($page) {
    let $scope := $page//tei:div[@type='document']
    let $sidebar :=
        if ($scope) then
            <div class="bordered resources">
                <h3>Show full text of the document{if (count($scope) gt 1) then 's' else ()} on this page</h3>
                <ul>{
                    for $div in $scope
                    let $xmlid := $div/@xml:id/string()
                    let $n := $div/@n/string()
                    order by $xmlid
                    return
                        <li><a href="/{$docs:view-name}/{$volume}/{$xmlid}">Document {$n}</a></li>
                }</ul>
            </div>
        else ()
    return $sidebar
};

The calling function supplies the $page argument, containing a reconstructed fragment of the text between the two <pb> milestones:

let $this-page := $target (: the <pb> requested from the URL :)
let $next-page := $this-page/following::tei:pb[1]
let $next-page-starts-document := $next-page/preceding-sibling::element()[1][self::tei:head] or (not($next-page/preceding-sibling::element()) and $next-page/parent::tei:div/@type = 'document')
let $fragment-ending-this-page :=
    if ($next-page-starts-document) then
        $next-page/parent::tei:div
    else 
        $next-page
let $page := 
    util:parse(util:get-fragment-between($this-page, $fragment-ending-this-page, true(), true()))
@plutonik-a
Copy link
Contributor

@joewiz
Question about the requirements of this issue:

  1. The sidebar in https://history.state.gov/historicaldocuments/frus1952-54v07p1/pg_510
    <pb xml:id="pg_510" n="510" facs="0544"/>
    provides the links to
    https://history.state.gov/historicaldocuments/frus1952-54v07p1/d213
    and
    https://history.state.gov/historicaldocuments/frus1952-54v07p1/d214.
    or
  2. The sidebar provides "buttons" to display the content between <pb xml:id="pg_510" n="510" facs="0544"/> and <pb xml:id="pg_511" n="511" facs="0545"/> etc. at the end of the page, under the image.

It's unclear to me, because I can't see a working example anymore.
By the way, what does $docs:view-name in the <a> tag stand for in your code example?

@joewiz
Copy link
Member Author

joewiz commented Jun 30, 2016

@plutonik-a Good question. The sidebar in https://history.state.gov/historicaldocuments/frus1952-54v07p1/pg_510 should provide links to d213 and d214. Perhaps a clearer label for the sidebar should be: "Documents shown on this page."

Sorry, in the code sample from the old site $docs:view-name resolved to /historicaldocuments/.

@plutonik-a plutonik-a self-assigned this Aug 8, 2016
@plutonik-a plutonik-a removed their assignment Aug 17, 2016
@joewiz joewiz removed the question label Mar 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants