Add PairAt, TokenAt and PlainAt.
authorJulien Moutinho <julm+hdoc@autogeree.net>
Thu, 11 Oct 2018 00:42:39 +0000 (02:42 +0200)
committerJulien Moutinho <julm+hdoc@autogeree.net>
Fri, 12 Oct 2018 23:34:09 +0000 (01:34 +0200)
20 files changed:
Hdoc/DTC/Analyze/Check.hs
Hdoc/DTC/Analyze/Collect.hs
Hdoc/DTC/Document.hs
Hdoc/DTC/Sym.hs
Hdoc/DTC/Write/HTML5.hs
Hdoc/DTC/Write/HTML5/Base.hs
Hdoc/DTC/Write/HTML5/Error.hs
Hdoc/DTC/Write/HTML5/Ident.hs
Hdoc/DTC/Write/Plain.hs
Hdoc/DTC/Write/XML.hs
Hdoc/TCT/Read/Token.hs
Hdoc/TCT/Read/Tree.hs
Hdoc/TCT/Tree.hs
Hdoc/TCT/Write/HTML5.hs
Hdoc/TCT/Write/Plain.hs
Hdoc/TCT/Write/XML.hs
Text/Blaze/DTC.hs
style/dtc-html5.css
style/tct-html5.css
vim/syntax/tct.vim

index 63beb2314e03f5a7421641426b370e4652666c0a..8f6fb9cbab767651fb69ea0d4f13dbd84b2bb198 100644 (file)
@@ -20,9 +20,9 @@ import Hdoc.DTC.Analyze.Collect
 
 -- ** 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
@@ -34,9 +34,9 @@ data Errors a = Errors
  } 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
@@ -48,9 +48,9 @@ instance Default (Errors a) where
         }
 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
@@ -65,9 +65,9 @@ instance Semigroup a => Monoid (Errors a) where
        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
@@ -81,14 +81,15 @@ instance Functor Errors where
 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
index 636a66bddb9b71c5041b72d117c81fcab8217d29..8c3b731167dda8459b38a4e124aee14fe2bd4c47 100644 (file)
@@ -49,21 +49,23 @@ data All = All
  , 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
@@ -75,8 +77,9 @@ 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)
@@ -204,12 +207,22 @@ instance Collect (Tree PlainNode) where
                                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{..} =
index 6b83dec5dff0f115a7d23f0ab2f4a1e64b4ef689..07073952f746914d8037efd113eb25b5672763ab 100644 (file)
@@ -286,9 +286,9 @@ data PlainNode
  | 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
@@ -300,6 +300,10 @@ data PlainNode
              , tag_posXML :: !XML.Pos
              , tag_ident  :: !Ident
              } -- ^ Tag
+ | PlainAref { aref_locTCT :: !TCT.Location
+             , aref_posXML :: !XML.Pos
+             , aref_ident  :: !Ident
+             } -- ^ Ref
  deriving (Eq,Show)
 
 {-
@@ -360,9 +364,9 @@ similarPlain = foldMap $ \(TS.Tree n ts) ->
         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 }}
@@ -376,6 +380,7 @@ similarPlain = foldMap $ \(TS.Tree n ts) ->
         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
@@ -393,21 +398,22 @@ instance Hashable Title where
                         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
index dc6a5673cd65556be82214e93f1214f54d8a2f61..4558bec88b715426de6b8d2d560bcadd4af111da 100644 (file)
@@ -38,7 +38,6 @@ class RNC.Sym_RNC repr => Sym_DTC repr where
        head             :: repr DTC.Head
        about            :: repr DTC.About
        header           :: repr DTC.Header
-       tag              :: repr TL.Text
        
        body             :: repr DTC.Body
        include          :: repr DTC.Include
@@ -273,10 +272,12 @@ class RNC.Sym_RNC repr => Sym_DTC repr where
                 , 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
@@ -289,7 +290,7 @@ class RNC.Sym_RNC repr => Sym_DTC repr where
                         <|*> author
                         <|?> (def, Just <$> editor)
                         <|?> (def, Just <$> date)
-                        <|*> tag
+                        <|*> element "tag" text
                         <|*> link
                         <|*> serie
                         <|?> (def, Just <$> element "description" para)
@@ -426,7 +427,6 @@ schema =
  , void $ head
  , void $ rule "about" $ element "about" about
  , void $ header
- , void $ tag
  , void $ author
  , void $ editor
  , void $ date
index 9f4b1e6249fe818af4c28e086680837cd6cc5198..bd4ca25d6f4b01961fd5cf9a851e9f942d289ed0 100644 (file)
@@ -144,7 +144,7 @@ writeHTML5 conf@Config{..} doc_init = do
                                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}
@@ -682,62 +682,99 @@ instance Html5ify (Tree PlainNode)
                        "<"::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 $
@@ -759,10 +796,10 @@ instance Html5ify (Tree PlainNode)
                         _ -> 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
@@ -834,15 +871,16 @@ instance Html5ify Entity where
        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 ->
@@ -898,19 +936,21 @@ instance Html5ify Reference where
                                "]"
                        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
@@ -935,10 +975,15 @@ instance Semigroup SVG.Element where
        (<>) = 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
index 839fec5b5f76e3e52fd37e09bc461aeb6124927a..1b6e0d868295eb7bf4cfd187dfee5de79c22834a 100644 (file)
@@ -47,7 +47,6 @@ import qualified Hdoc.DTC.Analyze.Check   as Analyze
 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'
@@ -116,7 +115,9 @@ instance Monoid Writer where
 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]]
@@ -129,7 +130,9 @@ instance Default State where
        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
@@ -191,16 +194,16 @@ class
  ( 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
@@ -215,8 +218,8 @@ instance L10n HTML5 EN where
        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"
@@ -233,8 +236,8 @@ instance L10n HTML5 FR where
        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"
index 5b5d718a978b765b044ed026a2d10e2d6072174e..80a1e32530ee034df7e32a6d9f86d680054f889f 100644 (file)
@@ -60,9 +60,9 @@ instance (Html5ify Plain, Html5ify TCT.Location) => Html5ify (Analyze.Errors (Se
                         (\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)
@@ -143,12 +143,12 @@ instance (Html5ify Plain, Html5ify TCT.Location) => Html5ify (Analyze.Errors (Se
                                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)])]
index 3810c9288710087acf5ef99d1aa3ce352e3b7725..7c02fd548e505a5adb248d6cf2e54d0fe0a8fc39 100644 (file)
@@ -107,6 +107,14 @@ identifyTag suffix tag count =
         <> 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
index 6b66d44cd5a2971f79e872bee8ea98cfbe9ee21f..f295a4c3db417766a417e58c543298cc73ca83cd 100644 (file)
@@ -103,8 +103,11 @@ instance Plainify (Tree PlainNode) where
                 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
index 4987902808cc3ac79497b755f4c58a412a6af0c4..506b1bcf118aa8cb3d9ca5450911d0c937f1e65f 100644 (file)
@@ -146,8 +146,11 @@ instance Xmlify (Tree PlainNode) 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
index 88de3bd5c794cec911c4fbeeea3cbd3facebaf60..c20bc4b5fa9e62cf944c0974867e5d0d9b4dacca 100644 (file)
@@ -15,7 +15,7 @@ import Data.Either (Either(..))
 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(..))
@@ -111,10 +111,14 @@ closePair (t,(cx@(Cell (Span  fx  bx _ex:| lx) px),t1):ts)
 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
@@ -135,11 +139,6 @@ appendLexeme lex acc = -- debug2 "appendLexeme" "lex" "acc" $ \lex 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
@@ -169,7 +168,7 @@ data Lexeme
  |   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
@@ -222,8 +221,10 @@ orientLexemePairAny = \case
        
         -- ",,,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
@@ -235,6 +236,10 @@ orientLexemePairAny = \case
         -- )"
         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
@@ -243,11 +248,11 @@ p_Lexeme = debugParser "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)
         ]
 
@@ -263,7 +268,8 @@ pairAny = \case
  '`'  -> Just PairBackquote
  '_'  -> Just PairUnderscore
  '*'  -> Just PairStar
- '#'  -> Just PairHash
+ '#'  -> Just $ PairTag False
+ '@'  -> Just $ PairAt  False
  _    -> Nothing
 
 pairOpen :: Char -> Maybe Pair
@@ -282,6 +288,12 @@ pairClose = \case
  '»'  -> 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
 
@@ -346,7 +358,10 @@ pairBordersDouble = \case
                elemAttr_open  <>
                elemAttr_value <>
                elemAttr_close
- PairHash        -> ("#","#")
+ PairTag isBackref | isBackref -> ("^#","#")
+                   | otherwise -> ("#","#")
+ PairAt  isBackref | isBackref -> ("^@","@")
+                   | otherwise -> ("@","@")
  PairStar        -> ("*","*")
  PairSlash       -> ("/","/")
  PairUnderscore  -> ("_","_")
@@ -359,22 +374,22 @@ pairBordersDouble = \case
  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)
@@ -382,15 +397,15 @@ instance TagFrom Tokens where
                                        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 =
index 4a9187fc1d29665480dccd8c4e8d06fea64d2656..146456ea5c2b2dac5356e13a7126552155a697c4 100644 (file)
@@ -48,7 +48,7 @@ p_CellHeader row = debugParser "CellHeader" $ do
                                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 $
index be4af8c4977c82028d7785c4e35c5be36c999933..67b3749bd35212ad3bd046728683940dc29aa98d 100644 (file)
@@ -33,7 +33,7 @@ import Hdoc.TCT.Elem
 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.
@@ -42,7 +42,8 @@ import Hdoc.TCT.Debug
 -- 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)
@@ -87,7 +88,8 @@ type LevelSection = Int
 -- * 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_@
@@ -105,17 +107,18 @@ instance Pretty Pair
 -- * 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]
index 4fe66692895e9bf7b0399e3d8541cd8311074921..f3df1397ca8c035a887a9ce327523f9a53a630f1 100644 (file)
@@ -301,8 +301,19 @@ instance Html5ify Token where
        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
index 2e63d931e9c89463dcea1d11fd1d24949213443f..82836ed0d2e3d5dff576a617c734e1ac31df5fb7 100644 (file)
@@ -211,7 +211,8 @@ instance Plainify Header where
 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
index 6ef401ee04dd374c641a881e62a401f730809e6b..7e20ee9481de567c5aa6656861277322c8235d9b 100644 (file)
@@ -152,7 +152,7 @@ instance Xmlify Roots where
                                                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)
@@ -334,7 +334,7 @@ instance Xmlify Root where
                         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
@@ -358,11 +358,17 @@ instance Xmlify Root where
                                                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) $
@@ -384,7 +390,10 @@ instance Xmlify Root where
                        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 ->
@@ -412,6 +421,8 @@ elems =
  , "area"
  , "artwork"
  , "aside"
+ , "at"
+ , "at-back"
  , "audio"
  , "author"
  , "authors"
@@ -461,10 +472,11 @@ elems =
  , "postamble"
  , "preamble"
  , "q"
+ , "ref"
  , "reference"
  , "references"
+ , "refs"
  , "region"
- , "rref"
  , "sc"
  , "section"
  , "serie"
@@ -476,6 +488,7 @@ elems =
  , "sup"
  , "table"
  , "tag"
+ , "tag-back"
  , "tbody"
  , "td"
  , "tel"
index 00e4c89a5a0b57a982260085c7247405c29904fa..578eebba3952dd36eea1870c482788936f238289 100644 (file)
@@ -44,6 +44,10 @@ about :: DTC -> DTC
 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
@@ -116,13 +120,15 @@ q :: 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
@@ -136,6 +142,8 @@ sup = Parent "sup" "<sup" "</sup>"
 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
index 930be9f70b7b1db3bf468436acc3fb4687406af4..3e460dfa433785d1ee9bdbcf574667a549262790 100644 (file)
         }
        .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;
         }
index 207199770ffa54b3aa4e5e0da6ee01084b019a85..d96251ca6c1e6fde2d03cdf042c5ae838bc2a101 100644 (file)
@@ -22,6 +22,7 @@ section {
  }
 
 .tag,
+.at,
 .pair-PairHash {
        //color:blue;
        //color:#CD853F;
@@ -69,6 +70,7 @@ section {
  }
 .pair-open,
 .pair-close,
+.at > .at-open,
 .tag > .tag-open {
        //color:#000080;
        color:darkgrey;
index 6d35c49a3435135e548a5f8bc311971df500e80a..23553c1dc0abc5796c20e5aa4b272e2d01447f84 100644 (file)
@@ -2,7 +2,7 @@
 " 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 :
@@ -21,27 +21,27 @@ syn match tctPlain /.\+/ contains=@tctInline
 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
@@ -116,10 +116,10 @@ syn cluster tctBlock contains=tctPath,tctSection
 
 " Inline
 syn match tctBold
-    \ /\(^\|[  `’«»/"|_,.:…;@^!?=~%(){}[\]\\&+-]\)\zs\*[^ *]\([^*]*[^ *]\)\?\*\ze\([  `’«»/"|_,.:…;@^!?=~%(){}[\]\\&+-]\|$\)/
+    \ /\(^\|[  `’«»/"|,.:…;@^!?=~%(){}[\]\\&+]\)\zs\*[^ *]\([^*]*[^ *]\)\?\*\ze\([  `’«»/"|,.:…;@^!?=~%(){}[\]\\&+]\|$\)/
     \ contained contains=@tctInline
 syn match tctCode
-    \ /\(^\|[  *’«»/"|_,.:…;@^!?=~%(){}[\]\\&+-]\)\zs`[^ `]\([^`]*[^ `]\)\?`\ze\([  *’«»/"|_,.:…;@^!?=~%(){}[\]\\&+-]\|$\)/
+    \ /\(^\|[  *’«»/"|,.:…;@^!?=~%(){}[\]\\&+]\)\zs`[^ `]\([^`]*[^ `]\)\?`\ze\([  *’«»/"|,.:…;@^!?=~%(){}[\]\\&+]\|$\)/
     \ contained contains=@tctInline
 syn match tctE
     \ /<\/\?[^ >]\+\/\?>/
@@ -134,19 +134,22 @@ syn match tctQuoteFrench
     \ /«.\{-}»/
     \ 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[\]]*\(\[[^\]]*\]\)\?/
@@ -178,7 +181,7 @@ syn region tctAttrValue contained start=+"+ end=+"+ contains=tctEntity
 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
@@ -190,10 +193,11 @@ hi def link tctEntity       Statement
 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