From 838a102a3aa4393b2f279413b898be7fcc98bdec Mon Sep 17 00:00:00 2001 From: Kelly Lockhart <2926089+kelockhart@users.noreply.github.com> Date: Tue, 20 May 2025 17:50:59 -0400 Subject: [PATCH 1/2] Added AASTeX (PSF), removed title from AASTeX --- exportsrv/formatter/cslFormat.py | 27 +++++++++++++--- exportsrv/tests/unittests/stubdata/cslTest.py | 4 ++- .../tests/unittests/test_export_service.py | 21 +++++++++---- exportsrv/views.py | 31 +++++++++++++++++++ 4 files changed, 71 insertions(+), 12 deletions(-) diff --git a/exportsrv/formatter/cslFormat.py b/exportsrv/formatter/cslFormat.py index f108ff0..0d3a187 100755 --- a/exportsrv/formatter/cslFormat.py +++ b/exportsrv/formatter/cslFormat.py @@ -46,7 +46,11 @@ def __init__(self, for_cls, csl_style, export_format=adsFormatter.unicode, journ csl_style_fullpath = os.path.realpath(__file__ + "/../../cslstyles") # load a CSL style (from the current directory) - bib_style = CitationStylesStyle(os.path.join(csl_style_fullpath + '/' + csl_style), validate=False) + # aastex-psj uses the aastex CSL file + if csl_style == 'aastex-psj': + bib_style = CitationStylesStyle(os.path.join(csl_style_fullpath + '/' + 'aastex'), validate=False) + else: + bib_style = CitationStylesStyle(os.path.join(csl_style_fullpath + '/' + csl_style), validate=False) # Create the citaproc-py bibliography, passing it the: # * CitationStylesStyle, @@ -85,25 +89,37 @@ def __update_data(self): data['container-title-short'] = encode_laTex(Format(None).get_pub_abbrev(data['bibstem'])) if data.get('DOI', None) is not None: data['DOI'] = encode_latex_doi(data['DOI']) - elif (self.csl_style == 'aastex') or (self.csl_style == 'aasj') or (self.csl_style == 'aspc'): + elif (self.csl_style == 'aastex') or (self.csl_style == 'aastex-psj') or (self.csl_style == 'aasj') or (self.csl_style == 'aspc'): # use macro (default) if self.journal_format == adsJournalFormat.macro or self.journal_format == adsJournalFormat.default: journal_macros = dict([(k, v) for k, v in current_app.config['EXPORT_SERVICE_AASTEX_JOURNAL_MACRO']]) for data in self.for_cls: + if self.csl_style == 'aastex': + # regular aastex does not include the title + tmp = data.pop('title') data['container-title'] = journal_macros.get(Format(None).get_bibstem(data['bibstem']), encode_laTex(data['container-title'])) - data['title'] = encode_laTex(data['title']) + if data.get('title') is not None: + data['title'] = encode_laTex(data['title']) if data.get('DOI', None) is not None: data['DOI'] = encode_latex_doi(data['DOI']) elif self.journal_format == adsJournalFormat.abbreviated: for data in self.for_cls: + if self.csl_style == 'aastex': + # regular aastex does not include the title + tmp = data.pop('title') data['container-title'] = encode_laTex(Format(None).get_pub_abbrev(data['bibstem'])) - data['title'] = encode_laTex(data['title']) + if data.get('title') is not None: + data['title'] = encode_laTex(data['title']) if data.get('DOI', None) is not None: data['DOI'] = encode_latex_doi(data['DOI']) elif self.journal_format == adsJournalFormat.full: for data in self.for_cls: + if self.csl_style == 'aastex': + # regular aastex does not include the title + tmp = data.pop('title') data['container-title'] = encode_laTex(data['container-title']) - data['title'] = encode_laTex(data['title']) + if data.get('title') is not None: + data['title'] = encode_laTex(data['title']) if data.get('DOI', None) is not None: data['DOI'] = encode_latex_doi(data['DOI']) # for SoPh we use journal abbreviation for some special journals only @@ -233,6 +249,7 @@ def __format_output(self, cita, biblio, bibcode, index): 'icarus': u'\\bibitem[{}({})]{{{}}} {}{}', 'soph': u'\\bibitem[{}({})]{{{}}}{}{}', 'aastex': u'\\bibitem[{}({})]{{{}}} {}{}', + 'aastex-psj': u'\\bibitem[{}({})]{{{}}} {}{}', 'aspc': u'\\bibitem[{}({})]{{{}}} {}{}', 'aasj': u'\\bibitem[{}({})]{{{}}} {}{}', 'apsj': u'{}{}{}{}{}', diff --git a/exportsrv/tests/unittests/stubdata/cslTest.py b/exportsrv/tests/unittests/stubdata/cslTest.py index 20d3109..04d72c6 100755 --- a/exportsrv/tests/unittests/stubdata/cslTest.py +++ b/exportsrv/tests/unittests/stubdata/cslTest.py @@ -1,6 +1,8 @@ # -*- coding: utf-8 -*- -data_AASTex= {'msg': 'Retrieved 23 abstracts, starting with number 1.', 'export': "\\bibitem[No author(2018)]{2018Wthr...73Q..35.} No author\\ 2018, Weather, Book reviews, 73, 1, 35. doi:10.1002/wea.3072\n\\bibitem[Fal'ko \\& Thomas(2018)]{2018TDM.....5a0201F} Fal'ko, V. \\& Thomas, C.-W.\\ 2018, 2D Materials, 2D Materials: maintaining editorial quality, 5, 1, 010201. doi:10.1088/2053-1583/aa9403\n\\bibitem[Parkin et al.(2018)]{2018Spin....877001P} Parkin, S., Chantrell, R., \\& Chang, C.-R.\\ 2018, Spin, Obituary: In Memoriam Professor Dr. Shoucheng Zhang, Consulting Editor, 8, 4, 1877001. doi:10.1142/S2010324718770015\n\\bibitem[Dessauges-Zavadsky \\& Pfenniger(2018)]{2018SAAS...38.....D} Dessauges-Zavadsky, M. \\& Pfenniger, D.\\ 2018, Millimeter Astronomy: Saas-Fee Advanced Course 38. Swiss Society for Astrophysics and Astronomy, Saas-Fee Advanced Course, Volume 38. ISBN 978-3-662-57545-1. Springer-Verlag GmbH Germany, part of Springer Nature, 2018, Millimeter Astronomy, 38. doi:10.1007/978-3-662-57546-8\n\\bibitem[Pustilnik et al.(2018)]{2018PhRvL.120b9901P} Pustilnik, M., van Heck, B., Lutchyn, R.~M., et al.\\ 2018, \\prl, Erratum: Quantum Criticality in Resonant Andreev Conduction [Phys. Rev. Lett. 119, 116802 (2017)], 120, 2, 029901. doi:10.1103/PhysRevLett.120.029901\n\\bibitem[Carton(2017)]{2017PhDT........14C} Carton, D.\\ 2017, Ph.D. Thesis, Resolving Gas-Phase Metallicity In Galaxies, Leiden University. doi:10.5281/zenodo.581221\n\\bibitem[Kohler(2017)]{2017nova.pres.2388K} Kohler, S.\\ 2017, AAS Nova Highlights, A 3D View of a Supernova Remnant, 2388. \n\\bibitem[Green(2017)]{2017CBET.4403....2G} Green, D.~W.~E.\\ 2017, Central Bureau Electronic Telegrams, Potential New Meteor Shower from Comet C/2015 D4 (Borisov), 4403, 2. \n\\bibitem[Casey(2017)]{2017ascl.soft06009C} Casey, A.~R.\\ 2017, Astrophysics Source Code Library, sick: Spectroscopic inference crank. ascl:1706.009\n\\bibitem[Siltala et al.(2017)]{2017yCat.113380453S} Siltala, J., Jetsu, L., Hackman, T., et al.\\ 2017, VizieR Online Data Catalog, VizieR Online Data Catalog: BM CVn V-band differential light curve (Siltala+, 2017), J/AN/338/453. \n\\bibitem[Waagen(2017)]{2017AAVSN.429....1W} Waagen, E.~O.\\ 2017, AAVSO Special Notice \\#429, V694 Mon (MWC 560) spectroscopy requested, 429, 1. \n\\bibitem[Yan(2017)]{2017sptz.prop13168Y} Yan, L.\\ 2017, Spitzer Proposal, Confirm the Nature of a TDE Candidate in ULIRG F01004-2237 Using Spitzer mid-IR Light Curves, 13168. \n\\bibitem[Azankpo(2017)]{2017MsT..........2A} Azankpo, S.\\ 2017, Masters Thesis, Surface Accuracy and Pointing Error Prediction of a 32 m Diameter Class Radio Astronomy Telescope, University of Stellenbosch. \n\\bibitem[Rotaru et al.(2016)]{2016emo6.rept.....R} Rotaru, A., Pteancu, M., \\& Zaharia, C.\\ 2016, http://www.astronomy.ro/forum/viewtopic.php?p=159287\\#159287 (Comments in Romanian), The penumbral Moon's eclipse form 16 september 2016. \n\\bibitem[Velasco(2016)]{2016iac..talk..872V} Velasco, S.\\ 2016, IAC Talks, Astronomy and Astrophysics Seminars from the Instituto de Astrof\\ísica de Canarias, Living on the edge: Adaptive Optics+Lucky Imaging, 872. \n\\bibitem[Liu et al.(2009)]{2009bcet.book...65L} Liu, C.~W., Alekseyev, V.~Y., Allwardt, J.~R., et al.\\ 2009, Biophysics and the Challenges of Emerging Threats, The Diversity of Nuclear Magnetic Resonance Spectroscopy, 65. doi:10.1007/978-90-481-2368-1\\_5\n\\bibitem[Mahabal et al.(2007)]{2007AAS...210.2104M} Mahabal, A.~A., Drake, A.~J., Djorgovski, S.~G., et al.\\ 2007, \\aas, Time Domain Exploration with the Palomar-QUEST Sky Survey, 210, 21.04. \n\\bibitem[. \\& .(2007)]{2007RJPh....1...35.} ., S.~N.~A. \\& ., E.~C.~O.\\ 2007, Research Journal of Physics, Analysis of Thermal Losses in the Flat-Plate Collector of a Thermosyphon Solar Water Heater, 1, 1, 35. doi:10.3923/rjp.2007.35.41\n\\bibitem[Miller(1995)]{1995ans..agar..390M} Miller, J.~L.\\ 1995, In AGARD, Spacecraft navigation requirements, 390. \n\\bibitem[Nayfeh \\& Balachandran(1995)]{1995anda.book.....N} Nayfeh, A.~H. \\& Balachandran, B.\\ 1995, , Applied nonlinear dynamics: analytical, computational and experimental methods. \n\\bibitem[Ginsparg(1988)]{1991hep.th....8028G} Ginsparg, P.\\ 1988, , Applied Conformal Field Theory, hep-th/9108028. \n\\bibitem[Khatib et al.(1983)]{1983aiaa.meetY....K} Khatib, A.~R., Ellis, J., French, J., et al.\\ 1983, AIAA, Aerospace Sciences Meeting, Autonomous navigation using lunar beacons. \n\\bibitem[Thornton et al.(2012)]{2012ddsw.rept.....T} Thornton, P.~E., Thornton, M.~M., Mayer, B.~W., et al.\\ 2012, Oak Ridge National Laboratory (ORNL) Distributed Active Archive Center for Biogeochemical Dynamics (DAAC, Daymet: Daily surface weather on a 1 km grid for North America, 1980-2008. doi:10.3334/ORNLDAAC/1219\n"} +data_AASTex= {'msg': 'Retrieved 23 abstracts, starting with number 1.', 'export': "\\bibitem[No author(2018)]{2018Wthr...73Q..35.} No author\\ 2018, Weather, 73, 1, 35. doi:10.1002/wea.3072\n\\bibitem[Fal'ko \\& Thomas(2018)]{2018TDM.....5a0201F} Fal'ko, V. \\& Thomas, C.-W.\\ 2018, 2D Materials, 5, 1, 010201. doi:10.1088/2053-1583/aa9403\n\\bibitem[Parkin et al.(2018)]{2018Spin....877001P} Parkin, S., Chantrell, R., \\& Chang, C.-R.\\ 2018, Spin, 8, 4, 1877001. doi:10.1142/S2010324718770015\n\\bibitem[Dessauges-Zavadsky \\& Pfenniger(2018)]{2018SAAS...38.....D} Dessauges-Zavadsky, M. \\& Pfenniger, D.\\ 2018, Millimeter Astronomy: Saas-Fee Advanced Course 38. Swiss Society for Astrophysics and Astronomy, Saas-Fee Advanced Course, Volume 38. ISBN 978-3-662-57545-1. Springer-Verlag GmbH Germany, part of Springer Nature, 2018, 38. doi:10.1007/978-3-662-57546-8\n\\bibitem[Pustilnik et al.(2018)]{2018PhRvL.120b9901P} Pustilnik, M., van Heck, B., Lutchyn, R.~M., et al.\\ 2018, \\prl, 120, 2, 029901. doi:10.1103/PhysRevLett.120.029901\n\\bibitem[Carton(2017)]{2017PhDT........14C} Carton, D.\\ 2017, Ph.D. Thesis, Leiden University. doi:10.5281/zenodo.581221\n\\bibitem[Kohler(2017)]{2017nova.pres.2388K} Kohler, S.\\ 2017, AAS Nova Highlights, 2388. \n\\bibitem[Green(2017)]{2017CBET.4403....2G} Green, D.~W.~E.\\ 2017, Central Bureau Electronic Telegrams, 4403, 2. \n\\bibitem[Casey(2017)]{2017ascl.soft06009C} Casey, A.~R.\\ 2017, Astrophysics Source Code Library. ascl:1706.009\n\\bibitem[Siltala et al.(2017)]{2017yCat.113380453S} Siltala, J., Jetsu, L., Hackman, T., et al.\\ 2017, VizieR Online Data Catalog, J/AN/338/453. \n\\bibitem[Waagen(2017)]{2017AAVSN.429....1W} Waagen, E.~O.\\ 2017, AAVSO Special Notice \\#429, 429, 1. \n\\bibitem[Yan(2017)]{2017sptz.prop13168Y} Yan, L.\\ 2017, Spitzer Proposal, 13168. \n\\bibitem[Azankpo(2017)]{2017MsT..........2A} Azankpo, S.\\ 2017, Masters Thesis, University of Stellenbosch. \n\\bibitem[Rotaru et al.(2016)]{2016emo6.rept.....R} Rotaru, A., Pteancu, M., \\& Zaharia, C.\\ 2016, http://www.astronomy.ro/forum/viewtopic.php?p=159287\\#159287 (Comments in Romanian). \n\\bibitem[Velasco(2016)]{2016iac..talk..872V} Velasco, S.\\ 2016, IAC Talks, Astronomy and Astrophysics Seminars from the Instituto de Astrof\\ísica de Canarias, 872. \n\\bibitem[Liu et al.(2009)]{2009bcet.book...65L} Liu, C.~W., Alekseyev, V.~Y., Allwardt, J.~R., et al.\\ 2009, Biophysics and the Challenges of Emerging Threats, 65. doi:10.1007/978-90-481-2368-1\\_5\n\\bibitem[Mahabal et al.(2007)]{2007AAS...210.2104M} Mahabal, A.~A., Drake, A.~J., Djorgovski, S.~G., et al.\\ 2007, \\aas, 210, 21.04. \n\\bibitem[. \\& .(2007)]{2007RJPh....1...35.} ., S.~N.~A. \\& ., E.~C.~O.\\ 2007, Research Journal of Physics, 1, 1, 35. doi:10.3923/rjp.2007.35.41\n\\bibitem[Miller(1995)]{1995ans..agar..390M} Miller, J.~L.\\ 1995, In AGARD, 390. \n\\bibitem[Nayfeh \\& Balachandran(1995)]{1995anda.book.....N} Nayfeh, A.~H. \\& Balachandran, B.\\ 1995, . \n\\bibitem[Ginsparg(1988)]{1991hep.th....8028G} Ginsparg, P.\\ 1988, , hep-th/9108028. \n\\bibitem[Khatib et al.(1983)]{1983aiaa.meetY....K} Khatib, A.~R., Ellis, J., French, J., et al.\\ 1983, AIAA, Aerospace Sciences Meeting. \n\\bibitem[Thornton et al.(2012)]{2012ddsw.rept.....T} Thornton, P.~E., Thornton, M.~M., Mayer, B.~W., et al.\\ 2012, Oak Ridge National Laboratory (ORNL) Distributed Active Archive Center for Biogeochemical Dynamics (DAAC. doi:10.3334/ORNLDAAC/1219\n"} + +data_AASTex_PSJ= {'msg': 'Retrieved 23 abstracts, starting with number 1.', 'export': "\\bibitem[No author(2018)]{2018Wthr...73Q..35.} No author\\ 2018, Weather, Book reviews, 73, 1, 35. doi:10.1002/wea.3072\n\\bibitem[Fal'ko \\& Thomas(2018)]{2018TDM.....5a0201F} Fal'ko, V. \\& Thomas, C.-W.\\ 2018, 2D Materials, 2D Materials: maintaining editorial quality, 5, 1, 010201. doi:10.1088/2053-1583/aa9403\n\\bibitem[Parkin et al.(2018)]{2018Spin....877001P} Parkin, S., Chantrell, R., \\& Chang, C.-R.\\ 2018, Spin, Obituary: In Memoriam Professor Dr. Shoucheng Zhang, Consulting Editor, 8, 4, 1877001. doi:10.1142/S2010324718770015\n\\bibitem[Dessauges-Zavadsky \\& Pfenniger(2018)]{2018SAAS...38.....D} Dessauges-Zavadsky, M. \\& Pfenniger, D.\\ 2018, Millimeter Astronomy: Saas-Fee Advanced Course 38. Swiss Society for Astrophysics and Astronomy, Saas-Fee Advanced Course, Volume 38. ISBN 978-3-662-57545-1. Springer-Verlag GmbH Germany, part of Springer Nature, 2018, Millimeter Astronomy, 38. doi:10.1007/978-3-662-57546-8\n\\bibitem[Pustilnik et al.(2018)]{2018PhRvL.120b9901P} Pustilnik, M., van Heck, B., Lutchyn, R.~M., et al.\\ 2018, \\prl, Erratum: Quantum Criticality in Resonant Andreev Conduction [Phys. Rev. Lett. 119, 116802 (2017)], 120, 2, 029901. doi:10.1103/PhysRevLett.120.029901\n\\bibitem[Carton(2017)]{2017PhDT........14C} Carton, D.\\ 2017, Ph.D. Thesis, Resolving Gas-Phase Metallicity In Galaxies, Leiden University. doi:10.5281/zenodo.581221\n\\bibitem[Kohler(2017)]{2017nova.pres.2388K} Kohler, S.\\ 2017, AAS Nova Highlights, A 3D View of a Supernova Remnant, 2388. \n\\bibitem[Green(2017)]{2017CBET.4403....2G} Green, D.~W.~E.\\ 2017, Central Bureau Electronic Telegrams, Potential New Meteor Shower from Comet C/2015 D4 (Borisov), 4403, 2. \n\\bibitem[Casey(2017)]{2017ascl.soft06009C} Casey, A.~R.\\ 2017, Astrophysics Source Code Library, sick: Spectroscopic inference crank. ascl:1706.009\n\\bibitem[Siltala et al.(2017)]{2017yCat.113380453S} Siltala, J., Jetsu, L., Hackman, T., et al.\\ 2017, VizieR Online Data Catalog, VizieR Online Data Catalog: BM CVn V-band differential light curve (Siltala+, 2017), J/AN/338/453. \n\\bibitem[Waagen(2017)]{2017AAVSN.429....1W} Waagen, E.~O.\\ 2017, AAVSO Special Notice \\#429, V694 Mon (MWC 560) spectroscopy requested, 429, 1. \n\\bibitem[Yan(2017)]{2017sptz.prop13168Y} Yan, L.\\ 2017, Spitzer Proposal, Confirm the Nature of a TDE Candidate in ULIRG F01004-2237 Using Spitzer mid-IR Light Curves, 13168. \n\\bibitem[Azankpo(2017)]{2017MsT..........2A} Azankpo, S.\\ 2017, Masters Thesis, Surface Accuracy and Pointing Error Prediction of a 32 m Diameter Class Radio Astronomy Telescope, University of Stellenbosch. \n\\bibitem[Rotaru et al.(2016)]{2016emo6.rept.....R} Rotaru, A., Pteancu, M., \\& Zaharia, C.\\ 2016, http://www.astronomy.ro/forum/viewtopic.php?p=159287\\#159287 (Comments in Romanian), The penumbral Moon's eclipse form 16 september 2016. \n\\bibitem[Velasco(2016)]{2016iac..talk..872V} Velasco, S.\\ 2016, IAC Talks, Astronomy and Astrophysics Seminars from the Instituto de Astrof\\ísica de Canarias, Living on the edge: Adaptive Optics+Lucky Imaging, 872. \n\\bibitem[Liu et al.(2009)]{2009bcet.book...65L} Liu, C.~W., Alekseyev, V.~Y., Allwardt, J.~R., et al.\\ 2009, Biophysics and the Challenges of Emerging Threats, The Diversity of Nuclear Magnetic Resonance Spectroscopy, 65. doi:10.1007/978-90-481-2368-1\\_5\n\\bibitem[Mahabal et al.(2007)]{2007AAS...210.2104M} Mahabal, A.~A., Drake, A.~J., Djorgovski, S.~G., et al.\\ 2007, \\aas, Time Domain Exploration with the Palomar-QUEST Sky Survey, 210, 21.04. \n\\bibitem[. \\& .(2007)]{2007RJPh....1...35.} ., S.~N.~A. \\& ., E.~C.~O.\\ 2007, Research Journal of Physics, Analysis of Thermal Losses in the Flat-Plate Collector of a Thermosyphon Solar Water Heater, 1, 1, 35. doi:10.3923/rjp.2007.35.41\n\\bibitem[Miller(1995)]{1995ans..agar..390M} Miller, J.~L.\\ 1995, In AGARD, Spacecraft navigation requirements, 390. \n\\bibitem[Nayfeh \\& Balachandran(1995)]{1995anda.book.....N} Nayfeh, A.~H. \\& Balachandran, B.\\ 1995, , Applied nonlinear dynamics: analytical, computational and experimental methods. \n\\bibitem[Ginsparg(1988)]{1991hep.th....8028G} Ginsparg, P.\\ 1988, , Applied Conformal Field Theory, hep-th/9108028. \n\\bibitem[Khatib et al.(1983)]{1983aiaa.meetY....K} Khatib, A.~R., Ellis, J., French, J., et al.\\ 1983, AIAA, Aerospace Sciences Meeting, Autonomous navigation using lunar beacons. \n\\bibitem[Thornton et al.(2012)]{2012ddsw.rept.....T} Thornton, P.~E., Thornton, M.~M., Mayer, B.~W., et al.\\ 2012, Oak Ridge National Laboratory (ORNL) Distributed Active Archive Center for Biogeochemical Dynamics (DAAC, Daymet: Daily surface weather on a 1 km grid for North America, 1980-2008. doi:10.3334/ORNLDAAC/1219\n"} data_Icarus= {'msg': 'Retrieved 23 abstracts, starting with number 1.', 'export': u"\\bibitem[No author(2018)]{2018Wthr...73Q..35.} No author\\ 2018.\\ Book reviews.\\ Weather 73, 35–35. doi:10.1002/wea.3072\n\\bibitem[Fal'ko and Thomas(2018)]{2018TDM.....5a0201F} Fal'ko, V., Thomas, C.-W.\\ 2018.\\ 2D Materials: maintaining editorial quality.\\ 2D Materials 5. doi:10.1088/2053-1583/aa9403\n\\bibitem[Parkin et al.(2018)]{2018Spin....877001P} Parkin, S., Chantrell, R., Chang, C.-R.\\ 2018.\\ Obituary: In Memoriam Professor Dr. Shoucheng Zhang, Consulting Editor.\\ Spin 8. doi:10.1142/S2010324718770015\n\\bibitem[Dessauges-Zavadsky and Pfenniger(2018)]{2018SAAS...38.....D} Dessauges-Zavadsky, M., Pfenniger, D.\\ 2018.\\ Millimeter Astronomy.\\ Millimeter Astronomy: Saas-Fee Advanced Course 38. Swiss Society for Astrophysics and Astronomy, Saas-Fee Advanced Course, Volume 38. ISBN 978-3-662-57545-1. Springer-Verlag GmbH Germany, part of Springer Nature, 2018 38. doi:10.1007/978-3-662-57546-8\n\\bibitem[Pustilnik et al.(2018)]{2018PhRvL.120b9901P} Pustilnik, M., van Heck, B., Lutchyn, R.~M., Glazman, L.~I.\\ 2018.\\ Erratum: Quantum Criticality in Resonant Andreev Conduction [Phys. Rev. Lett. 119, 116802 (2017)].\\ Physical Review Letters 120. doi:10.1103/PhysRevLett.120.029901\n\\bibitem[Carton(2017)]{2017PhDT........14C} Carton, D.\\ 2017.\\ Resolving Gas-Phase Metallicity In Galaxies.\\ Ph.D. Thesis. doi:10.5281/zenodo.581221\n\\bibitem[Kohler(2017)]{2017nova.pres.2388K} Kohler, S.\\ 2017.\\ A 3D View of a Supernova Remnant.\\ AAS Nova Highlights.\n\\bibitem[Green(2017)]{2017CBET.4403....2G} Green, D.~W.~E.\\ 2017.\\ Potential New Meteor Shower from Comet C/2015 D4 (Borisov).\\ Central Bureau Electronic Telegrams 4403.\n\\bibitem[Casey(2017)]{2017ascl.soft06009C} Casey, A.~R.\\ 2017.\\ sick: Spectroscopic inference crank.\\ Astrophysics Source Code Library. ascl:1706.009\n\\bibitem[Siltala et al.(2017)]{2017yCat.113380453S} Siltala, J. and 12 colleagues 2017.\\ VizieR Online Data Catalog: BM CVn V-band differential light curve (Siltala+, 2017).\\ VizieR Online Data Catalog.\n\\bibitem[Waagen(2017)]{2017AAVSN.429....1W} Waagen, E.~O.\\ 2017.\\ V694 Mon (MWC 560) spectroscopy requested.\\ AAVSO Special Notice \\#429 429.\n\\bibitem[Yan(2017)]{2017sptz.prop13168Y} Yan, L.\\ 2017.\\ Confirm the Nature of a TDE Candidate in ULIRG F01004-2237 Using Spitzer mid-IR Light Curves.\\ Spitzer Proposal, 13168.\n\\bibitem[Azankpo(2017)]{2017MsT..........2A} Azankpo, S.\\ 2017.\\ Surface Accuracy and Pointing Error Prediction of a 32 m Diameter Class Radio Astronomy Telescope.\\ Masters Thesis, 2.\n\\bibitem[Rotaru et al.(2016)]{2016emo6.rept.....R} Rotaru, A., Pteancu, M., Zaharia, C.\\ 2016.\\ The penumbral Moon's eclipse form 16 september 2016.\\ http://www.astronomy.ro/forum/viewtopic.php?p=159287\\#159287 (Comments in Romanian).\n\\bibitem[Velasco(2016)]{2016iac..talk..872V} Velasco, S.\\ 2016.\\ Living on the edge: Adaptive Optics+Lucky Imaging.\\ IAC Talks, Astronomy and Astrophysics Seminars from the Instituto de Astrof\\ísica de Canarias.\n\\bibitem[Liu et al.(2009)]{2009bcet.book...65L} Liu, C.~W. and 16 colleagues 2009.\\ The Diversity of Nuclear Magnetic Resonance Spectroscopy.\\ Biophysics and the Challenges of Emerging Threats 65. doi:10.1007/978-90-481-2368-1\\_5\n\\bibitem[Mahabal et al.(2007)]{2007AAS...210.2104M} Mahabal, A.~A. and 13 colleagues 2007.\\ Time Domain Exploration with the Palomar-QUEST Sky Survey.\\ American Astronomical Society Meeting Abstracts \\#210.\n\\bibitem[. and .(2007)]{2007RJPh....1...35.} ., S.~N.~A., ., E.~C.~O.\\ 2007.\\ Analysis of Thermal Losses in the Flat-Plate Collector of a Thermosyphon Solar Water Heater.\\ Research Journal of Physics 1, 35–41. doi:10.3923/rjp.2007.35.41\n\\bibitem[Miller(1995)]{1995ans..agar..390M} Miller, J.~L.\\ 1995.\\ Spacecraft navigation requirements.\\ In AGARD, 390–405.\n\\bibitem[Nayfeh and Balachandran(1995)]{1995anda.book.....N} Nayfeh, A.~H., Balachandran, B.\\ 1995.\\ Applied nonlinear dynamics: analytical, computational and experimental methods.\\ Wiley series in nonlinear science, New York; Chichester: Wiley, |c1995.\n\\bibitem[Ginsparg(1988)]{1991hep.th....8028G} Ginsparg, P.\\ 1988.\\ Applied Conformal Field Theory.\\ arXiv e-prints.\n\\bibitem[Khatib et al.(1983)]{1983aiaa.meetY....K} Khatib, A.~R., Ellis, J., French, J., Null, G., Yunck, T., Wu, S.\\ 1983.\\ Autonomous navigation using lunar beacons.\\ AIAA, Aerospace Sciences Meeting.\n\\bibitem[Thornton et al.(2012)]{2012ddsw.rept.....T} Thornton, P.~E. and 6 colleagues 2012.\\ Daymet: Daily surface weather on a 1 km grid for North America, 1980-2008.\\ Oak Ridge National Laboratory (ORNL) Distributed Active Archive Center for Biogeochemical Dynamics (DAAC. doi:10.3334/ORNLDAAC/1219\n"} diff --git a/exportsrv/tests/unittests/test_export_service.py b/exportsrv/tests/unittests/test_export_service.py index 83a9279..3ec23c4 100755 --- a/exportsrv/tests/unittests/test_export_service.py +++ b/exportsrv/tests/unittests/test_export_service.py @@ -179,6 +179,13 @@ def test_aastex(self): # now compare it with an already formatted data that we know is correct assert (csl_export == cslTest.data_AASTex) + def test_aastex_psj(self): + """ test csl format aastex """ + + # format the stubdata using the code + csl_export = CSLFormat(CSLJson(solrdata.data).get(), 'aastex-psj', adsFormatter.latex).get(export_organizer=adsOrganizer.plain, output_format=adsOutputFormat.classic) + # now compare it with an already formatted data that we know is correct + assert (csl_export == cslTest.data_AASTex_PSJ) def test_icarus(self): """ test csl format icarus """ @@ -648,7 +655,7 @@ def test_no_journal_macro(self): # display full journal name csl_export = CSLFormat(CSLJson(solrdata.data_5).get(), 'aastex', adsFormatter.latex, adsJournalFormat.full).get(export_organizer=adsOrganizer.plain, output_format=adsOutputFormat.classic).get('export', '') # now compare it with an already formatted data that we know is correct - aastex_full_journal_name = u'\\bibitem[Pustilnik et al.(2018)]{2018PhRvL.120b9901P} Pustilnik, M., van Heck, B., Lutchyn, R.~M., et al.\\ 2018, Physical Review Letters, Erratum: Quantum Criticality in Resonant Andreev Conduction [Phys. Rev. Lett. 119, 116802 (2017)], 120, 2, 029901. doi:10.1103/PhysRevLett.120.029901\n' + aastex_full_journal_name = u'\\bibitem[Pustilnik et al.(2018)]{2018PhRvL.120b9901P} Pustilnik, M., van Heck, B., Lutchyn, R.~M., et al.\\ 2018, Physical Review Letters, 120, 2, 029901. doi:10.1103/PhysRevLett.120.029901\n' assert (csl_export == aastex_full_journal_name) # check the endpoint as well @@ -671,7 +678,7 @@ def test_no_journal_macro(self): # display abbreviated journal name csl_export = CSLFormat(CSLJson(solrdata.data_5).get(), 'aastex', adsFormatter.latex, adsJournalFormat.abbreviated).get(export_organizer=adsOrganizer.plain, output_format=adsOutputFormat.classic).get('export', '') # now compare it with an already formatted data that we know is correct - aastex_abbrev_journal_name = u'\\bibitem[Pustilnik et al.(2018)]{2018PhRvL.120b9901P} Pustilnik, M., van Heck, B., Lutchyn, R.~M., et al.\\ 2018, PhRvL, Erratum: Quantum Criticality in Resonant Andreev Conduction [Phys. Rev. Lett. 119, 116802 (2017)], 120, 2, 029901. doi:10.1103/PhysRevLett.120.029901\n' + aastex_abbrev_journal_name = u'\\bibitem[Pustilnik et al.(2018)]{2018PhRvL.120b9901P} Pustilnik, M., van Heck, B., Lutchyn, R.~M., et al.\\ 2018, PhRvL, 120, 2, 029901. doi:10.1103/PhysRevLett.120.029901\n' assert (csl_export == aastex_abbrev_journal_name) # check the endpoint as well @@ -694,7 +701,7 @@ def test_no_journal_macro(self): # display default journal name, which is the macro option csl_export = CSLFormat(CSLJson(solrdata.data_5).get(), 'aastex', adsFormatter.latex, adsJournalFormat.default).get(export_organizer=adsOrganizer.plain, output_format=adsOutputFormat.classic).get('export', '') # now compare it with an already formatted data that we know is correct - aastex_default_journal_name = u'\\bibitem[Pustilnik et al.(2018)]{2018PhRvL.120b9901P} Pustilnik, M., van Heck, B., Lutchyn, R.~M., et al.\\ 2018, \\prl, Erratum: Quantum Criticality in Resonant Andreev Conduction [Phys. Rev. Lett. 119, 116802 (2017)], 120, 2, 029901. doi:10.1103/PhysRevLett.120.029901\n' + aastex_default_journal_name = u'\\bibitem[Pustilnik et al.(2018)]{2018PhRvL.120b9901P} Pustilnik, M., van Heck, B., Lutchyn, R.~M., et al.\\ 2018, \\prl, 120, 2, 029901. doi:10.1103/PhysRevLett.120.029901\n' assert (csl_export == aastex_default_journal_name) # check the endpoint as well @@ -717,7 +724,7 @@ def test_no_journal_macro(self): # display abbreviated journal name that needs to be escaped csl_export = CSLFormat(CSLJson(solrdata.data_9).get(), 'aastex', adsFormatter.latex, adsJournalFormat.abbreviated).get(export_organizer=adsOrganizer.plain, output_format=adsOutputFormat.classic).get('export', '') # now compare it with an already formatted data that we know is correct - aastex_abbrev_journal_name = u'\\bibitem[Ajani et al.(2021)]{2021A&A...645L..11A} Ajani, V., Starck, J.-L., \\& Pettorino, V.\\ 2021, A\\&A, Starlet {\ensuremath{\ell}}$_{1}$-norm for weak lensing cosmology, 645, L11. doi:10.1051/0004-6361/202039988\n' + aastex_abbrev_journal_name = u'\\bibitem[Ajani et al.(2021)]{2021A&A...645L..11A} Ajani, V., Starck, J.-L., \\& Pettorino, V.\\ 2021, A\\&A, 645, L11. doi:10.1051/0004-6361/202039988\n' assert (csl_export == aastex_abbrev_journal_name) # check the endpoint as well @@ -751,7 +758,8 @@ def test_tmp_bibcode_format(self): """ test bibcodes that have no volume and page but doi for all CSLFormat formats """ csl_export_output = { - 'aastex': u'\\bibitem[Aharon(2005)]{2005GML...tmp....1A} Aharon, P.\\ 2005, Geo-Marine Letters, Catastrophic flood outbursts in mid-continent left imprints in the Gulf of Mexico. doi:10.1007/s00367-005-0006-y\n', + 'aastex': u'\\bibitem[Aharon(2005)]{2005GML...tmp....1A} Aharon, P.\\ 2005, Geo-Marine Letters. doi:10.1007/s00367-005-0006-y\n', + 'aastex-psj': u'\\bibitem[Aharon(2005)]{2005GML...tmp....1A} Aharon, P.\\ 2005, Geo-Marine Letters, Catastrophic flood outbursts in mid-continent left imprints in the Gulf of Mexico. doi:10.1007/s00367-005-0006-y\n', 'icarus': u'\\bibitem[Aharon(2005)]{2005GML...tmp....1A} Aharon, P.\\ 2005.\\ Catastrophic flood outbursts in mid-continent left imprints in the Gulf of Mexico.\\ Geo-Marine Letters. doi:10.1007/s00367-005-0006-y\n', 'mnras': u'\\bibitem[\\protect\\citeauthoryear{Aharon}{2005}]{2005GML...tmp....1A} Aharon P., 2005, GML...tmp. doi:10.1007/s00367-005-0006-y\n', 'soph': u'\\bibitem[Aharon(2005)]{2005GML...tmp....1A}Aharon, P.: 2005, {\\it Geo-Marine Letters}. doi:10.1007/s00367-005-0006-y.\n', @@ -774,7 +782,8 @@ def test_encode_doi(self): """ test doi that is encoded properly """ csl_export_output = { - 'aastex': u'\\bibitem[Greisen(2003)]{2003ASSL..285..109G} Greisen, E.~W.\\ 2003, Information Handling in Astronomy - Historical Vistas, AIPS, the VLA, and the VLBA, 285, 109. doi:10.1007/0-306-48080-8\_7\n', + 'aastex': u'\\bibitem[Greisen(2003)]{2003ASSL..285..109G} Greisen, E.~W.\\ 2003, Information Handling in Astronomy - Historical Vistas, 285, 109. doi:10.1007/0-306-48080-8\_7\n', + 'aastex-psj': u'\\bibitem[Greisen(2003)]{2003ASSL..285..109G} Greisen, E.~W.\\ 2003, Information Handling in Astronomy - Historical Vistas, AIPS, the VLA, and the VLBA, 285, 109. doi:10.1007/0-306-48080-8\_7\n', 'icarus': u'\\bibitem[Greisen(2003)]{2003ASSL..285..109G} Greisen, E.~W.\\ 2003.\\ AIPS, the VLA, and the VLBA.\\ Information Handling in Astronomy - Historical Vistas 109. doi:10.1007/0-306-48080-8\\_7\n', 'mnras': u'\\bibitem[\\protect\\citeauthoryear{Greisen}{2003}]{2003ASSL..285..109G} Greisen E.~W., 2003, ASSL, 285, 109. doi:10.1007/0-306-48080-8\\_7\n', 'soph': u'\\bibitem[Greisen(2003)]{2003ASSL..285..109G}Greisen, E.W.: 2003, {\\it Information Handling in Astronomy - Historical Vistas}, 109. doi:10.1007/0-306-48080-8\\_7.\n', diff --git a/exportsrv/views.py b/exportsrv/views.py index f97a2f1..84fb2a0 100755 --- a/exportsrv/views.py +++ b/exportsrv/views.py @@ -737,6 +737,37 @@ def csl_aastex_format_export_get(bibcode): csl_style='aastex', export_format=adsFormatter.latex, journal_format=adsJournalFormat.macro, export_output_format=adsOutputFormat.default, request_type='GET') +@advertise(scopes=[], rate_limit=[1000, 3600 * 24]) +@bp.route('/aastex-psj', methods=['POST']) +def csl_aastex_psj_format_export_post(): + """ + + :return: + """ + results, status = get_payload(request) + if status == 200: + payload = results['payload'] + results, status = export_post_payload_base(payload, 'aastex-psj', 2) + if status == 200: + journal_format = get_export_journal_format_from_payload(payload) + export_output_format = get_export_output_format_from_payload(payload) + return return_csl_format_export(solr_data=results, + csl_style='aastex-psj', export_format=adsFormatter.latex, journal_format=journal_format, + export_output_format=export_output_format, request_type='POST') + return return_response(results, status) + + +@advertise(scopes=[], rate_limit=[1000, 3600 * 24]) +@bp.route('/aastex-psj/', methods=['GET']) +def csl_aastex_psj_format_export_get(bibcode): + """ + + :param bibcode: + :return: + """ + return return_csl_format_export(solr_data=export_get(bibcode, 'aastex-psj', 2), + csl_style='aastex-psj', export_format=adsFormatter.latex, journal_format=adsJournalFormat.macro, + export_output_format=adsOutputFormat.default, request_type='GET') @advertise(scopes=[], rate_limit=[1000, 3600 * 24]) @bp.route('/icarus', methods=['POST']) From 90eb0f0228b68965963a4655ceb8123140142c44 Mon Sep 17 00:00:00 2001 From: Kelly Lockhart <2926089+kelockhart@users.noreply.github.com> Date: Fri, 23 May 2025 15:04:34 -0400 Subject: [PATCH 2/2] Updated README to add new endpoint --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index fa4fc96..486f4c4 100755 --- a/README.md +++ b/README.md @@ -106,7 +106,8 @@ which can be passed as payload to `/rss` endpoint. ###### 3. For the following Citation Style Language Format endpoints output is in latex format: -* **/aastex** *AASTeX format* +* **/aastex** *AASTeX format* (excludes record title) +* **/aastex-psj** *AASTeX format for PSJ* (exact same as `/aastex` but includes record title) * **/icarus** *Icarus format* * **/mnras** *MNRAS format* * **/soph** *SoPh format*