# Return a JSONable struct of the useful keys. Keys meant to be writable
# have a true value; read-only keys have a false value.
my $struct = {};
- map { $struct->{$_} = $reading->$_ } keys( %read_write_keys );
+ map { $struct->{$_} = $reading->$_ if $reading->can( $_ ) } keys( %read_write_keys );
# Special case
- $struct->{'lexemes'} = [ $reading->lexemes ];
+ $struct->{'lexemes'} = $reading->can( 'lexemes' ) ? [ $reading->lexemes ] : [];
# Look up any words related via spelling or orthography
my $sameword = sub {
my $t = $_[0]->type;
var reltypes = {};
var readingdata = {};
-function getRelativePath() {
- return basepath;
-}
-
function getTextURL( which ) {
return basepath + textid + '/' + which;
}
}
function add_relations( callback_fn ) {
- var basepath = getRelativePath();
var textrelpath = getTextURL( 'relationships' );
$.getJSON( basepath + 'definitions', function(data) {
var rel_types = data.types.sort();
create: function(event, ui) {
$(this).data( 'relation_drawn', false );
//TODO? Err handling?
- var basepath = getRelativePath();
- var jqjson = $.getJSON( basepath + '/definitions', function(data) {
+ var jqjson = $.getJSON( basepath + 'definitions', function(data) {
var types = data.types.sort();
$.each( types, function(index, value) {
$('#rel_type').append( $('<option />').attr( "value", value ).text(value) );
var reltypes = {};
var readingdata = {};
-function getRelativePath() {
- return basepath;
-}
-
function getTextURL( which ) {
return basepath + textid + '/' + which;
}
}
function add_relations( callback_fn ) {
- var basepath = getRelativePath();
var textrelpath = getTextURL( 'relationships' );
$.getJSON( basepath + 'definitions', function(data) {
var rel_types = data.types.sort();