示例#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.Error(
    extensions=rule.TOPICS_AND_SNIPPETS,
    match=flarenode.whenself('table'),
    test=lambda n: 'mc-table-style' in n.attribute('style'),
    message="""Missing style for a table.  What kind of table is this?  To fix,
    right-click the table, choose a style from Table Style.""")
示例#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 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.Error(
    extensions=rule.TOPICS_AND_SNIPPETS,
    match=flarenode.whenself('MadCap:xref'),
    test=lambda n: '#' not in n.attribute('href'),
    message="""Cross-reference to a location in the same topic or to a specific
    element inside another topic. Our write style allows
    cross-references to link only to an entire topic file. To fix,
    restructure or link the cross-references to another topic (in the
    same project).""")
示例#4
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.Error(
    extensions=rule.TOPICS,
    match=flarenode.whenself('body'),
    test=lambda n: n.child('h1'),
    message="""Missing title (`h1`). To fix, add a title to the beginning of the
    topic body.""")
示例#5
0
#
# 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.Error(
    extensions = rule.TOPICS_AND_SNIPPETS,

    match = flarenode.whenself('ul'),

    test = lambda n: not n.child('li', lambda n: n.child('p', lambda n: n.position() > 0)),

    message = """Too many paragraphs in a list item (`li`) of a bullet list (`ul`).
    Our writing convention is for a single paragraph in a bullet list
    item (`li`). To fix, move the extra paragraphs to separate list
    items, consider using sections (`h2.Section` elements), or
    consider using a table."""
)

示例#6
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.Error(
    extensions=rule.TOPICS,
    match=flarenode.whenself('h1'),
    test=lambda n: not n.precedingsibling('h1'),
    message="""Too many `h1` titles. A topic may contain only one title. To fix,
    restructure the topic or create separate sub-topic files.""")
示例#7
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.Error(
    extensions=rule.TOPICS_AND_SNIPPETS,
    match=flarenode.whenself('div'),
    test=lambda n: not n.style('div'),
    message="""Text box with missing style class.  What kind of text box is this?
    To fix, apply a style.""")
示例#8
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.""")
示例#9
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
import os

_ACCEPTED_FORMATS = ['.png', '.jpg', '.jpeg']

rule.Error(
    extensions = rule.TOPICS_AND_SNIPPETS,

    match = flarenode.whenself('img'),

    test = lambda n: os.path.splitext(n.attribute('src'))[1].lower() in _ACCEPTED_FORMATS,

    message = """Unsupported graphics format. To fix, convert this file to an
    accepted format (""" + ", ".join(["`{0}`".format(s) for s in _ACCEPTED_FORMATS]) + """), 
    revise the link to the new graphics file, and delete the
    unsupported file."""
)