# Path: engine/conf.py
# PATH_TO_MD = PATH + '/notes/'
# 
# SCREENSHOT_INBOX = None
# 
# PATH_TO_IMG = PATH + '/notes/'
# 
# IMG_PREFIX = 'imgs/'  # keep / at the end  # ![](imgs/<file> this 'imgs' is IMG_PREFIX


from engine.conf import PATH_TO_MD, SCREENSHOT_INBOX, PATH_TO_IMG, IMG_PREFIX
        from rna_pdb_tools import SecondaryStructure
import os
import logging
logger = logging.getLogger('geekbook')

def get_ss(text):
    """Draw secondary structure using VARNA.

    .. warning :: to each image `ss_` is added at the beginning of the image file

    1. if the line after </pre> has ![ it means that there is an image already, don't generate new one. 
    And of course, it means if you remove this line, the image will be regenerated.

    2. if [!danger] also skip generation images.

    Should I overwrite a file ? By default no! Use [ss:file:t] # to set overwrite to true """
    try:
    except ImportError:
        logger.info('import error rna_pdb_tools')
        return text, False

    changed = False
    ltext = text.split('\n')
    for c in range(0, len(ltext)):
        if ltext[c].startswith('<pre>[ss'):
            if ltext[c+4].startswith('!['): # ^1
                continue
            if ltext[c+4].startswith('[!danger]'): # ^2

# Path: engine/conf.py
# PATH_TO_MD = PATH + '/notes/'
# 
# SCREENSHOT_INBOX = None
# 
# PATH_TO_IMG = PATH + '/notes/'
# 
# IMG_PREFIX = 'imgs/'  # keep / at the end  # ![](imgs/<file> this 'imgs' is IMG_PREFIX


# Path: engine/plugins/draw_secondary_structure.py
from engine.conf import PATH_TO_MD, SCREENSHOT_INBOX, PATH_TO_IMG, IMG_PREFIX
        from rna_pdb_tools import SecondaryStructure
import os
import logging

logger = logging.getLogger('geekbook')

def get_ss(text):
    """Draw secondary structure using VARNA.

    .. warning :: to each image `ss_` is added at the beginning of the image file

    1. if the line after </pre> has ![ it means that there is an image already, don't generate new one. 
    And of course, it means if you remove this line, the image will be regenerated.

    2. if [!danger] also skip generation images.

    Should I overwrite a file ? By default no! Use [ss:file:t] # to set overwrite to true """
    try:
    except ImportError:
        logger.info('import error rna_pdb_tools')
        return text, False

    changed = False
    ltext = text.split('\n')
    for c in range(0, len(ltext)):
        if ltext[c].startswith('<pre>[ss'):
            if ltext[c+4].startswith('!['): # ^1
                continue
            if ltext[c+4].startswith('[!danger]'): # ^2

                continue