[Geany-Devel] Introduction & Geany Custom Config File Addition

Hans-Peter (Developing) developer at xxxxx
Fri Jun 12 11:21:17 UTC 2020


Dear List,
first, I would like to introduce myself: I am an IT teacher and long
time IT consultant from Germany who has been using geany as an IDE for
Java and Markdown on (X)Ubuntu for some time.
My experience with respect to geany developing is mostly in file formats
(plus some C++ knowledge - coming from Java, Python, and plain C). So, I
think I'll be more active on the lexer (-> Scintilla) side than on the
geany GUI side.

Now, I created a custom config file that I'd like to share for the RDF
Turtle description language (https://www.w3.org/TR/turtle/), which is
being used in the context of the Semantic Web. The config is based on
the Scintilla Python lexer which does most things correctly.

I added custom compile and link commands for syntax check and creating a
GraphViz input employing two external packages (Can anybody bring light
into how the error regex is supposed to work?). I'm including this
filetype.RDF-Turtle.conf for someone to put it on the geany wiki (I
would be willing to do so if I knew how). I called it RDF-Turtle in
order not to create confusion with the Turtle beginner's programming
language.
The attachment rdf-turtle-example.ttf is an example file to show the
kind of syntax Turtle uses. (It does not make any practical sense in
terms of its contents but it shows the relevant Turtle features.)

I also added some Turtle support to snippets.conf see attached
snippets.RDF-Turtle.conf.

There is a variant (with respect to syntax highlighting and editing) of
RDF Turtle that is called N-Triples (https://www.w3.org/TR/n-triples/)
which uses another mimetype so IMHO needs an other
filetypes.RDF-NTriples.conf which I also include. The Turtle snippets
can be used for N-Triples as well.

Best Regards,
Hans-Peter Ederberg
-------------- next part --------------
## RDF Turtle (https://www.w3.org/TR/turtle) notation filetype 
## by H-P Ederberg
## June 11, 2020
## (c) CC-BY-SA 3.0
##
## (almost) correctly highlights all examples from TR:
## RDF IRIs containig '#' chars are not properly highlighted

# For complete documentation of this file, please see Geany's main documentation

[styling]
# these specify highlighting for "primary"=word and "identifier"=word2
word=keyword_1
word2=keyword_2
# Python lexer sees @prefix and @base as decorator, should be shown like word2
decorator=keyword_2

# these types are built into the Python lexer
default=default
number=number,bold
# Python lexer uses C(++) isoperator(char) function, not configurable 
operator=keyword_2,bold
# always from '#' to EOL - interferes w/ some IRIs
commentline=comment_line
# double '##' are treated like '#' by Turtle 
# we use a modified font-style to allow special attention comments 
commentblock=comment_line,bold
# Python lexer distiguishes between "string" and 'char', Turtle does not
string=string
character=string
triple=string
tripledouble=string
# all unquoted text should have default highlighting
identifier=default

# these are irrelevant in turtle files so we use default highlighting
classname=default
defname=default
stringeol=default
fstring=default
fcharacter=default
ftriple=default
ftripledouble=default

[keywords]
# boolean constants, common schema prefixes (xsd,owl,dc,rdf,rdfs), plus their data types and classes 
primary=true false xsd string integer boolean decimal double Id ID owl AllDifferent AllDisjointClasses AllDisjointProperties Annotation AnnotationProperty AsymmetricProperty Axiom Class DataRange DatatypeProperty DeprecatedClass DeprecatedProperty FunctionalProperty InverseFunctionalProperty IrreflexiveProperty NamedIndividual NegativePropertyAssertion Nothing ObjectProperty Ontology OntologyProperty ReflexiveProperty Restriction SymmetricProperty TransitiveProperty Thing allValuesFrom annotatedProperty annotatedSource annotatedTarget assertionProperty backwardCompatibleWith bottomDataProperty bottomObjectProperty cardinality complementOf datatypeComplementOf deprecated differentFrom disjointUnionOf disjointWith distinctMembers equivalentClass equivalentProperty hasKey hasSelf hasValue imports incompatibleWith intersectionOf inverseOf maxCardinality maxQualifiedCardinality members minCardinality minQualifiedCardinality onClass onDataRange onDatatype oneOf onProperties onProperty priorVersion propertyChainAxiom propertyDisjointWith qualifiedCardinality sameAs someValuesFrom sourceIndividual targetIndividual targetValue topDataProperty topObjectProperty unionOf versionInfo versionIRI withRestrictions dc abstract accessRights accrualMethod accrualPeriodicity accrualPolicy alternative audience available bibliographicCitation conformsTo contributor coverage created creator date dateAccepted dateCopyrighted dateSubmitted description educationLevel extent format hasFormat hasPart hasVersion identifier instructionalMethod isFormatOf isPartOf isReferencedBy isReplacedBy isRequiredBy issued isVersionOf language license mediator medium modified provenance publisher references relation replaces requires rights rightsHolder source spatial subject tableOfContents temporal title type valid contributor coverage creator date description format identifier language publisher relation rights source subject title type Agent AgentClass BibliographicResource FileFormat Frequency Jurisdiction LicenseDocument LinguisticSystem Location LocationPeriodOrJurisdiction MediaType MediaTypeOrExtent MethodOfAccrual MethodOfInstruction PeriodOfTime PhysicalMedium PhysicalResource Policy ProvenanceStatement RightsStatement SizeOrDuration Standard Collection Dataset Event Image InteractiveResource MovingImage PhysicalObject Service Software Sound StillImage Text domainIncludes memberOf rangeIncludes VocabularyEncodingScheme rdfs Class Resource subClassOf subPropertyOf comment label domain range seeAlso isDefinedBy Container ContainerMembershipProperty member Literal Property Datatype rdf HTML langString PlainLiteral JSON XMLLiteral type Literal Property Statement subject predicate object Bag Seq Alt value List nil first rest CompoundLiteral language direction 
# the basic turtle keywords and the ISO 639-1 language codes (for language specific strings)
identifiers=_ a @prefix PREFIX @base BASE @ aa ab ae af ak am an ar as av ay az ba be bg bh bi bm bn bo br bs ca ce ch co cr cs cu cv cy da de dv dz ee el en eo es et eu fa ff fi fj fo fr fy ga gd gl gn gu gv ha he hi ho hr ht hu hy hz ia id ie ig ii ik io is it iu ja jv ka kg ki kj kk kl km kn ko kr ks ku kv kw ky la lb lg li ln lo lt lu lv mg mh mi mk ml mn mr ms mt my na nb nd ne ng nl nn no nr nv ny oc oj om or os pa pi pl ps pt qu rm rn ro ru rw sa sc sd se sg sh si sk sl sm sn so sq sr ss st su sv sw ta te tg th ti tk tl tn to tr ts tt tw ty ug uk ur uz ve vi vo wa wo xh zh

# operators recognized by RDF Turtle
# list is not used by lexer, included for reference
#operators=: ; . ^^ , ( ) [ ]

[lexer_properties]
# switch off python things we do not need in rdf-turtle
# dont check indentation levels, binary number formats, special string formats 
tab.timmy.whinge.level=0
lexer.python.literals.binary=0
lexer.python.strings.u=0
lexer.python.strings.b=0
lexer.python.strings.f=0
# accept multiline strings and allow folding
lexer.python.strings.over.newline=1
fold.quotes.python=1

[settings]
# these are used by geany itself 
# default extension used when saving files
extension=ttl

# MIME type
mime_type=text/turtle

# Python lexer has definable keywords and a suitable base syntax
lexer_filetype=Python

# the following characters are these which a "word" can contain, see documentation
# extended to include all IRI components 
wordchars=<>/:.@?#_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789

# single comments, like # in this file
comment_single=#
# multiline comments
## not allowed in RDF Turtle 
#comment_open=<
#comment_close=>

# set to false if a comment character/string should start at column 0 of a line, true uses any
# indentation of the line, e.g. setting to true causes the following on pressing CTRL+d
	#command_example();
# setting to false would generate this
#	command_example();
# This setting works only for single line comments
comment_use_indent=false

# context action command (please see Geany's main documentation for details)
# try to open/search URL on Ubuntu
context_action_cmd=exo-open --launch WebBrowser "%s"

# if this setting is set to true, a new line after a line ending with an
# unclosed tag will be automatically indented
xml_indent_tags=false

[indentation]
#width=4
# 0 is spaces, 1 is tabs, 2 is tab & spaces
type=1

[build-menu]
# GraphViz Visualisation using raptor library 
# packages see http://librdf.org/raptor/
FT_00_LB=Create _GraphViz DOT
FT_00_CM=rapper -i turtle -o dot %f > %e.gv
FT_00_WD=%d

# turtle syntax checker from 'npm -install turtle-validator'
# see https://github.com/IDLabResearch/TurtleValidator 
# ttl itself always exits successfully, therefore checking output w/ awk
FT_01_LB=_Validate
FT_01_CM=ttl %f | awk '{print}/ 0 errors/{OK=1}END{exit 1-OK}'
FT_01_WD=%d
-------------- next part --------------
[styling=RDF-Turtle]
decorator=default 
# does not allow @

[keywords]
# N-Triples uses fewer keywords
primary=true false xsd string integer boolean decimal double Id ID nil first rest
identifiers=_ a aa ab ae af ak am an ar as av ay az ba be bg bh bi bm bn bo br bs ca ce ch co cr cs cu cv cy da de dv dz ee el en eo es et eu fa ff fi fj fo fr fy ga gd gl gn gu gv ha he hi ho hr ht hu hy hz ia id ie ig ii ik io is it iu ja jv ka kg ki kj kk kl km kn ko kr ks ku kv kw ky la lb lg li ln lo lt lu lv mg mh mi mk ml mn mr ms mt my na nb nd ne ng nl nn no nr nv ny oc oj om or os pa pi pl ps pt qu rm rn ro ru rw sa sc sd se sg sh si sk sl sm sn so sq sr ss st su sv sw ta te tg th ti tk tl tn to tr ts tt tw ty ug uk ur uz ve vi vo wa wo xh zh

[lexer-properties=RDF-Turtle]
[settings=RDF-Turtle]
# default extension used when saving files
extension=nt
# MIME type
mime-type=application/n-triples
[indentation=RDF-Turtle]
[build-menu=RDF-Turtle]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rdf-turtle-example.ttl
Type: text/turtle
Size: 3303 bytes
Desc: not available
URL: <https://lists.geany.org/pipermail/devel/attachments/20200612/9195faa8/attachment.ttl>
-------------- next part --------------
# RDF-Turtle and NTriples sections for geany snippets.conf
[RDF-Turtle]
rdf=<http://www.w3.org/1999/02/22-rdf-syntax-ns#>:%cursor%
rdfs=<http://www.w3.org/2000/01/rdf-schema#>:%cursor%
xsd=<http://www.w3.org/2001/XMLSchema#>:%cursor%
owl=<http://www.w3.org/2002/07/owl#>:%cursor%
dc=<http://purl.org/dc/elements/1.1/>:%cursor%
ht=<http://%cursor%>

[RDF-NTriples]
rdf=<http://www.w3.org/1999/02/22-rdf-syntax-ns#>:%cursor%
rdfs=<http://www.w3.org/2000/01/rdf-schema#>:%cursor%
xsd=<http://www.w3.org/2001/XMLSchema#>:%cursor%
owl=<http://www.w3.org/2002/07/owl#>:%cursor%
dc=<http://purl.org/dc/elements/1.1/>:%cursor%
ht=<http://%cursor%>


More information about the Devel mailing list