Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F85263322
bfe_publi_info.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Sep 27, 21:18
Size
2 KB
Mime Type
text/x-python
Expires
Sun, Sep 29, 21:18 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
21151237
Attached To
R3600 invenio-infoscience
bfe_publi_info.py
View Options
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your option) any later version.
##
## Invenio is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with Invenio; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
"""BibFormat element - Prints publcation information and link to ejournal
"""
__revision__
=
"$Id$"
from
urllib
import
quote
import
cgi
def
format_element
(
bfo
):
"""
Displays inline publication information with html link to ejournal
(when available).
"""
out
=
''
publication_info
=
bfo
.
field
(
'909C4'
)
if
publication_info
==
""
:
return
""
journal_source
=
publication_info
.
get
(
'p'
)
journal
=
bfo
.
kb
(
'ejournals'
,
journal_source
)
volume
=
publication_info
.
get
(
'v'
)
year
=
publication_info
.
get
(
'y'
)
number
=
publication_info
.
get
(
'n'
)
pages
=
publication_info
.
get
(
'c'
)
if
journal
is
not
None
:
journal
=
cgi
.
escape
(
journal
)
if
volume
is
not
None
:
volume
=
cgi
.
escape
(
volume
)
if
year
is
not
None
:
year
=
cgi
.
escape
(
year
)
if
number
is
not
None
:
number
=
cgi
.
escape
(
number
)
if
pages
is
not
None
:
pages
=
cgi
.
escape
(
pages
)
if
journal
!=
''
and
volume
is
not
None
:
out
+=
'<a href="https://cdsweb.cern.ch/ejournals.py?publication='
out
+=
quote
(
journal_source
)
out
+=
'&volume='
+
volume
out
+=
'&year='
+
year
out
+=
'&page='
page
=
pages
.
split
(
'-'
)
# get first page from range
if
len
(
page
)
>
0
:
out
+=
page
[
0
]
out
+=
'">
%(journal)s
:
%(volume)s
%(year)s
%(page)s
</a>'
%
{
'journal'
:
journal
,
'volume'
:
volume
,
'year'
:
year
,
'page'
:
pages
}
else
:
out
+=
journal_source
+
': '
if
volume
is
not
None
:
out
+=
volume
if
year
is
not
None
:
out
+=
' ('
+
year
+
') '
if
number
is
not
None
:
out
+=
'no. '
+
number
+
', '
if
pages
is
not
None
:
out
+=
'pp. '
+
pages
return
out
def
escape_values
(
bfo
):
"""
Called by BibFormat in order to check if output of this element
should be escaped.
"""
return
0
Event Timeline
Log In to Comment