improves reconstructed mode
This commit is contained in:
@@ -279,17 +279,17 @@ class BTBTest extends PHPUnit_Framework_TestCase {
|
|||||||
|
|
||||||
function test_filter_view() {
|
function test_filter_view() {
|
||||||
$test_data = fopen('php://memory','x+');
|
$test_data = fopen('php://memory','x+');
|
||||||
fwrite($test_data, "@article{aKey,title={A Book},author={Martin Monperrus},publisher={Springer},year=2009,pages={42--4242},number=1}\n");
|
fwrite($test_data, "@article{aKey,title={A Book},author={Martin M\'e},publisher={Springer},year=2009,pages={42--4242},number=1}\n");
|
||||||
fseek($test_data,0);
|
fseek($test_data,0);
|
||||||
$db = new BibDataBase();
|
$db = new BibDataBase();
|
||||||
$db->update_internal("inline", $test_data);
|
$db->update_internal("inline", $test_data);
|
||||||
$dis = $db->getEntryByKey('aKey');
|
$dis = $db->getEntryByKey('aKey');
|
||||||
$this->assertEquals("@article{aKey,title={A Book},author={Martin Monperrus},publisher={Springer},year=2009,pages={42--4242},number=1}",$dis->getText());
|
$this->assertEquals("@article{aKey,title={A Book},author={Martin M\'e},publisher={Springer},year=2009,pages={42--4242},number=1}",$dis->getText());
|
||||||
|
|
||||||
// now ith option
|
// now ith option
|
||||||
bibtexbrowser_configure('BIBTEXBROWSER_BIBTEX_VIEW', 'reconstructed');
|
bibtexbrowser_configure('BIBTEXBROWSER_BIBTEX_VIEW', 'reconstructed');
|
||||||
bibtexbrowser_configure('BIBTEXBROWSER_BIBTEX_VIEW_FILTEREDOUT', 'pages|number');
|
bibtexbrowser_configure('BIBTEXBROWSER_BIBTEX_VIEW_FILTEREDOUT', 'pages|number');
|
||||||
$this->assertEquals("@article{aKey,\n title = {A Book},\n author = {Martin Monperrus},\n publisher = {Springer},\n year = {2009},\n}\n", $dis->getText());
|
$this->assertEquals("@article{aKey,\n title = {A Book},\n author = {Martin M\'e},\n publisher = {Springer},\n year = {2009},\n}\n", $dis->getText());
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_BIBTEXBROWSER_USE_LATEX2HTML() {
|
function test_BIBTEXBROWSER_USE_LATEX2HTML() {
|
||||||
|
|||||||
+9
-3
@@ -1105,9 +1105,12 @@ notes:
|
|||||||
*/
|
*/
|
||||||
class BibEntry {
|
class BibEntry {
|
||||||
|
|
||||||
/** The fields (fieldName -> value) of this bib entry. */
|
/** The fields (fieldName -> value) of this bib entry with Latex macros interpreted and encoded in the desired character set . */
|
||||||
var $fields = array();
|
var $fields = array();
|
||||||
|
|
||||||
|
/** The raw fields (fieldName -> value) of this bib entry. */
|
||||||
|
var $raw_fields = array();
|
||||||
|
|
||||||
/** The constants @STRINGS referred to by this entry */
|
/** The constants @STRINGS referred to by this entry */
|
||||||
var $constants = array();
|
var $constants = array();
|
||||||
|
|
||||||
@@ -1177,6 +1180,8 @@ class BibEntry {
|
|||||||
/** Sets a field of this bib entry. */
|
/** Sets a field of this bib entry. */
|
||||||
function setField($name, $value) {
|
function setField($name, $value) {
|
||||||
$name = strtolower($name);
|
$name = strtolower($name);
|
||||||
|
$this->raw_fields[$name] = $value;
|
||||||
|
|
||||||
// fields that should not be transformed
|
// fields that should not be transformed
|
||||||
// we assume that "comment" is never latex code
|
// we assume that "comment" is never latex code
|
||||||
// but instead could contain HTML code (with links using the character "~" for example)
|
// but instead could contain HTML code (with links using the character "~" for example)
|
||||||
@@ -1224,7 +1229,7 @@ class BibEntry {
|
|||||||
// to support space e.g. "@article {"
|
// to support space e.g. "@article {"
|
||||||
// as generated by ams.org
|
// as generated by ams.org
|
||||||
// thanks to Jacob Kellner
|
// thanks to Jacob Kellner
|
||||||
$this->fields[Q_INNER_TYPE] =trim($value);
|
$this->fields[Q_INNER_TYPE] = trim($value);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setIndex($index) { $this->index = $index; }
|
function setIndex($index) { $this->index = $index; }
|
||||||
@@ -1680,7 +1685,7 @@ class BibEntry {
|
|||||||
}
|
}
|
||||||
if (c('BIBTEXBROWSER_BIBTEX_VIEW') == 'reconstructed') {
|
if (c('BIBTEXBROWSER_BIBTEX_VIEW') == 'reconstructed') {
|
||||||
$result = '@'.$this->getType().'{'.$this->getKey().",\n";
|
$result = '@'.$this->getType().'{'.$this->getKey().",\n";
|
||||||
foreach ($this->fields as $k=>$v) {
|
foreach ($this->raw_fields as $k=>$v) {
|
||||||
if ( !preg_match('/^('.c('BIBTEXBROWSER_BIBTEX_VIEW_FILTEREDOUT').')$/i', $k)
|
if ( !preg_match('/^('.c('BIBTEXBROWSER_BIBTEX_VIEW_FILTEREDOUT').')$/i', $k)
|
||||||
&& !preg_match('/^(key|'.Q_INNER_AUTHOR.'|'.Q_INNER_TYPE.')$/i', $k) )
|
&& !preg_match('/^(key|'.Q_INNER_AUTHOR.'|'.Q_INNER_TYPE.')$/i', $k) )
|
||||||
{
|
{
|
||||||
@@ -1908,6 +1913,7 @@ class BibEntry {
|
|||||||
class RawBibEntry extends BibEntry {
|
class RawBibEntry extends BibEntry {
|
||||||
function setField($name, $value) {
|
function setField($name, $value) {
|
||||||
$this->fields[$name]=$value;
|
$this->fields[$name]=$value;
|
||||||
|
$this->raw_fields[$name]=$value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user