-- ** Type 'Errors'
data Errors a = Errors
- { errors_tag_unknown :: HM.HashMap Ident a
- , errors_tag_ambiguous :: HM.HashMap Ident a
- , errors_rref_unknown :: HM.HashMap Ident a
+ { errors_at_unknown :: HM.HashMap Ident a
+ , errors_at_ambiguous :: HM.HashMap Ident a
+ , errors_ref_unknown :: HM.HashMap Ident a
, errors_reference_ambiguous :: HM.HashMap Ident a
, errors_judgment_judges_unknown :: HM.HashMap Ident a
, errors_judgment_grades_unknown :: HM.HashMap Ident a
} deriving (Eq,Show)
instance Default (Errors a) where
def = Errors
- { errors_tag_unknown = def
- , errors_tag_ambiguous = def
- , errors_rref_unknown = def
+ { errors_at_unknown = def
+ , errors_at_ambiguous = def
+ , errors_ref_unknown = def
, errors_reference_ambiguous = def
, errors_judgment_judges_unknown = def
, errors_judgment_judge_unknown = def
}
instance Semigroup a => Semigroup (Errors a) where
x<>y = Errors
- { errors_tag_unknown = hm_union errors_tag_unknown
- , errors_tag_ambiguous = hm_union errors_tag_ambiguous
- , errors_rref_unknown = hm_union errors_rref_unknown
+ { errors_at_unknown = hm_union errors_at_unknown
+ , errors_at_ambiguous = hm_union errors_at_ambiguous
+ , errors_ref_unknown = hm_union errors_ref_unknown
, errors_reference_ambiguous = hm_union errors_reference_ambiguous
, errors_judgment_judges_unknown = hm_union errors_judgment_judges_unknown
, errors_judgment_judge_unknown = hm_union errors_judgment_judge_unknown
mappend = (<>)
instance Functor Errors where
fmap f Errors{..} = Errors
- { errors_tag_unknown = fmap f errors_tag_unknown
- , errors_tag_ambiguous = fmap f errors_tag_ambiguous
- , errors_rref_unknown = fmap f errors_rref_unknown
+ { errors_at_unknown = fmap f errors_at_unknown
+ , errors_at_ambiguous = fmap f errors_at_ambiguous
+ , errors_ref_unknown = fmap f errors_ref_unknown
, errors_reference_ambiguous = fmap f errors_reference_ambiguous
, errors_judgment_judges_unknown = fmap f errors_judgment_judges_unknown
, errors_judgment_judge_unknown = fmap f errors_judgment_judge_unknown
errors :: All -> Errors (Seq Location)
errors All{..} =
def -- FIXME: Errors
- { errors_tag_unknown =
- HM.difference all_tag all_section
- , errors_tag_ambiguous =
- HM.intersection all_tag $
+ { errors_at_unknown =
+ (fst <$>) <$>
+ HM.difference all_at all_section
+ , errors_at_ambiguous =
+ HM.intersection ((fst <$>) <$> all_at) $
HM.filter (\x -> length x > 1) all_section
- , errors_rref_unknown =
+ , errors_ref_unknown =
(fst <$>) <$>
- HM.difference all_rrefs all_reference
+ HM.difference all_ref all_reference
, errors_reference_ambiguous =
((&&&) reference_locTCT reference_posXML <$>)
<$> HM.filter (\x -> length x > 1) all_reference
, all_judgment :: HM.HashMap Judgment [Tree.Tree (Maybe MJ.Share, [Choice])]
, all_notes :: TS.Trees (Seq [Para])
, all_reference :: HM.HashMap Ident (Seq Reference)
- , all_rrefs :: HM.HashMap Ident (Seq ((TCT.Location, XML.Pos), Either Head Section))
+ , all_ref :: HM.HashMap Ident (Seq ((TCT.Location, XML.Pos), Either Head Section))
, all_section :: HM.HashMap Ident (Seq (Either Head Section))
- , all_tag :: HM.HashMap Ident (Seq (TCT.Location, XML.Pos))
+ , all_at :: HM.HashMap Ident (Seq ((TCT.Location, XML.Pos), Either Head Section))
+ , all_tag :: HM.HashMap Ident (Seq ((TCT.Location, XML.Pos), Either Head Section))
} deriving (Show)
instance Default All where
def = All
{ all_figure = def
, all_grades = def
- , all_irefs = TM.empty
+ , all_irefs = def
, all_judges = def
, all_judgment = def
, all_notes = def
, all_reference = def
- , all_rrefs = def
+ , all_ref = def
, all_section = def
+ , all_at = def
, all_tag = def
}
instance Semigroup All where
, all_judgment = hm_union all_judgment
, all_notes = ts_union (all_notes x) (all_notes y)
, all_reference = hm_union all_reference
- , all_rrefs = hm_union all_rrefs
+ , all_ref = hm_union all_ref
, all_section = hm_union all_section
+ , all_at = hm_union all_at
, all_tag = hm_union all_tag
} where
hm_union get = HM.unionWith (<>) (get x) (get y)
return def
{ all_irefs = TM.singleton path $ pure reader_section
} <> collect ts
- PlainTag{..} -> return def
- { all_tag = HM.singleton tag_ident $ pure (tag_locTCT, tag_posXML) }
- PlainRref{..} -> do
+ PlainAt{..}
+ | at_back -> return def
+ | otherwise -> do
Reader{..} <- R.ask
return def
- { all_rrefs = HM.singleton rref_to $ pure ((rref_locTCT, rref_posXML), reader_section)
+ { all_at = HM.singleton at_ident $ pure ((at_locTCT, at_posXML), reader_section) }
+ PlainTag{..}
+ | tag_back -> return def
+ | otherwise -> do
+ Reader{..} <- R.ask
+ return def
+ { all_tag = HM.singleton tag_ident $ pure ((tag_locTCT, tag_posXML), reader_section) }
+ PlainRef{..} -> do
+ Reader{..} <- R.ask
+ return def
+ { all_ref = HM.singleton ref_ident $ pure ((ref_locTCT, ref_posXML), reader_section)
} <> collect ts
instance Collect Reference where
collect Reference{..} =
| PlainEref { eref_href :: !URL } -- ^ External reference
| PlainIref { iref_term :: !Words
} -- ^ Index reference
- | PlainRref { rref_locTCT :: !TCT.Location
- , rref_posXML :: !XML.Pos
- , rref_to :: !Ident
+ | PlainRef { ref_locTCT :: !TCT.Location
+ , ref_posXML :: !XML.Pos
+ , ref_ident :: !Ident
} -- ^ Reference reference
| PlainSpan { attrs :: !CommonAttrs } -- ^ Neutral node
-- Leafs
, tag_posXML :: !XML.Pos
, tag_ident :: !Ident
} -- ^ Tag
+ | PlainAref { aref_locTCT :: !TCT.Location
+ , aref_posXML :: !XML.Pos
+ , aref_ident :: !Ident
+ } -- ^ Ref
deriving (Eq,Show)
{-
PlainGroup -> skip
PlainNote{} -> skip
PlainIref{..} -> keep
- PlainRref{..} -> pure $ TS.Tree PlainRref{ rref_locTCT = def
- , rref_posXML = def
- , .. } skip
+ PlainRef{..} -> pure $ TS.Tree PlainRef{ ref_locTCT = def
+ , ref_posXML = def
+ , .. } skip
PlainSpan attrs -> pure $ TS.Tree n' skip
where n' = PlainSpan{attrs = CommonAttrs{ attrs_id = Nothing
, attrs_classes = List.sort $ attrs_classes attrs }}
PlainSup -> keep
PlainU -> keep
PlainEref{..} -> keep
+ PlainAt{..} -> pure $ TS.Tree PlainAt{at_locTCT=def, at_posXML=def, ..} skip
PlainTag{..} -> pure $ TS.Tree PlainTag{tag_locTCT=def, tag_posXML=def, ..} skip
PlainBreak -> keep
PlainText{} -> keep
PlainGroup -> s
PlainNote{} -> s
PlainIref{..} -> s`hashWithSalt`(0::Int)`hashWithSalt`iref_term
- PlainTag{..} -> s`hashWithSalt`(1::Int)`hashWithSalt`tag_ident
- PlainSpan{..} -> s`hashWithSalt`(2::Int)`hashWithSalt`List.sort (attrs_classes attrs)
- PlainB -> s`hashWithSalt`(3::Int)
- PlainCode -> s`hashWithSalt`(4::Int)
- PlainDel -> s`hashWithSalt`(5::Int)
- PlainI -> s`hashWithSalt`(6::Int)
- PlainQ -> s`hashWithSalt`(7::Int)
- PlainSC -> s`hashWithSalt`(8::Int)
- PlainSub -> s`hashWithSalt`(9::Int)
- PlainSup -> s`hashWithSalt`(10::Int)
- PlainU -> s`hashWithSalt`(11::Int)
- PlainEref{..} -> s`hashWithSalt`(12::Int)`hashWithSalt`eref_href
- PlainRref{..} -> s`hashWithSalt`(13::Int)`hashWithSalt`rref_to
- PlainBreak -> s`hashWithSalt`(14::Int)
- PlainText t -> s`hashWithSalt`(15::Int)`hashWithSalt`t
+ PlainTag{..} -> s`hashWithSalt`(1::Int)`hashWithSalt`tag_ident`hashWithSalt`tag_back
+ PlainAt{..} -> s`hashWithSalt`(2::Int)`hashWithSalt`at_ident`hashWithSalt`at_back
+ PlainSpan{..} -> s`hashWithSalt`(3::Int)`hashWithSalt`List.sort (attrs_classes attrs)
+ PlainB -> s`hashWithSalt`(4::Int)
+ PlainCode -> s`hashWithSalt`(5::Int)
+ PlainDel -> s`hashWithSalt`(6::Int)
+ PlainI -> s`hashWithSalt`(7::Int)
+ PlainQ -> s`hashWithSalt`(8::Int)
+ PlainSC -> s`hashWithSalt`(9::Int)
+ PlainSub -> s`hashWithSalt`(10::Int)
+ PlainSup -> s`hashWithSalt`(11::Int)
+ PlainU -> s`hashWithSalt`(12::Int)
+ PlainEref{..} -> s`hashWithSalt`(13::Int)`hashWithSalt`eref_href
+ PlainRef{..} -> s`hashWithSalt`(14::Int)`hashWithSalt`ref_ident
+ PlainBreak -> s`hashWithSalt`(15::Int)
+ PlainText t -> s`hashWithSalt`(16::Int)`hashWithSalt`t
-- ** Type 'Entity'
data Entity = Entity
head :: repr DTC.Head
about :: repr DTC.About
header :: repr DTC.Header
- tag :: repr TL.Text
body :: repr DTC.Body
include :: repr DTC.Include
, element "note" $ tree0 . DTC.PlainNote <$> many para
, element "iref" $ Tree . DTC.PlainIref . Index.wordify <$> attribute "to" text <*> plain
, element "eref" $ Tree . DTC.PlainEref <$> attribute "to" url <*> plain
- , element "tag" $ tree0 <$> (DTC.PlainTag <$> locationTCT <*> positionXML <*> ident)
- , element "rref" $ Tree <$> (DTC.PlainRref <$> locationTCT <*> positionXML <*> to) <*> plain
+ , element "tag" $ tree0 <$> (DTC.PlainTag <$> locationTCT <*> positionXML <*> to <*> pure False)
+ , element "tag-back" $ tree0 <$> (DTC.PlainTag <$> locationTCT <*> positionXML <*> to <*> pure True )
+ , element "at" $ tree0 <$> (DTC.PlainAt <$> locationTCT <*> positionXML <*> to <*> pure False)
+ , element "at-back" $ tree0 <$> (DTC.PlainAt <$> locationTCT <*> positionXML <*> to <*> pure True )
+ , element "ref" $ Tree <$> (DTC.PlainRef <$> locationTCT <*> positionXML <*> to) <*> plain
]
- tag = rule "tag" $ element "tag" text
about =
about_known
<*> many header
<|*> author
<|?> (def, Just <$> editor)
<|?> (def, Just <$> date)
- <|*> tag
+ <|*> element "tag" text
<|*> link
<|*> serie
<|?> (def, Just <$> element "description" para)
, void $ head
, void $ rule "about" $ element "about" about
, void $ header
- , void $ tag
, void $ author
, void $ editor
, void $ date
Analyze.irefsOfTerms terms
, state_notes
-}
- , state_rrefs
+ , state_ref
, state_section = body
, state_l10n = loqualize config_locale
, state_plainify = def{Plain.reader_l10n = loqualize config_locale}
"<"::HTML5
html5ify eref_href
">"
- PlainTag{..} -> do
+ PlainTag{..}
+ | tag_back -> do
+ Reader{reader_all=Analyze.All{..}} <- composeLift RWS.ask
+ State{state_errors=Analyze.Errors{..}} <- composeLift RWS.get
+ case HM.lookup tag_ident all_tag of
+ Nothing -> pure ()
+ Just anchs ->
+ H.span ! HA.class_ "tag-backs" $$
+ html5Commas $
+ (<$> List.zip (toList anchs) [1..]) $ \((_loc, maySection),num) ->
+ H.a ! HA.class_ "tag-back"
+ ! HA.href (refIdent $ identifyTag "-back" tag_ident $ Just $ Nat1 num) $$
+ html5ify maySection
+ | otherwise -> do
+ State{state_tag} <- composeLift RWS.get
+ let num = HM.lookupDefault (Nat1 1) tag_ident state_tag
+ composeLift $ RWS.modify $ \s -> s
+ { state_tag = HM.insert tag_ident (succNat1 num) state_tag }
+ H.span ! HA.class_ "tag"
+ ! HA.id (attrify $ identifyTag "-back" tag_ident $ Just num) $$
+ html5ify tag_ident
+ PlainAt{..}
+ | at_back -> do
+ Reader{reader_all=Analyze.All{..}} <- composeLift RWS.ask
+ State{state_errors=Analyze.Errors{..}} <- composeLift RWS.get
+ case HM.lookup at_ident all_at of
+ Nothing -> pure ()
+ Just anchs ->
+ H.span ! HA.class_ "at-backs" $$
+ html5Commas $
+ (<$> List.zip (toList anchs) [1..]) $ \((_loc, maySection),num) ->
+ H.a ! HA.class_ "at-back"
+ ! HA.href (refIdent $ identifyAt "-back" at_ident $ Just $ Nat1 num) $$
+ html5ify maySection
+ | otherwise -> do
Reader{..} <- composeLift RWS.ask
- State{state_errors=errs@Analyze.Errors{..}} <- composeLift RWS.get
+ State{state_errors=errs@Analyze.Errors{..}, ..} <- composeLift RWS.get
case () of
- _ | Just num <- HM.lookup tag_ident errors_tag_unknown -> do
+ _ | Just num <- HM.lookup at_ident errors_at_unknown -> do
composeLift $ RWS.modify $ \s -> s
{ state_errors = errs
- { Analyze.errors_tag_unknown =
- HM.adjust succNat1 tag_ident errors_tag_unknown } }
- H.span ! HA.class_ "tag tag-unknown"
- ! HA.id (attrify $ identifyTag "-unknown" tag_ident (Just num)) $$
- html5ify tag_ident
- | Just num <- HM.lookup tag_ident errors_tag_ambiguous -> do
+ { Analyze.errors_at_unknown =
+ HM.adjust succNat1 at_ident errors_at_unknown } }
+ H.span ! HA.class_ "at at-unknown"
+ ! HA.id (attrify $ identifyAt "-unknown" at_ident (Just num)) $$
+ html5ify at_ident
+ | Just num <- HM.lookup at_ident errors_at_ambiguous -> do
composeLift $ RWS.modify $ \s -> s
{ state_errors = errs
- { Analyze.errors_tag_ambiguous =
- HM.adjust succNat1 tag_ident errors_tag_ambiguous } }
- H.span ! HA.class_ "tag tag-ambiguous"
- ! HA.id (attrify $ identifyTag "-ambiguous" tag_ident (Just num)) $$
- html5ify tag_ident
+ { Analyze.errors_at_ambiguous =
+ HM.adjust succNat1 at_ident errors_at_ambiguous } }
+ H.span ! HA.class_ "at at-ambiguous"
+ ! HA.id (attrify $ identifyAt "-ambiguous" at_ident (Just num)) $$
+ html5ify at_ident
| otherwise -> do
- H.a ! HA.class_ "tag"
- ! HA.href (refIdent $ identifyTag "" tag_ident Nothing) $$
- html5ify tag_ident
- PlainRref{..} -> do
+ let num = HM.lookupDefault (Nat1 1) at_ident state_at
+ composeLift $ RWS.modify $ \s -> s
+ { state_at = HM.insert at_ident (succNat1 num) state_at }
+ H.a ! HA.class_ "at"
+ ! HA.href (refIdent $ identifyAt "" at_ident Nothing)
+ ! HA.id (attrify $ identifyAt "-back" at_ident $ Just num) $$
+ html5ify at_ident
+ PlainRef{..} -> do
Reader{reader_all=Analyze.All{..}} <- composeLift RWS.ask
State{state_errors=errs@Analyze.Errors{..}, ..} <- composeLift RWS.get
- case toList $ HM.lookupDefault def rref_to all_reference of
+ case toList $ HM.lookupDefault def ref_ident all_reference of
[] -> do
- let num = HM.lookup rref_to errors_rref_unknown
+ let num = HM.lookup ref_ident errors_ref_unknown
composeLift $ RWS.modify $ \s -> s
{ state_errors = errs
- { Analyze.errors_rref_unknown =
- HM.adjust succNat1 rref_to errors_rref_unknown } }
- "["::HTML5
+ { Analyze.errors_ref_unknown =
+ HM.adjust succNat1 ref_ident errors_ref_unknown } }
H.span ! HA.class_ "reference reference-unknown"
- ! HA.id (attrify $ identifyReference "-unknown" rref_to num) $$
- html5ify rref_to
- "]"
+ ! HA.id (attrify $ identifyReference "-unknown" ref_ident num) $$ do
+ "["::HTML5
+ html5ify ref_ident
+ "]"
[Reference{..}] -> do
- let num = HM.lookupDefault (Nat1 1) rref_to state_rrefs
+ let num = HM.lookupDefault (Nat1 1) ref_ident state_ref
composeLift $ RWS.modify $ \s -> s
- { state_rrefs = HM.insert rref_to (succNat1 num) state_rrefs }
- let a =
- H.a ! HA.class_ "reference"
- ! HA.href (refIdent $ identifyReference "" rref_to Nothing)
- ! HA.id (attrify $ identifyReference "" rref_to $ Just num)
+ { state_ref = HM.insert ref_ident (succNat1 num) state_ref }
+ let a = H.a ! HA.href (refIdent $ identifyReference "" ref_ident Nothing)
let ref = do
- "["::HTML5
- a $$ html5ify rref_to
- "]"
+ H.span ! HA.class_ "reference"
+ ! HA.id (attrify $ identifyReference "" ref_ident $ Just num) $$ do
+ "["::HTML5
+ a $$ html5ify ref_ident
+ "]"
case toList ps of
[] -> ref
[Tree (PlainText "") _] -> do
refs <- composeLift $ RWS.asks $ Analyze.all_reference . reader_all
- case toList <$> HM.lookup rref_to refs of
+ case toList <$> HM.lookup ref_ident refs of
Just [Reference{reference_about=About{..}}] -> do
forM_ (List.take 1 about_titles) $ \(Title title) -> do
html5ify $ Tree PlainQ $
_ -> do
html5ify ps
" "::HTML5
- "["::HTML5
- H.span ! HA.class_ "reference reference-ambiguous" $$
- html5ify rref_to
- "]"
+ H.span ! HA.class_ "reference reference-ambiguous" $$ do
+ "["::HTML5
+ html5ify ref_ident
+ "]"
PlainIref{..} ->
case pathFromWords iref_term of
Nothing -> html5ify ps
html5ify Entity{..} = do
case () of
_ | not (TL.null entity_email) -> do
- H.span ! HA.class_ "no-print" $$
+ H.span ! HA.class_ "no-print" $$ do
html5ify $
Tree (PlainEref $ URL $ "mailto:"<>entity_email) $
pure $ tree0 $ PlainText entity_name
+ html5ify $ orgs entity_org
H.span ! HA.class_ "print-only" $$
html5ify $
Tree (PlainEref $ URL entity_email) $
pure $ tree0 $ PlainText $
- entity_name <> orgs entity_org
+ entity_name <> orgs entity_org
where
orgs = maybe "" $ \Entity{entity_name=name, entity_org=org} -> " ("<>name<>orgs org<>")"
_ | Just u <- entity_url ->
"]"
H.td ! HA.class_ "reference-content" $$ do
html5ify reference_about
- case HM.lookup reference_id all_rrefs of
+ case HM.lookup reference_id all_ref of
Nothing -> pure ()
Just anchs ->
when (isNothing $ HM.lookup reference_id errors_reference_ambiguous) $ do
- H.p ! HA.class_ "reference-rrefs" $$
+ H.p ! HA.class_ "ref-backs" $$
html5CommasDot $
(<$> List.zip (toList anchs) [1..]) $ \((_loc, maySection),num) ->
- H.a ! HA.class_ "reference-rref"
- ! HA.href (refIdent $ identifyReference "" reference_id $ Just $ Nat1 num) $$
- case maySection of
- Left{} -> "0"::HTML5
- Right Section{section_posXML=posSection} ->
- html5ify $ XML.pos_ancestors posSection
+ H.a ! HA.class_ "ref-back"
+ ! HA.href (refIdent $ identifyReference "" reference_id $ Just $ Nat1 num) $$
+ html5ify maySection
+instance Html5ify (Either Head Section) where
+ html5ify = \case
+ Left{} -> "0"::HTML5
+ Right Section{section_posXML=posSection} ->
+ html5ify $ XML.pos_ancestors posSection
instance Html5ify XML.Ancestors where
html5ify ancs =
case toList ancs of
(<>) = mappend
-}
+html5Commas :: [HTML5] -> HTML5
+html5Commas [] = pure ()
+html5Commas hs = do
+ sequence_ $ List.intersperse ", " hs
+
html5CommasDot :: [HTML5] -> HTML5
html5CommasDot [] = pure ()
html5CommasDot hs = do
- sequence_ $ List.intersperse ", " hs
+ html5Commas hs
"."
html5Lines :: [HTML5] -> HTML5
import qualified Hdoc.DTC.Analyze.Collect as Analyze
import qualified Hdoc.DTC.Analyze.Index as Analyze
import qualified Hdoc.DTC.Write.Plain as Plain
-import qualified Hdoc.XML as XML
import qualified Text.Blaze.Internal as B
-- * Type 'HTML5'
data State = State
{ state_section :: !(TS.Trees BodyNode)
, state_errors :: !(Analyze.Errors Nat1)
- , state_rrefs :: !(HM.HashMap Ident Nat1)
+ , state_ref :: !(HM.HashMap Ident Nat1)
+ , state_at :: !(HM.HashMap Ident Nat1)
+ , state_tag :: !(HM.HashMap Ident Nat1)
, state_irefs :: !(TM.TreeMap Word Nat1)
, state_indices :: ![(Terms, Analyze.Index)]
, state_notes :: ![Seq [Para]]
def = State
{ state_section = def
, state_errors = def
- , state_rrefs = def
+ , state_ref = def
+ , state_at = def
+ , state_tag = def
, state_irefs = def
, state_indices = def
, state_notes = def
( Plain.L10n msg lang
, Plain.L10n TL.Text lang
) => L10n msg lang where
- l10n_Header_Address :: FullLocale lang -> msg
- l10n_Header_Date :: FullLocale lang -> msg
- l10n_Header_Version :: FullLocale lang -> msg
- l10n_Header_Origin :: FullLocale lang -> msg
- l10n_Header_Source :: FullLocale lang -> msg
- l10n_Errors_All :: FullLocale lang -> Nat -> msg
- l10n_Error_Tag_unknown :: FullLocale lang -> msg
- l10n_Error_Tag_ambiguous :: FullLocale lang -> msg
- l10n_Error_Rref_unknown :: FullLocale lang -> msg
- l10n_Error_Reference_ambiguous :: FullLocale lang -> msg
+ l10n_Header_Address :: FullLocale lang -> msg
+ l10n_Header_Date :: FullLocale lang -> msg
+ l10n_Header_Version :: FullLocale lang -> msg
+ l10n_Header_Origin :: FullLocale lang -> msg
+ l10n_Header_Source :: FullLocale lang -> msg
+ l10n_Errors_All :: FullLocale lang -> Nat -> msg
+ l10n_Error_At_unknown :: FullLocale lang -> msg
+ l10n_Error_At_ambiguous :: FullLocale lang -> msg
+ l10n_Error_Rref_unknown :: FullLocale lang -> msg
+ l10n_Error_Reference_ambiguous :: FullLocale lang -> msg
l10n_Error_Judgment_Judges_unknown :: FullLocale lang -> msg
l10n_Error_Judgment_Judge_unknown :: FullLocale lang -> msg
l10n_Error_Judgment_Judge_duplicated :: FullLocale lang -> msg
l10n_Header_Source _l10n = "Source"
l10n_Header_Version _l10n = "Version"
l10n_Errors_All _l10n n = "All errors ("<>html5ify n<>")"
- l10n_Error_Tag_unknown _l10n = "Unknown tag"
- l10n_Error_Tag_ambiguous _l10n = "Ambiguous tag"
+ l10n_Error_At_unknown _l10n = "Unknown anchor"
+ l10n_Error_At_ambiguous _l10n = "Ambiguous anchor"
l10n_Error_Rref_unknown _l10n = "Unknown reference"
l10n_Error_Reference_ambiguous _l10n = "Ambiguous reference"
l10n_Error_Judgment_Judges_unknown _l10n = "Unknown judges"
l10n_Header_Source _l10n = "Source"
l10n_Header_Version _l10n = "Version"
l10n_Errors_All _l10n n = "Toutes les erreurs ("<>html5ify n<>")"
- l10n_Error_Tag_unknown _l10n = "Tag inconnu"
- l10n_Error_Tag_ambiguous _l10n = "Tag ambigu"
+ l10n_Error_At_unknown _l10n = "Ancre inconnue"
+ l10n_Error_At_ambiguous _l10n = "Ancre ambiguë"
l10n_Error_Rref_unknown _l10n = "Référence inconnue"
l10n_Error_Reference_ambiguous _l10n = "Référence ambiguë"
l10n_Error_Judgment_Judges_unknown _l10n = "Juges inconnu·es"
(\errKind (errKindDescr, errByPosByKey) ->
(errKind, errKindDescr l10n, errByPosByKey))
[1::Int ..]
- [ (l10n_Error_Tag_unknown , errorTag "-unknown" errors_tag_unknown)
- , (l10n_Error_Tag_ambiguous , errorTag "-ambiguous" errors_tag_ambiguous)
- , (l10n_Error_Rref_unknown , errorReference "-unknown" errors_rref_unknown)
+ [ (l10n_Error_At_unknown , errorAt "-unknown" errors_at_unknown)
+ , (l10n_Error_At_ambiguous , errorAt "-ambiguous" errors_at_ambiguous)
+ , (l10n_Error_Rref_unknown , errorReference "-unknown" errors_ref_unknown)
, (l10n_Error_Reference_ambiguous , errorReference "-ambiguous" errors_reference_ambiguous)
, (l10n_Error_Judgment_Judges_unknown , errorIdent errors_judgment_judges_unknown)
, (l10n_Error_Judgment_Grades_unknown , errorIdent errors_judgment_grades_unknown)
H.div ! HA.class_ "error-filter"
! HA.id (attrify $ errorType num) $$
filterIds es h
- errorTag :: Ident -> HM.HashMap Ident (Seq (TCT.Location, XML.Pos)) -> [(Plain, [(TCT.Location,Ident)])]
- errorTag suffix errs =
- (<$> HM.toList errs) $ \(tag, errPositions) ->
- ( pure $ tree0 $ PlainText $ unIdent tag
+ errorAt :: Ident -> HM.HashMap Ident (Seq (TCT.Location, XML.Pos)) -> [(Plain, [(TCT.Location,Ident)])]
+ errorAt suffix errs =
+ (<$> HM.toList errs) $ \(ref, errPositions) ->
+ ( pure $ tree0 $ PlainText $ unIdent ref
, List.zipWith
- (\num (locTCT, _posXML) -> (locTCT, identifyTag suffix tag (Just $ Nat1 num)))
+ (\num (locTCT, _posXML) -> (locTCT, identifyAt suffix ref (Just $ Nat1 num)))
[1::Int ..] (toList errPositions)
)
errorReference :: Ident -> HM.HashMap Ident (Seq (TCT.Location, XML.Pos)) -> [(Plain, [(TCT.Location,Ident)])]
<> escapeIdent (unIdent tag)
<> maybe "" (("."<>) . identify) count
+identifyAt :: Ident -> Ident -> Maybe Nat1 -> Ident
+identifyAt suffix ref count =
+ (if suffix == Ident ""
+ then ""
+ else "at" <> suffix <> ".")
+ <> escapeIdent (unIdent ref)
+ <> maybe "" (("."<>) . identify) count
+
identifyReference :: Ident -> Ident -> Maybe Nat1 -> Ident
identifyReference suffix to count =
"reference" <> suffix
PlainU -> "_"<>plainify ls<>"_"
PlainEref{..} -> plainify ls
PlainIref{..} -> plainify ls
- PlainTag{..} -> "#"<>plainify ls<>"#"
- PlainRref{..} -> plainify ls
+ PlainAt{..} -> (if at_back then "^" else mempty)<>"@"<>plainify ls<>"@"
+ PlainTag{..} -> (if tag_back then "^" else mempty)<>"#"<>plainify ls<>"#"
+ PlainRef{..} ->
+ (if null ls then mempty else "("<>plainify ls<> ")") <>
+ "["<>plainify (unIdent ref_ident)<>"]"
instance Plainify Title where
plainify (Title t) = plainify t
instance Plainify XML.Ancestors where
PlainU -> XML.u $ xmlify ts
PlainEref to -> XML.eref ! XA.to (attrify to) $ xmlify ts
PlainIref{..} -> XML.iref ! XA.term (attrify $ plainifyWords iref_term) $ xmlify ts
- PlainTag{..} -> XML.tag $ xmlify ts
- PlainRref{..} -> XML.rref ! XA.to (attrify rref_to) $ xmlify ts
+ PlainAt{..} -> (if at_back then XML.at_back else XML.at)
+ ! XA.to (attrify at_ident) $ xmlify ts
+ PlainTag{..} -> (if tag_back then XML.tag_back else XML.at)
+ ! XA.to (attrify tag_ident) $ xmlify ts
+ PlainRef{..} -> XML.ref ! XA.to (attrify ref_ident) $ xmlify ts
instance Xmlify About where
xmlify About{..} = do
import Data.Eq (Eq(..))
import Data.Foldable (Foldable(..))
import Data.Function (($), (.))
-import Data.Functor ((<$>), ($>))
+import Data.Functor ((<$>), ($>), (<$))
import Data.List.NonEmpty (NonEmpty(..))
import Data.Maybe (Maybe(..))
import Data.Monoid (Monoid(..))
closeImpaired :: Tokens -> (Cell Pair, Tokens) -> Tokens
closeImpaired acc (Cell loc@(s0:|lp) pair, toks) = -- debug0 "closeImpaired" $
case pair of
- -- NOTE: try to close 'PairHash' as 'TokenTag' instead of 'TokenPlain'.
- PairHash | Just (Cell (Span{span_end}:|_lt) tag, rest) <- tagFrom body ->
- Tree0 (Cell (s0{span_end}:|lp) $ NodeToken $ TokenTag tag) <| rest
+ -- NOTE: try to close 'PairTag' as 'TokenTag' instead of 'TokenText'.
+ PairTag isBackref | Just (Cell (Span{span_end}:|_lt) ref, rest) <- parseRef body ->
+ Tree0 (Cell (s0{span_end}:|lp) $ NodeToken $ TokenTag isBackref ref) <| rest
-- NOTE: use bp (not bt) to include the '#'
+ -- NOTE: try to close 'PairAt' as 'TokenAt' instead of 'TokenText'.
+ PairAt isBackref | Just (Cell (Span{span_end}:|_lt) ref, rest) <- parseRef body ->
+ Tree0 (Cell (s0{span_end}:|lp) $ NodeToken $ TokenAt isBackref ref) <| rest
+ -- NOTE: use bp (not bt) to include the '@'
_ -> pure open `unionTokens` body
where
body = toks `unionTokens` acc
open a p = openPair a p
LexemePairClose ps -> foldl' closePair acc ps
LexemePairAny ps -> foldl' openPair acc ps
- {-
- LexemePairAny ps ->
- appendPairsText acc $ sconcat $
- ((fst . pairBordersSingle) <$>) <$> ps
- -}
LexemePairBoth ps -> appendPairsTokens acc $ Seq.fromList $ toList $ Tree0 . (NodePair <$>) <$> ps
LexemeEscape c -> appendPairsToken acc $ Tree0 $ NodeToken . TokenEscape <$> c
LexemeLink t -> appendPairsToken acc $ Tree0 $ NodeToken . TokenLink <$> t
| LexemeWhite !(Cell TL.Text)
| LexemeAlphaNum !(Cell TL.Text)
| LexemeOther !(Cell TL.Text)
- | LexemeTree !(Tree (Cell Node))
+ | LexemeTree !(Tree (Cell Node)) -- FIXME: useless?
| LexemeEnd
deriving (Eq, Show)
instance Pretty Lexeme
-- ",,,AAA
an@LexemeAlphaNum{}:a@LexemeOther{}:LexemePairAny p:acc -> an:a:LexemePairClose p:acc
+ an@LexemeEscape{} :a@LexemeOther{}:LexemePairAny p:acc -> an:a:LexemePairClose p:acc
-- ,,,"AAA
an@LexemeAlphaNum{}:LexemePairAny p:a@LexemeOther{}:acc -> an:LexemePairOpen p:a:acc
+ an@LexemeEscape{} :LexemePairAny p:a@LexemeOther{}:acc -> an:LexemePairOpen p:a:acc
-- ")
c@LexemePairClose{}:LexemePairAny p:acc -> c:LexemePairClose p:acc
-- )"
LexemePairAny p:c@LexemePairClose{}:acc -> LexemePairClose p:c:acc
+ -- AAA#AAA
+ a1@LexemeAlphaNum{}:LexemePairAny p:a2@LexemeAlphaNum{}:acc ->
+ a1:LexemeOther (sconcat (((fst . pairBordersDouble) <$>) <$> p)):a2:acc
+
acc -> acc
p_Lexeme :: P.Tokens s ~ TL.Text => Parser e s Lexeme
[ P.try $ LexemeWhite <$> p_Cell p_Spaces1
, P.try $ LexemePairAny <$> p_some (p_Cell $ p_satisfyMaybe pairAny)
, P.try $ LexemePairBoth <$> p_some (P.try $ p_Cell p_ElemSingle)
- , P.try $ LexemePairOpen <$> p_some (p_Cell $ p_satisfyMaybe pairOpen <|> P.try p_ElemOpen)
+ , P.try $ LexemePairOpen <$> p_some (p_Cell $ p_satisfyMaybe pairOpen <|> P.try p_ElemOpen <|> P.try p_BackOpen)
, P.try $ LexemePairClose <$> p_some (p_Cell $ p_satisfyMaybe pairClose <|> P.try p_ElemClose)
, P.try $ LexemeEscape <$> p_Cell p_Escape
, P.try $ LexemeLink <$> p_Cell p_Link
- , P.try $ LexemeAlphaNum <$> p_Cell (P.takeWhile1P (Just "AlphaNum") Char.isAlphaNum)
+ , P.try $ LexemeAlphaNum <$> p_Cell p_AlphaNums1
, LexemeOther <$> p_Cell (TL.singleton <$> P.anyChar)
]
'`' -> Just PairBackquote
'_' -> Just PairUnderscore
'*' -> Just PairStar
- '#' -> Just PairHash
+ '#' -> Just $ PairTag False
+ '@' -> Just $ PairAt False
_ -> Nothing
pairOpen :: Char -> Maybe Pair
'»' -> Just PairFrenchquote
_ -> Nothing
+p_BackOpen :: P.Tokens s ~ TL.Text => Parser e s Pair
+p_BackOpen = debugParser "BackOpen" $
+ P.char '^'
+ *> (PairAt True <$ P.char '@'
+ <|> PairTag True <$ P.char '#')
+
p_Escape :: Parser e s Char
p_Escape = P.char '\\' *> P.satisfy Char.isPrint
elemAttr_open <>
elemAttr_value <>
elemAttr_close
- PairHash -> ("#","#")
+ PairTag isBackref | isBackref -> ("^#","#")
+ | otherwise -> ("#","#")
+ PairAt isBackref | isBackref -> ("^@","@")
+ | otherwise -> ("@","@")
PairStar -> ("*","*")
PairSlash -> ("/","/")
PairUnderscore -> ("_","_")
PairBrace -> ("{","}")
PairBracket -> ("[","]")
--- * Class 'TagFrom'
-class TagFrom a where
- tagFrom :: a -> Maybe (Cell Tag, a)
-instance TagFrom Tokens where
- tagFrom ts =
+-- * Class 'ParseRef'
+class ParseRef a where
+ parseRef :: a -> Maybe (Cell Ref, a)
+instance ParseRef Tokens where
+ parseRef ts =
case Seq.viewl ts of
EmptyL -> Nothing
Tree0 (Cell loc0@(Span _f0 _b0 e0:|_l0) n) :< ns ->
case n of
NodeToken (TokenText t) ->
- case tagFrom $ Cell loc0 t of
+ case parseRef $ Cell loc0 t of
Nothing -> Nothing
Just (t0,r0) ->
if TL.null $ unCell r0
then
- case tagFrom ns of
+ case parseRef ns of
Just (t1@(Cell (Span _f1 b1 _e1:|_l1) _), r1) | e0 == b1 ->
Just (t0<>t1, r1)
_ -> Just (t0, ns)
where n0 = Tree0 $ NodeToken . TokenText <$> r0
_ -> Nothing
_ -> Nothing
-instance TagFrom (Cell TL.Text) where
- tagFrom (Cell (Span fp bp ep:|sp) t)
+instance ParseRef (Cell TL.Text) where
+ parseRef (Cell (Span fp bp ep:|sp) t)
| (w,r) <- TL.span isTagChar t
, not $ TL.null w
, ew <- pos_column bp + sum (Text.length <$> TL.toChunks w) =
Just
( Cell (Span fp bp bp{pos_column=ew}:|sp) w
, Cell (Span fp bp{pos_column=ew} ep:|sp) r )
- tagFrom _ = Nothing
+ parseRef _ = Nothing
isTagChar :: Char -> Bool
isTagChar c =
return $ HeaderSection $ List.length hs
, P.try $
HeaderBrackets
- <$> P.between (P.string "[") (P.string "]:")
+ <$> P.between (P.char '[') (P.string "]:")
(P.takeWhile1P (Just "Reference") isReferenceChar)
-- <* P.lookAhead (P.try $ P.eof <|> void (P.satisfy (=='\n')))
, P.try $
import Hdoc.TCT.Debug
-- * Type 'Root'
--- | A single 'Tree' to rule all the 'Node's
+-- | A single 'Tree' to gather all the 'Node's
-- simplifies greatly the navigation and transformations,
-- especially because the later XML or DTC output
-- are themselves a single tree-like data structure.
-- XML coming from the first parsing phase (eg. @('NodeHeader' ('HeaderEqual' "li" ""))@),
-- and XML coming from the second parsing phase (eg. @NodePair (PairElem "li" [])@).
--
--- For error reporting, each 'Node' is annotated with a 'Cell'
+-- For error reporting, indentation sensitivity and paragraph grouping,
+-- each 'Node' is annotated with a 'Cell'
-- spanning over all its content (sub-'Trees' included).
type Root = Tree (Cell Node)
type Roots = Trees (Cell Node)
-- * Type 'Pair'
data Pair
= PairElem !ElemName !ElemAttrs -- ^ @\<name a0=v0 a1=v1>text\</name>@
- | PairHash -- ^ @\#text#@
+ | PairTag Bool -- ^ @\#text#@ or @^\#text#@
+ | PairAt Bool -- ^ @\@text\@@ or @^\@text\@@
| PairStar -- ^ @*text*@
| PairSlash -- ^ @/text/@
| PairUnderscore -- ^ @_value_@
-- * Type 'Token'
data Token
= TokenText !TL.Text
- | TokenEscape !Char
+ | TokenEscape !Char -- ^ @\\char@
| TokenLink !Link
- | TokenTag !Tag
+ | TokenAt !Bool !Ref -- ^ @\@foo@ or @^\@foo@
+ | TokenTag !Bool !Ref -- ^ @\#foo@ or @^\#foo@
deriving (Eq,Show)
--- ** Type 'Tag'
-type Tag = TL.Text
-
-- ** Type 'Link'
type Link = TL.Text
+-- ** Type 'Ref'
+type Ref = TL.Text
+
-- * Type 'Row'
-- | In normal order: a list of 'Header's, maybe ended by 'Value', all read on the same line.
type Row = [Root]
html5ify tok =
case tok of
TokenText t -> html5ify t
- TokenTag v ->
+ TokenAt b v ->
+ H.span ! HA.class_ "at" $$ do
+ when b $
+ H.span ! HA.class_ "at-back" $$
+ html5ify '^'
+ H.span ! HA.class_ "at-open" $$
+ html5ify '@'
+ html5ify v
+ TokenTag b v ->
H.span ! HA.class_ "tag" $$ do
+ when b $
+ H.span ! HA.class_ "tag-back" $$
+ html5ify '^'
H.span ! HA.class_ "tag-open" $$
html5ify '#'
html5ify v
instance Plainify Token where
plainify = \case
TokenText t -> plainify t
- TokenTag t -> plainify '#' <> plainify t
+ TokenAt b r -> (if b then plainify '^' else mempty) <> plainify '@' <> plainify r
+ TokenTag b r -> (if b then plainify '^' else mempty) <> plainify '#' <> plainify r
TokenLink l -> plainify l
TokenEscape c -> do
esc <- S.gets state_escape
xmlAttrs [Cell sl ("to",lnk)] <>
xmlify inh ts
_ ->
- element "rref" $
+ element "ref" $
xmlAttrs [Cell sb ("to",Plain.writePlain bracket)] <>
if null ts -- NOTE: preserve empty parens
then Seq.singleton $ tree0 (XML.NodeText "" <$ cr)
PairBracket | to <- Plain.writePlain ts
, TL.all (\c -> c/='[' && c/=']' && Char.isPrint c && not (Char.isSpace c)) to ->
Seq.singleton $
- element "rref" $
+ element "ref" $
xmlAttrs [cell ("to",to)]
PairStar -> Seq.singleton $ element "b" $ xmlify inh ts
PairDash -> Seq.singleton $ element "del" $ xmlify inh ts
xmlify inh $
rs Seq.|> Tree0 (Cell sr (NodeToken (TokenText (TL.dropAround Char.isSpace r))))
_ -> xmlify inh ts
- PairHash ->
+ PairTag isBackref ->
Seq.singleton $
- element "tag" $
- xmlify inh{inh_para=[]} ts
+ element (if isBackref then "tag-back" else "tag") $
+ xmlAttrs [cell ("to",Plain.writePlain ts)]
+ -- xmlAttrs [cell ("to",to)]
+ -- xmlify inh{inh_para=[]} ts
-- xmlAttrs [cell ("to",Plain.writePlain ts)]
+ PairAt isBackref ->
+ Seq.singleton $
+ element (if isBackref then "at-back" else "at") $
+ xmlAttrs [cell ("to",Plain.writePlain ts)]
PairElem name attrs ->
Seq.singleton $
element (XML.localName name) $
case tok of
TokenEscape c -> Seq.singleton $ Tree0 $ cell $ XML.NodeText $ TL.singleton c
TokenText t -> Seq.singleton $ Tree0 $ cell $ XML.NodeText t
- TokenTag t -> Seq.singleton $ element "tag" $ Seq.singleton $ Tree0 $ cell $ XML.NodeText t
+ TokenAt b to -> Seq.singleton $ element (if b then "at-back" else "at") $
+ xmlAttrs [cell ("to",to)] -- Seq.singleton $ Tree0 $ cell $ XML.NodeText to
+ TokenTag b to -> Seq.singleton $ element (if b then "tag-back" else "tag") $
+ xmlAttrs [cell ("to",to)] -- Seq.singleton $ Tree0 $ cell $ XML.NodeText to
TokenLink lnk -> Seq.singleton $ element "eref" $ xmlAttrs [cell ("to",lnk)]
----------------------
NodeLower n as ->
, "area"
, "artwork"
, "aside"
+ , "at"
+ , "at-back"
, "audio"
, "author"
, "authors"
, "postamble"
, "preamble"
, "q"
+ , "ref"
, "reference"
, "references"
+ , "refs"
, "region"
- , "rref"
, "sc"
, "section"
, "serie"
, "sup"
, "table"
, "tag"
+ , "tag-back"
, "tbody"
, "td"
, "tel"
about = Parent "about" "<about" "</about>"
alias :: DTC -> DTC
alias = Parent "alias" "<alias" "</alias>"
+at :: DTC -> DTC
+at = Parent "at" "<at" "</at>"
+at_back :: DTC -> DTC
+at_back = Parent "at-back" "<at-back" "</at-back>"
artwork :: DTC -> DTC
artwork = Parent "artwork" "<artwork" "</artwork>"
aside :: DTC -> DTC
q = Parent "q" "<q" "</q>"
quote :: DTC -> DTC
quote = Parent "quote" "<quote" "</quote>"
+ref :: DTC -> DTC
+ref (Empty a) = Leaf "ref" "<ref" "/>" a
+ref x = Parent "ref" "<ref" "</ref>" x
reference :: DTC -> DTC
reference = Parent "reference" "<reference" "</reference>"
references :: DTC -> DTC
references = Parent "references" "<references" "</references>"
-rref :: DTC -> DTC
-rref (Empty a) = Leaf "rref" "<rref" "/>" a
-rref x = Parent "rref" "<rref" "</rref>" x
+refs :: DTC -> DTC
+refs = Parent "refs" "<refs" "</refs>"
sc :: DTC -> DTC
sc = Parent "sc" "<sc" "</sc>"
section :: DTC -> DTC
tag :: DTC -> DTC
-- tag (Empty a) = Leaf "tag" "<tag" "/>" a
tag = Parent "tag" "<tag" "</tag>"
+tag_back :: DTC -> DTC
+tag_back = Parent "tag-back" "<tag-back" "</tag-back>"
title :: DTC -> DTC
title = Parent "title" "<title" "</title>"
toc :: DTC
}
.reference-content > .reference-url {
}
- .reference-content > .reference-rrefs {
+ .reference-content > .ref-backs {
//margin-left:1ex;
}
- .reference-content > .reference-rrefs > .reference-rref {
+ .reference-content > .ref-backs > .ref-back {
background-color:#F4F2E2;
font-size:70%;
line-height:0;
white-space:nowrap;
padding-right:1em;
}
-/* .tag */
- .tag:target {
+/* .at */
+ .at:target {
background-color:#BFEFFF;
}
- .tag-unknown {
+ .at-unknown {
display:inline-box;
text-decoration-line:underline;
text-decoration-color:#C4451D;
text-decoration-style:solid;
}
- .tag-ambiguous {
+ .at-ambiguous {
display:inline-box;
text-decoration-line:underline overline;
text-decoration-color:#C4451D;
text-decoration-style:double;
}
-/* .rref */
+ .at-backs > .at-back {
+ background-color:#F4F2E2;
+ font-size:70%;
+ line-height:0;
+ position:relative;
+ vertical-align:baseline;
+ }
+/* .tag */
+ .tag {
+ color:#000080;
+ }
+ .tag:target {
+ background-color:#BFEFFF;
+ }
+ .tag-backs > .tag-back {
+ background-color:#F4F2E2;
+ font-size:70%;
+ line-height:0;
+ position:relative;
+ vertical-align:baseline;
+ }
+/* .reference */
.reference {
white-space:pre;
}
}
.tag,
+.at,
.pair-PairHash {
//color:blue;
//color:#CD853F;
}
.pair-open,
.pair-close,
+.at > .at-open,
.tag > .tag-open {
//color:#000080;
color:darkgrey;
" License: GNU General Public License, version 3 or later (at your option)
" Maintainer: Julien Moutinho <julm+hdoc@autogeree.net>
" URL: git://git.autogeree.net/hdoc
-" Version: v2017-08-24
+" Version: v2018-10-11
" Installation:
" Copy this file to ~/.vim/syntax/tct.vim
" then add this line to ~/.vimrc :
hi def link tctPlain Normal
" Block
-syn match tctPath /^\( *\([^<>:=| *`«»/"_,.;@^!?~%(){}[\]\\#&+]* *[:>]\|\[[^]]*\]\|- \|\( *\d\+\.\)\+\)\)* *\ze\([^<>:=| *`«»/"_,.;@^!?~%(){}[\]\\#&+]* *\([>=|@]\|: \|:$\)\|\[[^]]*\]\|-- \|- \|\( *\d\+\.\)\+\|#\+ \)/
+syn match tctPath /^\( *\([^<>:=| *`«»/"_,.;@^!?~%(){}[\]\\#&+]* *[:>]\|\[[^]]*\]\|- \|\( *\d\+\.\)\+\)\)* *\ze\([^<>:=| *`«»/"_,.;@^!?~%(){}[\]\\#&+]*\(@ \| *[>=|]\| *: \| *:$\)\|\[[^]]*\]\|-- \|- \|\( *\d\+\.\)\+\|@ \|#\+ \)/
\ contains=tctHeaderBird,tctHeaderColon,tctHeaderComment,tctHeaderUL,tctHeaderOL,tctHeaderBracket
\ nextgroup=@tctRowPath
syn cluster tctRowPath
\ contains=tctRowAt,tctRowBird,tctRowColon,tctRowEqual,tctRowBar,tctRowComment,tctRowUL,tctRowOL,tctRowBracket,tctRowSection
-syn match tctRowAt /[^<>:=| ]* *@/ contained contains=tctHeaderAt nextgroup=tctValueAt
-syn match tctRowBar /[^<>:=| ]* *|/ contained contains=tctHeaderBar nextgroup=tctValueBar
-syn match tctRowBird /[^<>:=| ]* *>/ contained contains=tctHeaderBird nextgroup=tctValueBird
-syn match tctRowColon /[^<>:=| ]* *:\ze\( \|$\)/ contained contains=tctHeaderColon nextgroup=tctValueColon
-syn match tctRowEqual /[^<>:=| ]* *=/ contained contains=tctHeaderEqual nextgroup=tctValueEqual
-syn match tctRowBracket /\[[^]]*\]/ contained contains=tctHeaderBracket nextgroup=tctValueBracket
-syn match tctRowComment /-- / contained contains=tctHeaderComment nextgroup=tctValueComment
-syn match tctRowUL /-\ze / contained contains=tctHeaderUL nextgroup=tctValueUL
+syn match tctRowAt /[^<>:=| ]*@ / contained contains=tctHeaderAt nextgroup=tctValueAt
+syn match tctRowBar /[^<>:=| ]* *|/ contained contains=tctHeaderBar nextgroup=tctValueBar
+syn match tctRowBird /[^<>:=| ]* *>/ contained contains=tctHeaderBird nextgroup=tctValueBird
+syn match tctRowColon /[^<>:=| ]* *:\ze\( \|$\)/ contained contains=tctHeaderColon nextgroup=tctValueColon
+syn match tctRowEqual /[^<>:=| ]* *=/ contained contains=tctHeaderEqual nextgroup=tctValueEqual
+syn match tctRowBracket /\[[^]]*\]/ contained contains=tctHeaderBracket nextgroup=tctValueBracket
+syn match tctRowComment /-- / contained contains=tctHeaderComment nextgroup=tctValueComment
+syn match tctRowUL /-\ze / contained contains=tctHeaderUL nextgroup=tctValueUL
syn match tctRowOL /\( *\d\+\.\)\+\ze\( \|$\)/ contained contains=tctHeaderOL nextgroup=tctValueOL
-syn match tctRowSection /#\+\ze / contained contains=tctHeaderSection nextgroup=tctValueSection
+syn match tctRowSection /#\+\ze / contained contains=tctHeaderSection nextgroup=tctValueSection
-syn match tctHeaderAt /[^<>:=| ]* *@/ contained contains=tctSymAt,tctSymDot
-syn match tctHeaderBar /[^<>:=| ]* *|/ contained contains=tctSymBar,tctSymDot
-syn match tctHeaderBird /[^<>:=| ]* *>/ contained contains=tctSymBird,tctSymDot
-syn match tctHeaderColon /[^<>:=| ]* *:\ze\( \|$\)/ contained contains=tctSymColon,@tctColons,tctSymDot
-syn match tctHeaderEqual /[^<>:=| ]* *=/ contained contains=tctSymEqual,tctSymDot
+syn match tctHeaderAt /[^<>:=| ]*@ / contained contains=tctSymAt,tctSymDot
+syn match tctHeaderBar /[^<>:=| ]* *|/ contained contains=tctSymBar,tctSymDot
+syn match tctHeaderBird /[^<>:=| ]* *>/ contained contains=tctSymBird,tctSymDot
+syn match tctHeaderColon /[^<>:=| ]* *:\ze\( \|$\)/ contained contains=tctSymColon,@tctColons,tctSymDot
+syn match tctHeaderEqual /[^<>:=| ]* *=/ contained contains=tctSymEqual,tctSymDot
syn match tctHeaderBracket /\[[^]]*\]/ contained contains=tctSymBracket,@tctInline
syn match tctHeaderComment /--/ contained
syn match tctHeaderUL /-/ contained
" Inline
syn match tctBold
- \ /\(^\|[ `’«»/"|_,.:…;@^!?=~%(){}[\]\\&+-]\)\zs\*[^ *]\([^*]*[^ *]\)\?\*\ze\([ `’«»/"|_,.:…;@^!?=~%(){}[\]\\&+-]\|$\)/
+ \ /\(^\|[ `’«»/"|,.:…;@^!?=~%(){}[\]\\&+]\)\zs\*[^ *]\([^*]*[^ *]\)\?\*\ze\([ `’«»/"|,.:…;@^!?=~%(){}[\]\\&+]\|$\)/
\ contained contains=@tctInline
syn match tctCode
- \ /\(^\|[ *’«»/"|_,.:…;@^!?=~%(){}[\]\\&+-]\)\zs`[^ `]\([^`]*[^ `]\)\?`\ze\([ *’«»/"|_,.:…;@^!?=~%(){}[\]\\&+-]\|$\)/
+ \ /\(^\|[ *’«»/"|,.:…;@^!?=~%(){}[\]\\&+]\)\zs`[^ `]\([^`]*[^ `]\)\?`\ze\([ *’«»/"|,.:…;@^!?=~%(){}[\]\\&+]\|$\)/
\ contained contains=@tctInline
syn match tctE
\ /<\/\?[^ >]\+\/\?>/
\ /«.\{-}»/
\ contained contains=@tctInline
syn match tctItalic
- \ /\(^\|[ *`’«»"'’|_,.:…;@^!?=~<>%(){}[\]\\#&+-]\)\zs\/[^ /]\([^/]*[^ /]\)\?\/\ze\([ *`’«»"'’|_,.:…;@^!?=~<>%(){}[\]\\#&+-]\|$\)/
+ \ /\(^\|[ *`’«»"'’|,.:…;@^!?=~<>%(){}[\]\\#&+]\)\zs\/[^ /]\([^/]*[^ /]\)\?\/\ze\([ *`’«»"'’|,.:…;@^!?=~<>%(){}[\]\\#&+]\|$\)/
\ contained contains=@tctInline
syn match tctQuote
- \ /\(^\|[ *`’«»/'’|_,.:…;@^!?=~<>%(){}[\]\\#&+-]\)\zs"[^ "]\([^"]*[^ "]\)\?"\ze\([ *`’«»/'’|_,.:…;@^!?=~<>%(){}[\]\\#&+-]\|$\)/
+ \ /\(^\|[ *`’«»/'’|,.:…;@^!?=~<>%(){}[\]\\#&+]\)\zs"[^ "]\([^"]*[^ "]\)\?"\ze\([ *`’«»/'’|,.:…;@^!?=~<>%(){}[\]\\#&+]\|$\)/
+ \ contained contains=@tctInline
+syn match tctAt
+ \ /\(^\|[ *`’«»/"'’|,.:…;^!?=~<>%(){}[\]\\#&+]\)\zs@\([^ @]\([^@]*[^ @]\)\?@\|[^@ *`’«»/"'’|,.:…;^!?=~<>%(){}[\]\\#&+]*[^@ *`’«»/"'’|,.:…;^!?=~<>%(){}[\]\\#&+]\)\ze\([ *`’«»/"'’|,.:…;^!?=~<>%(){}[\]\\#&+]\|$\)/
\ contained contains=@tctInline
syn match tctTag
- \ /\(^\|[ *`’«»/"'’|_,.:…;@^!?=~<>%(){}[\]\&+-]\)\zs#\([^ #]\([^#]*[^ #]\)\?#\|[^ #]*[^# *`’«»/"'’|_,.:…;@^!?=~<>%(){}[\]\\&+-]\)\ze\([ *`’«»/"'’|_,.:…;@^!?=~<>%(){}[\]\&+-]\|$\)/
+ \ /\(^\|[ *`’«»/"'’|,.:…;@^!?=~<>%(){}[\]\\&+]\)\zs#\([^ #]\([^#]*[^ #]\)\?#\|[^# *`’«»/"'’|,.:…;@^!?=~<>%(){}[\]\\&+]*[^# *`’«»/"'’|,.:…;@^!?=~<>%(){}[\]\\&+]\)\ze\([ *`’«»/"'’|,.:…;@^!?=~<>%(){}[\]\\&+]\|$\)/
\ contained contains=@tctInline
-syn match tctRRef
- \ /\(^\|[ *`’«»/"'’|_,.:…;@^!?=~<>%(){}\\#&+-]\)\zs\[[^[\] ]*\]\ze\([ *`’«»/"'’|_,.:…;@^!?=~<>%(){}\\#&+-]\|$\)/
+syn match tctRef
+ \ /\(^\|[ *`’«»/"'’|,.:…;@^!?=~<>%(){}\\#&+]\)\zs\[[^[\] ]*\]\ze\([ *`’«»/"'’|,.:…;@^!?=~<>%(){}\\#&+]\|$\)/
\ contained contains=@tctInline
syn match tctUnderline
- \ /\(^\|[ *`’«»/"'’|,.:…;@!?=~<>%(){}[\]\\#&+-]\)\zs_.*_\ze\([ *`’«»/"'’|,.:…;@!?=~<>%(){}[\]\\#&+-]\|$\)/
+ \ /\(^\|[ *`’«»/"'’|,.:…;@!?=~<>%(){}[\]\\#&+]\)\zs_.*_\ze\([ *`’«»/"'’|,.:…;@!?=~<>%(){}[\]\\#&+]\|$\)/
\ contained contains=@tctInline
syn match tctURL
\ /[a-z+-]\+:\/\/[^| \t[\]]*\(\[[^\]]*\]\)\?/
syn region tctAttrValue contained start=+'+ end=+'+ contains=tctEntity
-syn cluster tctInline contains=tctBold,tctCode,tctElem,tctElemEnd,tctEntity,tctQuoteFrench,tctItalic,tctQuote,tctTag,tctRref,tctUnderline,tctURL
+syn cluster tctInline contains=tctBold,tctCode,tctElem,tctElemEnd,tctEntity,tctQuoteFrench,tctItalic,tctQuote,tctAt,tctTag,tctRef,tctUnderline,tctURL
hi def link tctAttr Type
hi def link tctEntityPunct Type
hi tctItalic cterm=italic gui=italic
hi def link tctNamespace Tag
-hi tctQuote cterm=bold ctermfg=cyan guifg=cyan
-hi tctQuoteFrench cterm=bold ctermfg=green guifg=green
-hi tctTag cterm=bold ctermfg=cyan guifg=cyan
-hi tctRref ctermfg=cyan cterm=NONE guifg=DarkCyan
+hi tctQuote cterm=bold ctermfg=cyan guifg=cyan
+hi tctQuoteFrench cterm=bold ctermfg=green guifg=green
+hi tctTag cterm=bold ctermfg=cyan guifg=cyan
+hi tctAt ctermfg=red cterm=NONE guifg=DarkRed
+hi tctRef ctermfg=cyan cterm=NONE guifg=DarkCyan
hi def link tctElem Function
hi def link tctElemEnd Identifier
hi tctElemName cterm=bold ctermfg=yellow guifg=yellow