Forum code highlighting? (C++, Morrowind, OpenMW)
Posted: 07 May 2017, 23:28
Since out project is >90% C++, can we get some C++ code highlighting for [/code] tags?
Code: Select all
[Code]
Code: Select all
[Code]
Code: Select all
#ifndef GAME_MWCLASS_MOBILE_H
#define GAME_MWCLASS_MOBILE_H
#include "../mwworld/class.hpp"
namespace ESM
{
struct GameSetting;
}
namespace MWClass
{
/// \brief Class holding functionality common to Creature and NPC
class Actor : public MWWorld::Class
{
protected:
Actor();
public:
virtual ~Actor();
virtual void adjustPosition(const MWWorld::Ptr& ptr, bool force) const;
///< Adjust position to stand on ground. Must be called post model load
/// @param force do this even if the ptr is flying
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const;
virtual bool useAnim() const;
virtual void block(const MWWorld::Ptr &ptr) const;
virtual osg::Vec3f getRotationVector(const MWWorld::Ptr& ptr) const;
///< Return desired rotations, as euler angles.
virtual float getEncumbrance(const MWWorld::Ptr& ptr) const;
///< Returns total weight of objects inside this object (including modifications from magic
/// effects). Throws an exception, if the object can't hold other objects.
virtual bool allowTelekinesis(const MWWorld::ConstPtr& ptr) const;
///< Return whether this class of object can be activated with telekinesis
virtual bool isActor() const;
virtual bool canBeActivated(const MWWorld::Ptr& ptr) const;
// not implemented
Actor(const Actor&);
Actor& operator= (const Actor&);
};
}
#endif
Highlight.js uses autodetection for language highlighting (unfortunately MW script is not on the supported languages list), but at this moment it's disabled - C++ language is forced - I'll change it tomorrow.AnyOldName3 wrote:It might be a good idea to make the language an optional argument to the code tag, as we're likely to get snippets of languages other than C++ here, such as Morrowind scripts.
That would be really helpful.Jyby wrote:Thanks Igro ❤
@everyone and @AnyOldName3,
I wonder if we can work with highlightjs and write a highlighter for MW / OpenMW script.
http://highlightjs.readthedocs.io/en/la ... uests.html
Code: Select all
{
case_insensitive: true,
keywords: 'Begin StartScript StopScript End end if elseif else endif Endif while MessageBox Short Float Set set to',
contains: [
{
className: 'string',
begin: '\"', end: '\"'
},
hljs.COMMENT(
';*', // morrowind comments start with ;
'*\n' // morrowind comments end with \n (do they end with LFRC on other computers?)
),
{
className: 'ref',
begin: '\"', end: '\"->'
}
]
}
// TODO: need to represent these
// I think these are represented as *->* in regex.
// Player->RemoveSpell, "Frost_Curse"
// Fargoth->ForceSneak
// Or these examples
// "seen-ref"->StartCombat Player
// if ( ( GetPos x ) == 500 )
// Something like set * to *,*,* for as many comma seperated items
// set temp to 100