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

Allow personname related elements #91

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions geekodoc/rng/2_5.2/geekodoc-v2.rnc
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ include "db52itsxi.rnc"
db.guisubmenu = notAllowed
db.hardware = notAllowed
# db.holder = notAllowed
db.honorific = notAllowed
# db.honorific = notAllowed
# db.imagedata = notAllowed
# db.imageobject = notAllowed
db.imageobjectco = notAllowed
Expand Down Expand Up @@ -349,7 +349,7 @@ include "db52itsxi.rnc"
db.label = notAllowed
# db.legalnotice = notAllowed
db.lhs = notAllowed
db.lineage = notAllowed
# db.lineage = notAllowed
db.lineannotation = notAllowed
# db.link = notAllowed
# db.listitem = notAllowed
Expand Down Expand Up @@ -1442,17 +1442,24 @@ include "db52itsxi.rnc"
}

# personname
# Issue #83: Allow givenname, lineage, and honorific
div {
# Removed text
db.personname =
## The personal name of an individual
element personname {
db.personname.attlist,
(db.honorific
| db.firstname
| db.surname
| db.lineage
| db.othername)+
( (db.honorific
| db.firstname
| db.surname
| db.lineage
| db.othername)+
| (db.honorific
| db.givenname
| db.surname
| db.lineage
| db.othername)+
)
Comment on lines +1452 to +1462
Copy link

@ghost ghost Sep 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it helpful to have + at the end? I guess the question is whether e.g. if your last name is something Spanish, would you write <surname>Garcia</surname><surname>Lopez</surname> or <surname>Garcia Lopez</surname>? I guess it would be the latter, because that's not just less markup but also preempts unwanted name reordering.

Do you think this might work? (It's a bit of an issue that this codifies an order, but I don't know if that can be avoided.)

Suggested change
( (db.honorific
| db.firstname
| db.surname
| db.lineage
| db.othername)+
| (db.honorific
| db.givenname
| db.surname
| db.lineage
| db.othername)+
)
( db.honorific?,
db.givenname?,
db.othername?,
db.surname,
db.lineage?)
)

Copy link
Contributor Author

@tomschr tomschr Sep 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it helpful to have + at the end?

It's not from me, it's DocBook's content model for personname (minus the db._text pattern):

Original content model for personname in DocBook 5
db.personname =
    ## The personal name of an individual
    element personname {
      db.personname.attlist,
     (db._text
       | (db.honorific
          | db.firstname
          | db.surname
          | db.lineage
          | db.othername)+
       | (db.honorific
          | db.givenname
          | db.surname
          | db.lineage
          | db.othername)+)
    }

The reason for that was to use DocBook's own content model.

I guess the question is whether e.g. if your last name is something Spanish, would you write <surname>Garcia</surname><surname>Lopez</surname> or <surname>Garcia Lopez</surname>?

Names are complicated. DocBook's markup is useful for maybe ~80-90% of all names. Not all names can be appropriately marked up. For example, some Gaelic names are even more difficult for DocBook.

Back to your question: I'm not familiar with Spanish names. It probably depends a bit on how the last name (or surname) is perceived. Are both parts independent from each other? Or are they an integral part and can't be separated? I don't know. 🤷‍♂️

Do you think this might work? (It's a bit of an issue that this codifies an order, but I don't know if that can be avoided.)

Technically, it does work. If you want to avoid an order, use the interleave pattern (&). The stylesheets picks the respective elements, see common/common.xsl, named template person.name.

If you add a @role attribute to personname, it can even pick and arrange the elements to format the name (valid values are family-given, last-first, and first-last). So the order of these elements are quite irrelevant.

}
db.person.author.contentmodel =
db.personname,
Expand Down
22 changes: 22 additions & 0 deletions tests/v2/bad/personname-with-givenname.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="geekodoc-v2-flat.rnc" type="application/relax-ng-compact-syntax"?>
<article xmlns="http://docbook.org/ns/docbook" version="5.2">
<title>Bad names</title>
<info>
<author>
<personname>
<firstname>Tux</firstname>
<givenname>Tix</givenname>
<surname>Penguin</surname>
</personname>
</author>
<author>
<personname>
<givenname>Geeko</givenname>
<givenname>Gecko</givenname>
<surname>Chamaeleon</surname>
</personname>
Comment on lines +14 to +18
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this -- "Geeko Gecko Chamaeleon" (given/given/sur) is a test case for a bad name, but "Geeko Gecko Chamaeleon jr." (given/given/sur/lineage) is a test case for a good name. Sound dodgy. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Actually one of the givenname should be firstname.

</author>
</info>
<para/>
</article>
1 change: 0 additions & 1 deletion tests/v2/good/geekodoc-v2-flat.rnc

This file was deleted.

22 changes: 22 additions & 0 deletions tests/v2/good/personname-with-givenname.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="geekodoc-v2-flat.rnc" type="application/relax-ng-compact-syntax"?>
<article xmlns="http://docbook.org/ns/docbook" version="5.2">
<title>Good names</title>
<info>
<author>
<personname>
<firstname>Tux</firstname>
<surname>Penguin</surname>
</personname>
</author>
<author>
<personname>
<givenname>Geeko</givenname>
<givenname>Gecko</givenname>
<surname>Chamaeleon</surname>
<lineage>Jr.</lineage>
</personname>
</author>
</info>
<para/>
</article>