Skip to content

Commit

Permalink
XSLHL Alan Syntax: Fix Predefined Classes
Browse files Browse the repository at this point in the history
Begin implementing changes discussed in Issue #17:
- Add new syntax elements group "classes" to highlight predefined classes:
  `actor`, `entity`, `location`, `object`, `string`, `thing`.
- Remove `actor` and `location` from "keywords" group.
- Update stylesheets accordingly.

NOTE: Now predefined classes are styled in blue, for testing.
  • Loading branch information
tajmone committed Sep 9, 2018
1 parent 332b232 commit 9130d0a
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 9 deletions.
Binary file modified _dev/hl/syntax-highlighting.pdf
Binary file not shown.
24 changes: 24 additions & 0 deletions manual/Alan_Keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,30 @@ This is the list of Alan keywords, as found in the Alan Manual (Appendix D, sec.
'actor' 'add' 'after' 'an' 'and' 'are' 'article' 'at' 'attributes' 'before' 'between' 'by' 'can' 'cancel' 'character' 'characters' 'check' 'container' 'contains' 'count' 'current' 'decrease' 'definite' 'depend' 'depending' 'describe' 'description' 'directly' 'do' 'does' 'each' 'else' 'elsif' 'empty' 'end' 'entered' 'event' 'every' 'exclude' 'exit' 'extract' 'first' 'for' 'form' 'from' 'has' 'header' 'here' 'if' 'import' 'in' 'include' 'increase' 'indefinite' 'initialize' 'into' 'is' 'isa' 'it' 'last' 'limits' 'list' 'locate' 'location' 'look' 'make' 'max' 'mentioned' 'message' 'min' 'name' 'near' 'nearby' 'negative' 'no' 'not' 'of' 'off' 'on' 'only' 'opaque' 'option' 'options' 'or' 'play' 'prompt' 'pronoun' 'quit' 'random' 'restart' 'restore' 'save' 'say' 'schedule' 'score' 'script' 'set' 'show' 'start' 'step' 'stop' 'strip' 'style' 'sum' 'synonyms' 'syntax' 'system' 'taking' 'the' 'then' 'this' 'to' 'transcript' 'until' 'use' 'verb' 'visits' 'wait' 'when' 'where' 'with' 'word' 'words'
................................................................................

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Predefined Classes Issues
//////////////////////////////////////////////////////////////////////////////

The keywords list contains some predefined classes but not all, so the following
tokens should be removed from KEYWORDS group (in syntax highlighters) and moved
into the NATIVE CLASSES group (if supported):

- actor
- location

And the following should be added to the NATIVE CLASSES group:
- entity
- object
- string
- thing



For more details, see Issue #17:

https://github.com/alan-if/alan-docs/issues/17#issuecomment-419701922
https://github.com/alan-if/alan-docs/issues/17#issuecomment-419704203

==============================================================================
Letter-Cased Keywords List
==============================================================================
Expand Down
4 changes: 3 additions & 1 deletion manual/manual-xsl/common.xsl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
"common.xsl" v0.1.2 (2018/09/07)
"common.xsl" v0.2.0 (2018/09/09)
==============================================================================
This file was taken from the asciidoctor-fopub project, Copyright (C) 2013
Dan Allen (MIT License):
Expand Down Expand Up @@ -55,9 +55,11 @@
<!-- Syntax Highlighting Theme for Alan -->
<!-- ================================== -->
<xsl:param name="AlanHL.background" select="$Monokai.base00"></xsl:param>

<xsl:param name="AlanHL.normal" select="$Monokai.base05"></xsl:param>
<xsl:param name="AlanHL.quotedId" select="$AlanHL.normal"></xsl:param><!-- TEST WITH base12 -->
<xsl:param name="AlanHL.keyword" select="$Monokai.base08"></xsl:param>
<xsl:param name="AlanHL.class" select="$Monokai.base13"></xsl:param>
<xsl:param name="AlanHL.comment" select="$Monokai.base04"></xsl:param>
<xsl:param name="AlanHL.string" select="$Monokai.base0B"></xsl:param>
<xsl:param name="AlanHL.number" select="$Monokai.base10"></xsl:param>
Expand Down
1 change: 1 addition & 0 deletions manual/manual-xsl/fo-pdf.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ PARAGRAPHS WITH COMMENTARY ROLE (indented left)
<xsl:when test="@role = 'commentary'">
<xsl:text>4em</xsl:text>
</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:attribute-set>
Expand Down
8 changes: 7 additions & 1 deletion manual/manual-xsl/highlight.xsl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
"highlight.xsl" v0.1.1 (2018/09/07)
"highlight.xsl" v0.2.0 (2018/09/09)
==============================================================================
This file was taken from the asciidoctor-fopub project, Copyright (C) 2013
Dan Allen (MIT License):
Expand Down Expand Up @@ -40,6 +40,12 @@
<fo:inline font-weight="bold" color="{$AlanHL.keyword}"><xsl:apply-templates mode="xslthl"/></fo:inline>
</xsl:template>
<!--=====================================================================-->
<!-- PREDEFINED CLASSES -->
<!--=====================================================================-->
<xsl:template match="xslthl:class" mode="xslthl">
<fo:inline font-weight="normal" color="{$AlanHL.class}"><xsl:apply-templates mode="xslthl"/></fo:inline>
</xsl:template>
<!--=====================================================================-->
<!-- STRINGS -->
<!--=====================================================================-->
<xsl:template match="xslthl:string" mode="xslthl">
Expand Down
25 changes: 18 additions & 7 deletions manual/manual-xsl/xslthl/alan-hl.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- "alan-hl.xml" v0.1.0 (2018/09/07) | Alan 3.0beta6
<!-- "alan-hl.xml" v0.2.0 (2018/09/09) | Alan 3.0beta6
********************************************************************************
* *
* Alan Interactive Fiction Language *
Expand All @@ -16,8 +16,8 @@ This syntax definition was created by Tristano Ajmone, (C) 2018, MIT License.
<!-- COMMENTS -->
<!--=======================================================================-->
<highlighter type="oneline-comment">
<start>--</start>
<style>comment</style>
<start>--</start>
</highlighter>
<!--=======================================================================-->
<!-- NUMBERS -->
Expand All @@ -43,8 +43,8 @@ This syntax definition was created by Tristano Ajmone, (C) 2018, MIT License.
(1) parameter indicators: '!', '*'
........................................................................-->
<highlighter type="regex">
<pattern>\+|\-|\*|\/|&lt;|(?&lt;!\=)>|&lt;>|&lt;\=|>\=|\=(?!>)|\=\=|\(|\)|\{|\}|!</pattern>
<style>operator</style>
<pattern>\+|\-|\*|\/|&lt;|(?&lt;!\=)>|&lt;>|&lt;\=|>\=|\=(?!>)|\=\=|\(|\)|\{|\}|!</pattern>
</highlighter>
<!--=======================================================================-->
<!-- QUOTED IDENTIFIERS -->
Expand All @@ -55,16 +55,15 @@ This syntax definition was created by Tristano Ajmone, (C) 2018, MIT License.
(eg, 'The Count''s Villa (south exit)').
........................................................................-->
<highlighter type="regex">
<pattern>'.*?'(?!'')</pattern>
<style>quotedId</style>
<pattern>'.*?'(?!'')</pattern>
</highlighter>
<!--=======================================================================-->
<!-- KEYWORDS -->
<!--=======================================================================-->
<!-- All the keywords, but not the predfined classes: -->
<highlighter type="keywords">
<ignoreCase />
<keyword>actor</keyword><!-- pseudo-attribute, not the class! (as in 'Current actor') -->
<keyword>Add</keyword>
<keyword>After</keyword>
<keyword>An</keyword>
Expand All @@ -81,7 +80,7 @@ This syntax definition was created by Tristano Ajmone, (C) 2018, MIT License.
<keyword>Character</keyword>
<keyword>Characters</keyword>
<keyword>Check</keyword>
<keyword>Container</keyword><!-- the property, not the class! -->
<keyword>Container</keyword>
<keyword>Contains</keyword>
<keyword>Count</keyword>
<keyword>Current</keyword>
Expand Down Expand Up @@ -127,7 +126,6 @@ This syntax definition was created by Tristano Ajmone, (C) 2018, MIT License.
<keyword>Limits</keyword>
<keyword>List</keyword>
<keyword>Locate</keyword>
<keyword>location</keyword><!-- pseudo-attribute, not the class! (as in 'Current location') -->
<keyword>Look</keyword>
<keyword>Make</keyword>
<keyword>Max</keyword>
Expand Down Expand Up @@ -198,6 +196,19 @@ This syntax definition was created by Tristano Ajmone, (C) 2018, MIT License.
<pattern>\=>|\.|,|:</pattern>
<style>keyword</style>
</highlighter>
<!--=======================================================================-->
<!-- PREDEFINED CLASSES -->
<!--=======================================================================-->
<highlighter type="keywords">
<style>class</style>
<ignoreCase />
<keyword>actor</keyword>
<keyword>entity</keyword>
<keyword>location</keyword>
<keyword>object</keyword>
<keyword>string</keyword>
<keyword>thing</keyword>
</highlighter>
</highlighters>
<!--============================================================================
MIT License
Expand Down
Binary file modified manual/manual.pdf
Binary file not shown.

0 comments on commit 9130d0a

Please sign in to comment.