Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix XML renderer crash #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions geshi/classes/class.geshistyler.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,17 @@ class GeSHiStyler

/**#@-*/

// }}}
// {{{ getLanguage()

/**
* Retrieves the language this styler is using.
*/
function getLanguage ()
{
return $this->language;
}

// }}}
// {{{ setLanguage()

Expand Down Expand Up @@ -307,6 +318,17 @@ function setRenderer (GeSHiRenderer $renderer)
$this->_renderer = $renderer;
}

// }}}
// {{{ getThemes()

/**
* Retrieves an array with the themes of this styler.
*/
function getThemes ()
{
return $this->themes;
}

// }}}
// {{{ useThemes()

Expand Down
3 changes: 2 additions & 1 deletion geshi/classes/renderers/class.geshirendererxml.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,11 @@ function parseToken ($token, $context_name, $data)
function getHeader ()
{
// TODO: Add doctype (if needed)
$themes = $this->_styler->getThemes();
return '<?xml version="1.0"?>' . "\n" .
'<!DOCTYPE GESHI SYSTEM "HERE_GOES_URL_TO_DTD">' . "\n" .
"\n" .
'<geshi language="' . $this->_styler->language . '" theme="' . $this->_styler->themes[0] . '">' . "\n";
'<geshi language="' . $this->_styler->getLanguage() . '" theme="' . $themes[0] . '">' . "\n";
}

// }}}
Expand Down