Skip to content

Commit

Permalink
closes #13; created new templates, added venue to label instead of type
Browse files Browse the repository at this point in the history
  • Loading branch information
Shahab Abbaszadeh committed May 4, 2022
1 parent 88cde1e commit 44f08a8
Show file tree
Hide file tree
Showing 2 changed files with 245 additions and 0 deletions.
125 changes: 125 additions & 0 deletions templates/my_template_2022.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
/**
* Template: teachpress 2021 template
* Version: 1.0
* Author: Michael Winkler
*/
/* publication box */

.fa-globe {
color: #0A5C51 !important;
padding-right: 5px;
font-size: 12pt;
}

.ai-doi{
color: #0A5C51;
padding-right: 5px;
font-size: 13.5pt !important;
}

.ai-arxiv{
color: #0A5C51;
padding-right: 5px;
font-size: 13.5pt !important;
}
.fa-file-pdf{
color: #0A5C51;
padding-right: 5px;
font-size: 13.5pt !important;
}
div.tp_publication {
display: flex;
justify-content: space-between;
padding-bottom: 5px;
/* border-bottom:1px solid silver; */ }
div.tp_pub_image_left {
padding-top: 8px;
padding-bottom: 8px;}
div.tp_pub_image_right {
padding-top: 8px;
padding-bottom: 8px;}
div.tp_pub_info {
width: 100%;
padding: 8px;}
div.tp_pub_number {
width: 40px;
font-size:0.9rem;
padding-top: 8px;
flex-shrink: 0;}
@media (max-width: 767.98px) {

div.tp_publication {
flex-flow: column; }
div.tp_pub_image_left, div.tp_pub_image_right {
padding-left: 8px; }
div.tp_pub_number {
padding-left: 8px; }
}
/* entry details */
.tp_bibtex_entry {
font-size:0.75rem;}
.tp_bibtex_entry pre {
white-space: normal;
word-wrap: break-word;}
.tp_pub_author, #content p.tp_pub_author {
font-size:0.9rem;
margin-bottom:1px;
margin-top:1px;
color:#549F97 !important;

}
.tp_pub_title, #content p.tp_pub_title {
font-size:0.9rem;
font-weight:bold;
margin-top:1px;
margin-bottom:1px;}
.tp_pub_additional, #content p.tp_pub_additional {
font-size:0.9rem;
margin-top:1px;
margin-bottom:1px;}
.tp_pub_menu, #content p.tp_pub_menu {
font-size:0.9rem;
margin-top:1px;
margin-bottom:1px;
color:#AAAAAA;}
.tp_pub_menu a {
color:#AAAAAA;
text-decoration:underline;
box-shadow: none;}
.tp_pub_menu a:hover {
color:#AAAAAA;
text-decoration:none;}
.tp_pub_type {
background-color: #0a5c51;
color: #fff;
display: inline-block;
padding: 5px 5px;
margin-left: 5px;
font-size: 0.70rem;
font-weight: bold;
line-height: 1;
border-radius: 2px;
box-shadow: inset 0 -1px 0 rgba(0,0,0,0.12);}
.tp_pub_label_status {
background-color: orange;
color: #fff;
display: inline-block;
padding: 5px 5px;
margin-left: 5px;
font-size: 0.70rem;
font-weight: bold;
line-height: 1;
border-radius: 2px;
box-shadow: inset 0 -1px 0 rgba(0,0,0,0.12);}
.tp_pub_label_journal {
background-color: #0a5c51;
color: #fff;
display: inline-block;
padding: 5px 5px;
margin-left: 5px;
font-size: 0.70rem;
font-weight: bold;
line-height: 1;
border-radius: 2px;
box-shadow: inset 0 -1px 0 rgba(0,0,0,0.12);}

120 changes: 120 additions & 0 deletions templates/my_template_2022.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
<?php
/**
* teachPress template file
* @package teachpress\core\templates
* @license http://www.gnu.org/licenses/gpl-2.0.html GPLv2 or later
* @since 6.0.0
*/

class my_template_2022 implements TP_Publication_Template {
/**
* Returns the settings of the template
* @return array
*/
public function get_settings() {
return array ('name' => 'my template 2022',
'description' => 'a new template based on original version, customizing journal as label and removing booktitle for inproceedings',
'author' => 'Michael Winkler - edited by shahab-ab',
'version' => '1.0',
'button_separator' => ' | ',
'menu_label_tags' => __('Tags') . ': ',
'menu_label_links' => __('Links','teachpress') . ': ',
'meta_label_in' => __('In','teachpress') . ': ',
'citation_style' => 'teachPress'
);
}

/**
* Returns the body element for a publication list
* @param string $content The content of the publication list itself
* @param array $args An array with some basic settings for the publication list
* @return string
*/
public function get_body ($content, $args = array() ) {
return '<div class="teachpress_publication_list">' . $content . '</div>';
}

/**
* Returns the headline for a publication list or a part of that
* @param type $content The content of the headline
* @param type $args An array with some basic settings for the publication list (source: shortcode settings)
* @return string
*/
public function get_headline ($content, $args = array()) {
return '<h3 class="tp_h3" id="tp_h3_' . esc_attr($content) .'">' . $content . '</h3>';
}

/**
* Returns the headline (second level) for a publication list or a part of that
* @param string $content The content of the headline
* @param array $args An array with some basic settings for the publication list (source: shortcode settings)
* @return string
*/
public function get_headline_sl ($content, $args = array()) {
return '<h4 class="tp_h4" id="tp_h4_' . esc_attr($content) .'">' . $content . '</h4>';
}

/**
* Returns the container for publication images
* @param string $content The image element
* @param string $position The image position: left, right or buttom
* @param string $optional_attributes Optional attributes for the framing container element
* @return string
*/
public function get_image($content, $position, $optional_attributes = '') {
return '<div class="tp_pub_image_' . $position . '">' . $content . '</div>';
}

/**
* Returns the journal field of a publication
* @param array data current publication in db
* @return string
* @since 7.2
* @access public
*/
public function get_journal($data) {
$journal = $data['row']['journal'];
return $journal;
}

/**
* Returns the single entry of a publication list
*
* Contents of the interface data array (available over $interface->get_data()):
* 'row' => An array of the related publication data
* 'title' => The title of the publication (completely prepared for HTML output)
* 'images' => The images array (HTML code for left, bottom, right)
* 'tag_line' => The HTML tag string
* 'settings' => The settings array (shortcode options)
* 'counter' => The publication counter (integer)
* 'all_authors' => The prepared author string
* 'keywords' => An array of related keywords
* 'container_id' => The ID of the HTML container
* 'template_settings' => The template settings array (name, description, author, citation_style)
*
* @param object $interface The interface object
* @return string
*/
public function get_entry ($interface) {
$data = $interface->get_data();
$journal = self::get_journal($data);

$class = ' tp_publication_' . $interface->get_type('');
$s = '<div class="tp_publication' . $class . '">';
$s .= $interface->get_number('<div class="tp_pub_number">', '.</div>');
$s .= $interface->get_images('left');
$s .= '<div class="tp_pub_info">';
$s .= $interface->get_author('<p class="tp_pub_author">', '</p>');
//$s .= '<p class="tp_pub_title">' . $interface->get_title() . ' ' . $interface->get_type() . ' ' . $interface->get_label('status', array('forthcoming') ) . $interface->get_label('journal', array($journal)) . '</p>';
// journal instead of type as label
$s .= '<p class="tp_pub_title">' . $interface->get_title() . ' ' . $interface->get_label('journal', array($journal)) . ' ' . $interface->get_label('status', array('forthcoming') ) . '</p>';
$s .= '<p class="tp_pub_additional">' . $interface->get_meta() . '</p>';
$s .= '<p class="tp_pub_menu">' . $interface->get_menu_line() . '</p>';
$s .= $interface->get_infocontainer();
$s .= $interface->get_images('bottom');
$s .= '</div>';
$s .= $interface->get_images('right');
$s .= '</div>';
return $s;
}
}

0 comments on commit 44f08a8

Please sign in to comment.