frabbitry / Ulysses

The repo for the Ulysses project.
2 stars 0 forks source link

Gazetteer and Ulysses section reading layouts, highlighting places #18

Open ebeshero opened 5 years ago

ebeshero commented 5 years ago

For the organization of place info that you're developing the word for that is a gazetteer! There's a place-referencing project in Pittsburgh called http://gazetteer.obdurodon.org, that'll be presented on Wednesday--go take a look. :-)

@KSD32 and I are working on a little XSLT to try making something to help illuminate location references in each of the sections. We have an idea to make this work much like the graphics pages do.

Currently, on this page, we see a sorted alphabetical list of all the place names on the left, and on click, we should be able to pull up available information about that place: http://ulysses.newtfire.org/TheWanderingsOfUlysses.html. What we're thinking is that on a reading view of a section in Wanderings, we get that same list on the left, and on click of the place names, we bring into view the specific passages that reference the place. Sometimes there will be more than one "location span" per place, so we'll want to produce a list using distinct values, and then producing sublists with links to the multiple passages in the text.

This can basically work with modal XSLT, to output a listing of places in one panel, with internal page links <a href="#id"> and target @id's seeded in <span id="id"> throughout the output document.

frabbitry commented 5 years ago

That would be great! I thought of using XSLT to do something with the location pages themselves, but there's enough about those that we need to hand-code that I thought that XSLT wasn't worth it. If XSLT can work with the chapter pages, then that's great.

The list of locations on the side of those section pages is an SSI called locationsInUlysses.html (and you can find it in the HTML folder of GitHub).

ebeshero commented 5 years ago

@frabbitry Here's what we just did (@KSD32 has just pushed the code): We took distinct values of all the location/@name in a given portion of Ulysses (we ran this on "Wandering Rocks" which has the most locations tagged, but the XSLT can run over any of the Ulysses sections). We output this to go in a <div class="sitenav"> so that this would match up with your code over in graphics pages (hoping the CSS would work the same, but evidently it doesn't quite...).

We have a distinct list of names, and then sublists for where these appear in multiple places in the document. We actually output the first 120 characters of each location snippet of text from Ulysses so those should be visible in the sitenav panel once we get this working.

In the body of the text of a Ulysses section, we output <span class="location" id="{locationID}{CountinFile}"> to create targets for the links we constructed in the <div class="sitenav"> section. Oh! and we constructed IDs in a brilliant and wonderful way: We used the XPath replace() function to remove white spaces and apostrophes to smush multiple words together, and we also output a position number to indicate the location in the document. For most locations, they are followed by the number 1, because they only appear once, but a few appear more than once so they'll get a 2 or a 3, as in CollegeGreen1, CollegeGreen2, CollegeGreen3.

Okay, so here's what I'm thinking-- your own list of locations on the graphics pages could use distinct identifiers, so they can be turned into clickable links pointing to @id values planted on graphics and info you want to share about each place. I propose we use Kiara's IDs, and just stick the number 1 after them . What do you think?

To deliver these ID values for EVERYTHING you coded, write XSLT (or XQuery) over the collection of yoru XML files, and use the same function we did. That function involves removing apostrophes and white spaces, which is slightly tricky: We defined a variable first to hold these as a regex, and then called the variable in the replace() function:

<xsl:variable name="apos" select='"[&apos; ]"'/>

Later we invoke that with:

replace(@name, $apos, '')

(or really, if you take distinct-values() of all the //location/@name:

replace(current(), $apos, '')

If you add the number 1 at the end, your identifier will be identical and linkable to a passage in the Ulysses text--the first place where this location is mentioned in a given section that you coded.

ebeshero commented 5 years ago

@frabbitry @KSD32 XSLT code is here: https://github.com/frabbitry/Ulysses/blob/dddd186ff7f164e6b6ab1c48f2b01436da1bb2ff/XSLT/uni.xsl Take a look at how we're processing <location> elements in the template match on the document node (to generate the sidenav div and lists), and down in the template rule matching on location elements for the body of the document.

ebeshero commented 5 years ago

What's very cool about this is that on click on the location list on one side, you should be able to treat the text of Ulysses itself as your gazetteer!

frabbitry commented 5 years ago

@ebeshero this looks pretty cool and useful. I might have to sit down with either you or @KSD32 to see what's going on with it. Honestly, XSLT is not my strong suit. I am also curious to know why the CSS isn't working...this is probably something that we should talk about today at our project team meeting.

ebeshero commented 5 years ago

@frabbitry No worries--We didn't spend a long time on XSLT this spring (since our emphasis has been XQuery), but the fall course takes a deep dive into XSLT, which is optimized for transforming and remixing whole documents. I can walk you through it. We didn't spend any time on the CSS (just sorta hoped it might work), but there's clearly a mismatch, possibly in the way we set the attribute values or in the way that sitenav sidebar is being styled...I think we'll figure it out on closer inspection of your graphics page alongside this one. We may need to change something in the XSLT, or update the CSS...

frabbitry commented 5 years ago

@ebeshero Sounds good I'll find you in your office after our project meeting ends. Thanks!

ebeshero commented 5 years ago

@frabbitry @KSD32 @BMT45 I think we've figured out how to get this working on the reading views! Take a look at Wandering Rocks: http://ulysses.newtfire.org/WanderingRoc.html

I did widen the sidenav bar a bit, and narrowed the main div to compensate following your way of doing it in the project CSS. You'll see slight differences on your graphics pages: http://ulysses.newtfire.org/TheWanderingsOfUlysses.html

@KSD32 is busy prepping/posting the rest of the HTML reading views!