I'm the maintainer of the Name module and I was wondering if you would be interested given feedback on a way to handle methods of formatting user names in relation to an indexed array of name components, given/middle/family/generational suffix/credentials.

#756634: Omit commas? / Roadmap for module development

Potentially you could look at integrating functionality of the two modules latter, removing the need for biblio to also handle name formatting.

Either way, your experience with formatting names & the i18n related issues would be invaluable.

Thanks

Comments

rjerome’s picture

Hi Alan,

I wasn't aware of your module until now. I haven't looked at it, but I presume it uses CCK? This might be interesting for my 7.x release, since I am looking at moving completely to fields in 7.x-2.x.

Author name handling/formatting is without a doubt one of the biggest headaches in my module as well. One of the differences in my case though is that every citation format also comes with it's own author formatting rules. I have recently writen a CSL processor class library in PHP to handle all the formatting of citations including author names. The CSL format is used in both Zotero and Mendeley and I expect more will come on board soon. Basically it's an XML file which describes the formatting desired, the processor reads the xml file and the data to be formatted and then based on it's contents, builds a class stucture appropriate for the desired format. Obviously the whole processor would be overkill for you application, but the name portions might be useful.

Regards,

Ron.

alan d.’s picture

Thanks, I'll have a look.

rjerome’s picture

What I forgot to mention is... my CSL processor (if that's what you were going to look at) is not publicly available yet, but it should be in a beta release of 6.x-2.x in a few weeks.

Ron.

alan d.’s picture

Just a update, I went in a different direction and implemented a parsing engine based similar to the PHP date() function. It has made it possible to create some fairly complex rules for such a simple task :)

This may have made things go in a different direction to what you want to take biblio in.

FYI the tokens are:

  $tokens = array(
    't' => t('Title'),
    'g' => t('Given name'),
    'm' => t('Middle name(s)'),
    'f' => t('Family name'),
    'c' => t('Credentials'),
    's' => t('Generational suffix'),
    'x' => t('First letter given'),
    'y' => t('First letter middle'),
    'z' => t('First letter family'),
    'e' => t('Conditional: Either the given or family name. Given name is given preference.'),
    'E' => t('Conditional: Either the given or family name. Family name is given preference.'),
    'i' => t('Separator 1'),
    'j' => t('Separator 2'),
    'k' => t('Separator 3'),
    '\\' => t('You can prevent a character in the format string from being expanded by escaping it with a preceding backslash.'),
    'L' => t('Modifier: Converts the next token to all lowercase.'),
    'U' => t('Modifier: Converts the next token to all uppercase.'),
    'F' => t('Modifier: Converts the first letter to uppercase.'),
    'G' => t('Modifier: Converts the first letter of ALL words to uppercase.'),
    'T' => t('Modifier: Trims whitespace around the next token.'),
    'S' => t('Modifier: Ensures that the next token is safe for the display.'),

    '+' => t('Conditional: Insert the token if both the surrounding tokens are not empty.'),
    '-' => t('Conditional: Insert the token if the previous token is not empty'),
    '~' => t('Conditional: Insert the token if the previous token is empty'),
    '=' => t('Conditional: Insert the token if the next token is not empty.'),
    '^' => t('Conditional: Insert the token if the next token is empty.'),

    '|' => t('Conditional: Uses the previous token unless empty, otherwise it uses this token.'),

    '(' => t('Group: Start of token grouping.'),
    ')' => t('Group: End of token grouping.'),
  );

And an example of one of the default token strings:

(((((t+ g)+ m)+ f)+ s)+ c)

I have a D7 version released, but the namedb submodule will probably be moved into its' own project as the name dump (names from US census data) makes the project a bit to large for most users, but I do love the weighted name auto-complete ;)

If you are still interested, let me know what things are required for integration, or I can add you as a maintainer. I'm on holiday for a while (only another 6 months to go) so the latter option would ensure a faster turn-around on issues if you need to modify the module.

Cheers

rjerome’s picture

Thanks for the update Alan,

I've installed and tested the 7.x version and I can see where this could definitely be integrated into Biblio. There are only a couple of issues I haven't quite wrapped my head around WRT fields in core... I currently have a "author" table where each author is only entered once (regardless of how many publications they are related to) and then a linking table between the biblio data (publications) and the author data (much the same way a single taxonomy term can be associated with multiple nodes). At this point I'm not sure how I could recreate that using your name field.

Ron.

alan d.’s picture

The field is based on a FAPI element, so it shouldn't matter if you use fields or the FAPI directly. The big question is that if you are working on the FAPI layer, does this actually make things easier using this module? It has been a long time since I had anything to do with the biblio module, so I am not familiar with the code.

The core developers seem to be pushing for fields rather than FAPI node additions (see the new node example), albeit IMHO I do not think that Drupal is ready for it yet. No way to locks for fields, etc. But this could mean that the author could be a bundle with a field. Adds a bit of complication though. I've only tried with file based bundle types, and had issues due to the additional complications of these and there were a number of bugs in File field introduced by late changes to the fapi code.

As a side note, the database schema in fields are locked down in Drupal 7, so this makes things a bit easier when handling db tasks. Drupal 6 supported dynamic columns. So this means that all of the components in name are 255 varchar, and soft limits are being set to restrict the size and available columns.

liam morland’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

This version is no longer maintained. If this issue is still relevant to the Drupal 7 version, please re-open and provide details.