forked from GitHub/gf-rgl
Fix tables, clean popups.
Imagemap on categories is now broken, need to see how to fix
This commit is contained in:
BIN
doc/hovering.png
BIN
doc/hovering.png
Binary file not shown.
|
Before Width: | Height: | Size: 166 KiB |
@@ -3,7 +3,7 @@ Aarne Ranta
|
|||||||
|
|
||||||
|
|
||||||
%!Encoding:utf8
|
%!Encoding:utf8
|
||||||
%!style(html): ../revealpopup.css
|
%!style(html): revealpopup.css
|
||||||
|
|
||||||
%!postproc(tex) : "#BECE" "begin{center}"
|
%!postproc(tex) : "#BECE" "begin{center}"
|
||||||
%!postproc(html) : "#BECE" "<center>"
|
%!postproc(html) : "#BECE" "<center>"
|
||||||
@@ -377,5 +377,3 @@ and the ``Num`` //five//. It is also common that a "structural word" in a partic
|
|||||||
a feature of the other words it combines with, rather than as a word of its own. For instance,
|
a feature of the other words it combines with, rather than as a word of its own. For instance,
|
||||||
the determiner //the// in Swedish just selects an inflectional form of the noun that it is applied to:
|
the determiner //the// in Swedish just selects an inflectional form of the noun that it is applied to:
|
||||||
"the" + //bil// = //bilen// ("the car").
|
"the" + //bil// = //bilen// ("the car").
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ LANGS=$(shell cat $(CONFIG) | cut -d',' -f1,10 | grep ',y' | cut -d',' -f1)
|
|||||||
SRC_FILES=$(S)/abstract/Common.gf $(S)/abstract/Cat.gf $(S)/api/Constructors.gf $(S)/abstract/Structural.gf $(patsubst %,$S/*/Paradigms%.gf,$(LANGS))
|
SRC_FILES=$(S)/abstract/Common.gf $(S)/abstract/Cat.gf $(S)/api/Constructors.gf $(S)/abstract/Structural.gf $(patsubst %,$S/*/Paradigms%.gf,$(LANGS))
|
||||||
|
|
||||||
EXAMPLES_OUT=$(patsubst %,api-examples-%.txt,$(LANGS))
|
EXAMPLES_OUT=$(patsubst %,api-examples-%.txt,$(LANGS))
|
||||||
INCLUDES=intro.txt categories-intro.txt categories-imagemap.html additional.txt browse.txt example.txt
|
INCLUDES=intro.txt categories-intro.txt categories-imagemap.html categories.png additional.txt browse.txt example.txt
|
||||||
|
|
||||||
TMP=tmp.html
|
TMP=tmp.html
|
||||||
TEMPLATE=template.html
|
TEMPLATE=template.html
|
||||||
@@ -36,12 +36,13 @@ index.html: index.txt $(TEMPLATE)
|
|||||||
--to=html5 \
|
--to=html5 \
|
||||||
--standalone \
|
--standalone \
|
||||||
--template=$(TEMPLATE) \
|
--template=$(TEMPLATE) \
|
||||||
--css=synopsis.css \
|
--css="synopsis.css" \
|
||||||
--metadata='title:"GF Resource Grammar Library: Synopsis"' \
|
--metadata='title:"GF Resource Grammar Library: Synopsis"' \
|
||||||
--variable='rel-root:$(ROOT)/..' \
|
--variable='rel-root:$(ROOT)/..' \
|
||||||
--output=$(TMP) \
|
--output=$(TMP) \
|
||||||
$@
|
$@
|
||||||
mv $(TMP) $@
|
mv $(TMP) $@
|
||||||
|
sed -i.bak "s/<table>/<table class=\"table w-auto\">/" $@ && rm "$@.bak"
|
||||||
|
|
||||||
categories.png: categories.dot
|
categories.png: categories.dot
|
||||||
dot -Tpng $^ > $@
|
dot -Tpng $^ > $@
|
||||||
|
|||||||
@@ -41,8 +41,6 @@ main = do
|
|||||||
writeFile outfile "GF Resource Grammar Library: Synopsis"
|
writeFile outfile "GF Resource Grammar Library: Synopsis"
|
||||||
space
|
space
|
||||||
append "%!Encoding:utf-8"
|
append "%!Encoding:utf-8"
|
||||||
append "%!style(html): ./revealpopup.css"
|
|
||||||
space
|
|
||||||
append "%!postproc(html): '#divreveal' '<div class=reveal>'"
|
append "%!postproc(html): '#divreveal' '<div class=reveal>'"
|
||||||
append "%!postproc(html): '#divpopup' '<div class=popup>'"
|
append "%!postproc(html): '#divpopup' '<div class=popup>'"
|
||||||
append "%!postproc(html): '#ediv' '</div>'"
|
append "%!postproc(html): '#ediv' '</div>'"
|
||||||
@@ -54,15 +52,18 @@ main = do
|
|||||||
append "%!postproc(tex): '#LParadigms' ''"
|
append "%!postproc(tex): '#LParadigms' ''"
|
||||||
delimit $ addToolTips cs
|
delimit $ addToolTips cs
|
||||||
include "intro.txt" -- TODO dynamic language list
|
include "intro.txt" -- TODO dynamic language list
|
||||||
|
space
|
||||||
title "Categories"
|
title "Categories"
|
||||||
space
|
space
|
||||||
link "Source 1:" commonAPI
|
link "Source 1:" commonAPI
|
||||||
space
|
space
|
||||||
link "Source 2:" catAPI
|
link "Source 2:" catAPI
|
||||||
space
|
space
|
||||||
append "==A hierarchic view==\n"
|
stitle "A hierarchic view"
|
||||||
|
space
|
||||||
include "categories-intro.txt"
|
include "categories-intro.txt"
|
||||||
append "==Explanations==\n"
|
stitle "Explanations"
|
||||||
|
space
|
||||||
delimit $ mkCatTable cs
|
delimit $ mkCatTable cs
|
||||||
space
|
space
|
||||||
title "Syntax Rules and Structural Words"
|
title "Syntax Rules and Structural Words"
|
||||||
@@ -73,11 +74,8 @@ main = do
|
|||||||
space
|
space
|
||||||
apiExx <- apiExxFiles >>= getApiExx
|
apiExx <- apiExxFiles >>= getApiExx
|
||||||
rs <- getRules apiExx syntaxAPI
|
rs <- getRules apiExx syntaxAPI
|
||||||
--- putStrLn $ unlines ["p -cat=" ++ last (words t) ++
|
|
||||||
--- " \"" ++ e ++ "\"" | (_,t,e) <- rs, not (null e)] ----
|
|
||||||
rs2 <- getRules apiExx structuralAPI
|
rs2 <- getRules apiExx structuralAPI
|
||||||
let rss = rs ++ rs2
|
let rss = rs ++ rs2
|
||||||
--- mapM_ putStrLn [f ++ " " ++ e | (f,_,e) <- rss]
|
|
||||||
delimit $ mkSplitTables True apiExx cs rss
|
delimit $ mkSplitTables True apiExx cs rss
|
||||||
space
|
space
|
||||||
-- title "Structural Words"
|
-- title "Structural Words"
|
||||||
@@ -174,7 +172,7 @@ inChunks i f = concat . intersperse ["\n\n"] . map f . chunks i where
|
|||||||
-- Adds a subsection header for each table.
|
-- Adds a subsection header for each table.
|
||||||
mkSplitTables :: Bool -> ApiExx -> Cats -> Rules -> [String]
|
mkSplitTables :: Bool -> ApiExx -> Cats -> Rules -> [String]
|
||||||
mkSplitTables hasEx aexx cs = concatMap t . addLexicalCats cs . sortRules
|
mkSplitTables hasEx aexx cs = concatMap t . addLexicalCats cs . sortRules
|
||||||
where t (c, xs) = [subtitle c expl] ++ tableOrLink
|
where t (c, xs) = [subtitle c expl, "\n"] ++ tableOrLink
|
||||||
where
|
where
|
||||||
expl = case [e | (n,e,_) <- cs, n == c] of
|
expl = case [e | (n,e,_) <- cs, n == c] of
|
||||||
[] -> ""
|
[] -> ""
|
||||||
@@ -189,8 +187,8 @@ mkTable :: Bool -> ApiExx -> Cats -> Rules -> [String]
|
|||||||
mkTable hasEx aexx cs = inChunks chsize (\rs -> header : map (unwords . row) rs)
|
mkTable hasEx aexx cs = inChunks chsize (\rs -> header : map (unwords . row) rs)
|
||||||
where
|
where
|
||||||
chsize = 1000
|
chsize = 1000
|
||||||
header = if hasEx then "|| Function | Type | Example ||"
|
header = if hasEx then "|| Function | Type | Example |"
|
||||||
else "|| Function | Type | Explanation ||"
|
else "|| Function | Type | Explanation |"
|
||||||
row (name,typ,ex) =
|
row (name,typ,ex) =
|
||||||
let ntyp = mkIdent (name ++ " : " ++ typ) in
|
let ntyp = mkIdent (name ++ " : " ++ typ) in
|
||||||
if hasEx then ["|", name', "|", typ', "|", ex' ntyp, "|"]
|
if hasEx then ["|", name', "|", typ', "|", ex' ntyp, "|"]
|
||||||
@@ -230,7 +228,7 @@ mkIdent = concatMap unspec where
|
|||||||
mkCatTable :: Cats -> [String]
|
mkCatTable :: Cats -> [String]
|
||||||
mkCatTable cs = inChunks chsize (\rs -> header ++ map mk1 rs) cs
|
mkCatTable cs = inChunks chsize (\rs -> header ++ map mk1 rs) cs
|
||||||
where
|
where
|
||||||
header = ["|| Category | Explanation | Example ||"]
|
header = ["|| Category | Explanation | Example |"]
|
||||||
chsize = 1000
|
chsize = 1000
|
||||||
mk1 (name,expl,ex) = unwords ["|", showCat cs name, "|", expl, "|", typo ex, "|"]
|
mk1 (name,expl,ex) = unwords ["|", showCat cs name, "|", expl, "|", typo ex, "|"]
|
||||||
typo ex = if take 1 ex == "\"" then itf (init (tail ex)) else ex
|
typo ex = if take 1 ex == "\"" then itf (init (tail ex)) else ex
|
||||||
@@ -272,8 +270,7 @@ stitle s = append $ "==" ++ s ++ "=="
|
|||||||
include s = append $ "%!include: " ++ s
|
include s = append $ "%!include: " ++ s
|
||||||
space = append "\n"
|
space = append "\n"
|
||||||
delimit ss = mapM_ append ss
|
delimit ss = mapM_ append ss
|
||||||
link s f = append $ s ++ " [``" ++ f ++ "`` " ++ fa ++ "]" where
|
link s f = append $ s ++ " [``" ++ f ++ "`` " ++ f ++ "]"
|
||||||
fa = "http://www.grammaticalframework.org/lib" ++ dropWhile (=='.') f
|
|
||||||
|
|
||||||
ttf s = "``" ++ s ++ "``"
|
ttf s = "``" ++ s ++ "``"
|
||||||
itf s = "//" ++ s ++ "//"
|
itf s = "//" ++ s ++ "//"
|
||||||
@@ -337,5 +334,5 @@ readFileC cod file = do
|
|||||||
coding file = case language file of
|
coding file = case language file of
|
||||||
"Bul" -> "CP1251" --- "ISO-8859-1"
|
"Bul" -> "CP1251" --- "ISO-8859-1"
|
||||||
_ -> "utf8"
|
_ -> "utf8"
|
||||||
|
where
|
||||||
language = reverse . take 3 . drop 3 . reverse
|
language = reverse . take 3 . drop 3 . reverse
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
The ``Prelude`` defines commonly used utility functions, in particular for
|
The ``Prelude`` defines commonly used utility functions, in particular for
|
||||||
strings and booleans.
|
strings and booleans.
|
||||||
|
|
||||||
|| Oper | Type | Explanation ||
|
|| Oper | Type | Explanation |
|
||||||
| ``SS`` | ``Type`` | the type ``{s : Str}``
|
| ``SS`` | ``Type`` | the type ``{s : Str}``
|
||||||
| ``ss`` | ``Str -> SS`` | record from string
|
| ``ss`` | ``Str -> SS`` | record from string
|
||||||
| ``nonExist`` | ``Str`` | missing form
|
| ``nonExist`` | ``Str`` | missing form
|
||||||
@@ -30,7 +30,7 @@ strings and booleans.
|
|||||||
|
|
||||||
These functions are hard-coded in GF. They are available without explicit opening, by the used of qualified names, e.g. ``Predef.tk``.
|
These functions are hard-coded in GF. They are available without explicit opening, by the used of qualified names, e.g. ``Predef.tk``.
|
||||||
|
|
||||||
|| operation | type | explanation ||
|
|| Oper | Type | Explanation |
|
||||||
| ``PBool`` | ``PType`` | ``PTrue | PFalse``
|
| ``PBool`` | ``PType`` | ``PTrue | PFalse``
|
||||||
| ``Error`` | ``Type`` | the empty type
|
| ``Error`` | ``Type`` | the empty type
|
||||||
| ``Integer`` | ``Type`` | the type of integers
|
| ``Integer`` | ``Type`` | the type of integers
|
||||||
@@ -57,7 +57,7 @@ These functions are hard-coded in GF. They are available without explicit openin
|
|||||||
This module is used for defining formal languages, in particular ones that
|
This module is used for defining formal languages, in particular ones that
|
||||||
use precedence levels and parentheses for grouping subexpressions.
|
use precedence levels and parentheses for grouping subexpressions.
|
||||||
|
|
||||||
|| Oper | Type | Explanation ||
|
|| Oper | Type | Explanation |
|
||||||
| ``Prec`` | ``PType`` | precedence levels 0..4
|
| ``Prec`` | ``PType`` | precedence levels 0..4
|
||||||
| ``TermPrec`` | ``Type`` | string with precedence
|
| ``TermPrec`` | ``Type`` | string with precedence
|
||||||
| ``mkPrec`` | ``Prec -> Str -> TermPrec`` | construct a ``TermPrec``
|
| ``mkPrec`` | ``Prec -> Str -> TermPrec`` | construct a ``TermPrec``
|
||||||
@@ -75,7 +75,7 @@ This module is used for embedding symbolic notation in natural-language
|
|||||||
text constructed by the resource grammar API. It works for all resource
|
text constructed by the resource grammar API. It works for all resource
|
||||||
languages.
|
languages.
|
||||||
|
|
||||||
|| Function | Type | Example ||
|
|| Function | Type | Explanation |
|
||||||
| ``symb`` | ``Str -> NP`` | //x//
|
| ``symb`` | ``Str -> NP`` | //x//
|
||||||
| ``symb`` | ``Int -> NP`` | //23//
|
| ``symb`` | ``Int -> NP`` | //23//
|
||||||
| ``symb`` | ``Float -> NP`` | //0.99//
|
| ``symb`` | ``Float -> NP`` | //0.99//
|
||||||
@@ -92,7 +92,7 @@ languages.
|
|||||||
This module gives shortcuts for defining predicates (``pred``) and function
|
This module gives shortcuts for defining predicates (``pred``) and function
|
||||||
expressions (``app``). It works for all resource languages.
|
expressions (``app``). It works for all resource languages.
|
||||||
|
|
||||||
|| Function | Type | Example ||
|
|| Function | Type | Explanation |
|
||||||
| ``pred`` | ``V -> NP -> Cl`` | //x converges//
|
| ``pred`` | ``V -> NP -> Cl`` | //x converges//
|
||||||
| ``pred`` | ``V2 -> NP -> NP -> Cl`` | //x intersects y//
|
| ``pred`` | ``V2 -> NP -> NP -> Cl`` | //x intersects y//
|
||||||
| ``pred`` | ``V -> NP -> NP -> Cl`` | //x and y intersect//
|
| ``pred`` | ``V -> NP -> NP -> Cl`` | //x and y intersect//
|
||||||
@@ -111,5 +111,3 @@ expressions (``app``). It works for all resource languages.
|
|||||||
| ``app`` | ``N2 -> NP -> CN`` | //divisor of x//
|
| ``app`` | ``N2 -> NP -> CN`` | //divisor of x//
|
||||||
| ``app`` | ``N3 -> NP -> NP -> CN`` | //path from x to y//
|
| ``app`` | ``N3 -> NP -> NP -> CN`` | //path from x to y//
|
||||||
| ``app`` | ``N2 -> NP -> NP -> CN`` | //path between x and y//
|
| ``app`` | ``N2 -> NP -> NP -> CN`` | //path between x and y//
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,12 +8,10 @@ of //C// that takes //D// as an argument. What the constructors exactly are,
|
|||||||
and what other arguments they take, is described by separate tables for
|
and what other arguments they take, is described by separate tables for
|
||||||
each category.
|
each category.
|
||||||
|
|
||||||
| [categories.png] |
|
[categories.png]
|
||||||
|
|
||||||
%!include(html): ''categories-imagemap.html''
|
%!include(html): ''categories-imagemap.html''
|
||||||
|
|
||||||
|
|
||||||
The rectangular boxes mark open lexical categories, which have constructors
|
The rectangular boxes mark open lexical categories, which have constructors
|
||||||
also in the ``Paradigms`` modules.
|
also in the ``Paradigms`` modules.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -88,12 +88,3 @@ abstract functions and their Universal Dependency labels
|
|||||||
Cambridge, pp. 281--308, 2009).
|
Cambridge, pp. 281--308, 2009).
|
||||||
The library from a software engineering point of view.
|
The library from a software engineering point of view.
|
||||||
[PDF http://www.cse.chalmers.se/~aarne/old/articles/libraries-kahn.pdf]
|
[PDF http://www.cse.chalmers.se/~aarne/old/articles/libraries-kahn.pdf]
|
||||||
|
|
||||||
|
|
||||||
Many examples in [Chapter 2 #toc5] can be seen in multiple languages by hovering the
|
|
||||||
mouse over the example, as shown in the following screenshot:
|
|
||||||
|
|
||||||
[hovering.png]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
|
/* Quick links */
|
||||||
|
|
||||||
#quicklinks {
|
#quicklinks {
|
||||||
line-height: 130%;
|
line-height: 140%;
|
||||||
}
|
}
|
||||||
|
|
||||||
#quicklinks.sidebar {
|
#quicklinks.sidebar {
|
||||||
@@ -11,3 +13,23 @@
|
|||||||
#quicklinks a {
|
#quicklinks a {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Reveal popup */
|
||||||
|
|
||||||
|
.popup {
|
||||||
|
display: none;
|
||||||
|
background: #ffffccee;
|
||||||
|
border: 1px solid #dee2e6;
|
||||||
|
padding: 1em 1em 1em 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.reveal:hover .popup {
|
||||||
|
display: block;
|
||||||
|
position: absolute;
|
||||||
|
margin: 0 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* General */
|
||||||
|
.table td, .table th {
|
||||||
|
padding: 0.5em .75rem;
|
||||||
|
}
|
||||||
|
|||||||
@@ -13,10 +13,10 @@ $if(keywords)$
|
|||||||
<meta name="keywords" content="$for(keywords)$$keywords$$sep$, $endfor$" />
|
<meta name="keywords" content="$for(keywords)$$keywords$$sep$, $endfor$" />
|
||||||
$endif$
|
$endif$
|
||||||
<title>$if(title-prefix)$$title-prefix$ – $endif$$pagetitle$</title>
|
<title>$if(title-prefix)$$title-prefix$ – $endif$$pagetitle$</title>
|
||||||
|
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
|
||||||
$for(css)$
|
$for(css)$
|
||||||
<link rel="stylesheet" href="$css$" />
|
<link rel="stylesheet" href="$css$" />
|
||||||
$endfor$
|
$endfor$
|
||||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
|
|
||||||
$if(math)$
|
$if(math)$
|
||||||
$math$
|
$math$
|
||||||
$endif$
|
$endif$
|
||||||
|
|||||||
Reference in New Issue
Block a user