This file is indexed.

/usr/share/doc/libghc-template-doc/html/template.txt is in libghc-template-doc 0.2.0.10-6build2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Simple string substitution
--   
--   Simple string substitution library that supports "$"-based
--   substitution. Meant to be used when Text.Printf or string
--   concatenation would lead to code that is hard to read but when a full
--   blown templating system is overkill.
@package template
@version 0.2.0.10


-- | A simple string substitution library that supports "$"-based
--   substitution. Substitution uses the following rules:
--   
--   <ul>
--   <li>"$$" is an escape; it is replaced with a single "$".</li>
--   <li>"$identifier" names a substitution placeholder matching a mapping
--   key of "identifier". "identifier" must spell a Haskell identifier. The
--   first non-identifier character after the "$" character terminates this
--   placeholder specification.</li>
--   <li>"${identifier}" is equivalent to "$identifier". It is required
--   when valid identifier characters follow the placeholder but are not
--   part of the placeholder, such as "${noun}ification".</li>
--   </ul>
--   
--   Any other appearance of "$" in the string will result in an
--   <a>error</a> being raised.
--   
--   If you render the same template multiple times it's faster to first
--   convert it to a more efficient representation using <a>template</a>
--   and then render it using <a>render</a>. In fact, all that
--   <a>substitute</a> does is to combine these two steps.
module Data.Text.Template

-- | A representation of a <a>Text</a> template, supporting efficient
--   rendering.
data Template

-- | A mapping from placeholders in the template to values.
type Context = Text -> Text

-- | Like <a>Context</a>, but with an applicative lookup function.
type ContextA f = Text -> f Text

-- | Create a template from a template string. A malformed template string
--   will raise an <a>error</a>.
template :: Text -> Template

-- | Create a template from a template string. A malformed template string
--   will cause <a>templateSafe</a> to return <tt>Left (row, col)</tt>,
--   where <tt>row</tt> starts at 1 and <tt>col</tt> at 0.
templateSafe :: Text -> Either (Int, Int) Template

-- | Perform the template substitution, returning a new <a>Text</a>.
render :: Template -> Context -> Text

-- | Perform the template substitution, returning a new <a>Text</a>. A
--   malformed template string will raise an <a>error</a>. Note that
--   
--   <pre>
--   substitute tmpl ctx == render (template tmpl) ctx
--   </pre>
substitute :: Text -> Context -> Text

-- | Show the template string.
showTemplate :: Template -> Text

-- | Like <a>render</a>, but allows the lookup to have side effects. The
--   lookups are performed in order that they are needed to generate the
--   resulting text.
--   
--   You can use this e.g. to report errors when a lookup cannot be made
--   successfully. For example, given a list <tt>ctx</tt> of key-value
--   pairs and a <a>Template</a> <tt>tmpl</tt>:
--   
--   <pre>
--   renderA tmpl (flip lookup ctx)
--   </pre>
--   
--   will return <a>Nothing</a> if any of the placeholders in the template
--   don't appear in <tt>ctx</tt> and <tt>Just text</tt> otherwise.
renderA :: Applicative f => Template -> ContextA f -> f Text

-- | Perform the template substitution in the given <a>Applicative</a>,
--   returning a new <a>Text</a>. Note that
--   
--   <pre>
--   substituteA tmpl ctx == renderA (template tmpl) ctx
--   </pre>
substituteA :: Applicative f => Text -> ContextA f -> f Text
instance GHC.Classes.Eq Data.Text.Template.Template
instance GHC.Show.Show Data.Text.Template.Template
instance GHC.Show.Show Data.Text.Template.Frag