コード例 #1
0
#
# Copyright 2016-2017 Intelerad Medical Systems Incorporated.  All
# rights reserved.
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (the "License").  You may not use this file except in compliance
# with the License.
#
# The full text of the License is in LICENSE.txt.  See the License
# for the specific language governing permissions and limitations
# under the License.
#
# When distributing Covered Software, include this CDDL HEADER in
# each file and include LICENSE.txt.  If applicable, add the
# following below this CDDL HEADER, with the fields enclosed by
# brackets "[]" replaced with your own identifying information:
# Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END

from flarelint import rule
from flarelint import flarenode

rule.Warning(
    extensions=rule.TOPICS_AND_SNIPPETS,
    match=flarenode.whenself('ul'),
    test=lambda n: n.child('li', lambda n: n.position() > 0),
    message="""Only one list item (`li`) in a bullet list (`ul`). Are you sure
    that this needs to be a bullet list?""")
コード例 #2
0
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (the "License").  You may not use this file except in compliance
# with the License.
#
# The full text of the License is in LICENSE.txt.  See the License
# for the specific language governing permissions and limitations
# under the License.
#
# When distributing Covered Software, include this CDDL HEADER in
# each file and include LICENSE.txt.  If applicable, add the
# following below this CDDL HEADER, with the fields enclosed by
# brackets "[]" replaced with your own identifying information:
# Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END

from flarelint import rule
from flarelint import flarenode
import os

_ACCEPTED_FONT_SIZE = '16pt'

rule.Warning(
    extensions=rule.CAPTURE_GRAPHICS,
    match=flarenode.whenself('Shape'),
    test=lambda n: not n.text().startswith(r'{\rtf'),
    message="""Custom formatting in a callout.  To fix, in Capture, replace this
    callout with a new callout and set the font size to """ +
    _ACCEPTED_FONT_SIZE + """.""")
コード例 #3
0
# (the "License").  You may not use this file except in compliance
# with the License.
#
# The full text of the License is in LICENSE.txt.  See the License
# for the specific language governing permissions and limitations
# under the License.
#
# When distributing Covered Software, include this CDDL HEADER in
# each file and include LICENSE.txt.  If applicable, add the
# following below this CDDL HEADER, with the fields enclosed by
# brackets "[]" replaced with your own identifying information:
# Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END

from flarelint import rule
from flarelint import flarenode

rule.Warning(extensions=rule.TOPICS,
             match=flarenode.whenself('title'),
             test=lambda n: n.valueof().strip() == '',
             message="""The HTML `title` element contains text.
    Flare prefers using this text, when it exists, instead of the
    topic's `h1` title when generating online
    help.  We prefer the latter to make maintenance easier and avoid
    surprises.  For example, when these elements do not have identical
    content, the links in the See Also sections and search results of
    online help have different names than the topic title.  To fix,
    right-click the topic in Content Explorer, then in the Topic
    Properties tab, delete Topic Title.""")
コード例 #4
0
# for the specific language governing permissions and limitations
# under the License.
#
# When distributing Covered Software, include this CDDL HEADER in
# each file and include LICENSE.txt.  If applicable, add the
# following below this CDDL HEADER, with the fields enclosed by
# brackets "[]" replaced with your own identifying information:
# Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END

from flarelint import rule
from flarelint import flarenode

rule.Warning(
    extensions = rule.TOPICS_AND_SNIPPETS,
                 
    match = lambda n: n.name() in ["h1", "h2", "h3", "h4", "h5", "h6"],
                 
    test = lambda n: (not '\n' in n.valueof()) or n.child('br'),
                 
    message = """Hidden line break in a heading element. This line break could cause
    a broken page header or footer in PDF.  To fix, open the topic in
    the text editor (raw XML) and make sure that the contents of the
    element are all on one line.

    *Tip:* If there are keyword elements in the heading, move them to
     the first paragraph. """
)

コード例 #5
0
# rights reserved.
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (the "License").  You may not use this file except in compliance
# with the License.
#
# The full text of the License is in LICENSE.txt.  See the License
# for the specific language governing permissions and limitations
# under the License.
#
# When distributing Covered Software, include this CDDL HEADER in
# each file and include LICENSE.txt.  If applicable, add the
# following below this CDDL HEADER, with the fields enclosed by
# brackets "[]" replaced with your own identifying information:
# Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END

from flarelint import rule
from flarelint import flarenode

rule.Warning(
    extensions=rule.TOPICS_AND_SNIPPETS,
    match=flarenode.whenself('ul'),
    test=lambda n: not n.nextsibling('ul'),
    message=
    """Two or more consecutive, separate `ul` elements. Should these lists
    be merged?  To fix two consecutive lists, do the following: Use
    Format | List | List Actions | Merge command. """)
コード例 #6
0
# with the License.
#
# The full text of the License is in LICENSE.txt.  See the License
# for the specific language governing permissions and limitations
# under the License.
#
# When distributing Covered Software, include this CDDL HEADER in
# each file and include LICENSE.txt.  If applicable, add the
# following below this CDDL HEADER, with the fields enclosed by
# brackets "[]" replaced with your own identifying information:
# Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END

from flarelint import rule
from flarelint import flarenode

rule.Warning(
    extensions=rule.TOPICS_AND_SNIPPETS,
    match=lambda n: n.name() in ["h1", "h2", "h3", "h4", "h5", "h6"],
    test=lambda n: '*' not in n.valueof(),
    message="""A title contains an
        asterisk (""" + rule.LDQUO + """*""" + rule.RDQUO + """).  """ +
    """MadCap Flare version 8 (and possibly other versions) will not put a
        cross-reference to this topic in a relationships proxy for PDF
        targets.  To fix, remove or replace the asterisk with
        something else. Also, update TOC entries that refer to this
        topic. Finally, publicly shame MadCap for such a ridiculous,
        shameful, arbitrary, confounding, nonsensical, time-wasting
        bug.  """)
コード例 #7
0
# with the License.
#
# The full text of the License is in LICENSE.txt.  See the License
# for the specific language governing permissions and limitations
# under the License.
#
# When distributing Covered Software, include this CDDL HEADER in
# each file and include LICENSE.txt.  If applicable, add the
# following below this CDDL HEADER, with the fields enclosed by
# brackets "[]" replaced with your own identifying information:
# Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END

from flarelint import rule
from flarelint import flarenode
import re

_PUNCTUATION = '!?.'
_RE = r'[{0}]\s*$'.format(_PUNCTUATION)

rule.Warning(
    extensions=rule.TOPICS_AND_SNIPPETS,
    match=flarenode.whenself('MadCap:xref'),
    test=lambda n: not re.search(_RE, n.valueof()),
    message="""Misplaced punctuation in a cross-reference.  To fix, place
    punctuation outside of the cross-reference element. *Note:*
    Flare replaces the text in cross-references when it builds a
    target. Punctuation, and any other text that you inserted inside
    this element could be replaced at the next build.""")